10.01.2013, 04:21
There's no need for the use of strings in OnPlayerText, especially when you're not adding anything that isn't already included, like the player ID for example.
Without the use of player team based chat:
That's basically all you need to know, but if you're using a custom OnPlayerText such as using formatted strings to send player messages, this won't work, and you will have to use the first code as an example, with the format lines included. Otherwise, just make sure it returns 1 and you have no SendPlayerMessageToAll or SendClientMessageToAll functions in your OnPlayerText.
pawn Код:
public OnPlayerText(playerid, text[])
{
if(PlayerTeam[playerid] == 1) return SendClientMessageToAll(COLOR_GROVE, text);
if(PlayerTeam[playerid] == 2) return SendClientMessageToAll(COLOR_BALLAS, text);
return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
if(PlayerTeam[playerid] == TEAM_GROVE)
{
SetPlayerColor(playerid, GROVE_COLOR);
}
else if(PlayerTeam[playerid] == TEAM_BALLAS)
{
SetPlayerColor(playerid, BALLAS_COLOR);
}
return 1;
}