OnPlayerTeamPrivmsg

From SA-MP Wiki

Jump to: navigation, search


Image:32px-Circle-style-warning.png

Warning

This function was removed in SA-MP 0.3. You must make your own command using OnPlayerCommandText.


Description:

This callback is called when a player sends a team private message through the native TPM system (/tpm).


Image:32px-Circle-style-warning.png

Important
Note

Player teams must be set with SetPlayerTeam. If not, messages will be sent to all players.


Parameters:
(playerid,text[])
playeridThe ID of the player that sent a message.
text[]The text player wrote to team.


Example Usage:

/*
 *  Example script to alert an admin when a team private message
 *  has been sent.
 */
 
public OnPlayerTeamPrivmsg(playerid, text[])
{
    new
        sSenderName[24],
        sString[128];
 
    GetPlayerName(playerid, sSenderName, sizeof sSenderName);
    format(sString, sizeof sString, "TeamMessage <%s>: %s", senderName, text);
 
    for(new iPlayer = 0 ; iPlayer < MAX_PLAYERS; iPlayer++)
    {
        if(IsPlayerAdmin(iPlayer))
        {
            SendPlayerMessage(iPlayer, 0xFFFFFFAA, sString);
        }
    }
 
    return true;
}

Or if you want to disable the private messaging all together...

/*
 *  Disable all private team messaging.
 */
 
public OnPlayerTeamPrivmsg(playerid, text[])
{
    return false; // Disables it.
}
Personal tools