---
title: "GetGameText | open.mp"
description: "获取指定玩家游戏文本样式的所有相关信息。"
canonical: https://omp.itsneufox.com/zh-CN/docs/scripting/functions/GetGameText
language: zh-CN
---

# GetGameText

注意

这个函数是在omp v1.1.0.2612中添加的，在以前的版本中不起作用！

## 描述

获取指定玩家游戏文本样式的所有相关信息。

| 参数 | 说明 |
| --- | --- |
| playerid | 要获取信息的玩家 ID |
| style | 要查询的[游戏文本样式](https://omp.itsneufox.com/zh-CN/docs/scripting/resources/gametextstyles) |
| message\[\] | 存储文本内容的数组变量（引用传递） |
| len（数组长度） | 输出数组的容量大小 |
| time | 游戏文本最初显示的持续时间（单位：毫秒） |
| remaining | 当前剩余的显示时间（单位：毫秒） |

## 返回值

true - 函数执行成功

false - 函数执行失败（玩家不存在或样式无效）

## 示例代码

```c
public OnPlayerConnect(playerid)
{
    GameTextForPlayer(playerid, "欢迎来到服务器！", 5000, 3);  // 显示持续5秒的样式3文本

    new
        message[32],
        time,
        remaining;

    GetGameText(playerid, 3, message, sizeof(message), time, remaining);
    // message = "欢迎来到服务器！"
    // time = 5000
    return 1;
}
```

## 相关函数

-   [GameTextForPlayer](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/GameTextForPlayer): 向玩家显示游戏文本
-   [HideGameTextForPlayer](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/HideGameTextForPlayer): 隐藏玩家的指定样式游戏文本
-   [GameTextForAll](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/GameTextForAll): 向所有玩家显示游戏文本
-   [HideGameTextForAll](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/HideGameTextForAll): 全局隐藏指定样式游戏文本
-   [HasGameText](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/HasGameText): 检测玩家是否正在显示指定样式的游戏文本
