---
title: "OnPlayerText | open.mp"
description: "Called when a player sends a chat message."
canonical: https://omp.itsneufox.com/th/docs/scripting/callbacks/OnPlayerText
language: th
---

# OnPlayerText

## คำอธิบาย

Called when a player sends a chat message.

| Name | Description |
| --- | --- |
| playerid | The ID of the player who typed the text. |
| text\[\] | The text the player typed. |

## ส่งคืน

It is always called first in filterscripts so returning 0 there blocks other scripts from seeing it.

## ตัวอย่าง

```c
public OnPlayerText(playerid, text[])
{
    new pText[144];
    format(pText, sizeof (pText), "(%d) %s", playerid, text);
    SendPlayerMessageToAll(playerid, pText);
    return 0; // ignore the default text and send the custom one
}
```

## บันทึก

หมายเหตุ

NPC สามารถเรียก Callback นี้ได้

## ฟังก์ชั่นที่เกี่ยวข้องกัน

-   [SendPlayerMessageToPlayer](https://omp.itsneufox.com/th/docs/scripting/functions/SendPlayerMessageToPlayer): Force a player to send text for one player.
-   [SendPlayerMessageToAll](https://omp.itsneufox.com/th/docs/scripting/functions/SendPlayerMessageToAll): Force a player to send text for all players.
