SendPlayerMessageToAll

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 03:47, 31 July 2013
Smithy (Talk | contribs)

← Previous diff
Revision as of 21:29, 31 January 2014
Connor Mead (Talk | contribs)

Next diff →
Line 33: Line 33:
[[Category:Scripting Functions]] [[Category:Scripting Functions]]
 +
 +[[fr:SendPlayerMessageToAll]]

Revision as of 21:29, 31 January 2014




Description:

Sends a message in the name of a player to all other players on the server. The line will start with the sender's name in their color, followed by the message in white.


Parameters:
(senderid, const message[])
senderidThe ID of the sender. If invalid, the message will not be sent.
const message[]The message that will be sent.


Return Values:

This function does not return any specific values.


public OnPlayerText(playerid, text[])
{
    // format a message to contain the player's id in front of it
    new string[128];
    format(string, sizeof(string), "(%d) %s", playerid, text);
 
    SendPlayerMessageToAll(playerid, string);
 
    return 0; // return 0 prevents the original message being sent
 
    // Assuming 'playerid' is 0 and the player is called Tenpenny, the output will be 'Tenpenny:(0) <message>'
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.


Related Callbacks

The following callbacks might be useful, as they're related to this function in one way or another.

  • OnPlayerText: Called when a player sends a message via the chat.
In other languages