SA-MP Forums Archive
How to make this OnPlayerText ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make this OnPlayerText ? (/showthread.php?tid=130069)



How to make this OnPlayerText ? - AlbanianGuy - 25.02.2010

Its like .. when a elader of the team speacks... and before his name on the chat box .... comes
[LEADER] %S: %S
hOW
Код:
if(text[0] == '!')
	{
	  new string[128];  GetPlayerName(playerid, string, sizeof(string));
	  format(string, sizeof(string), "[*May Day!] %s: %s", string, text[1]);
I started it but i dont want to to be with the '!' to type the message .. if it is posible to make it automaticly.
And this is the team i want it to be TEAM_LEADER


Re: How to make this OnPlayerText ? - PotH3Ad - 25.02.2010

Try this (Not tested but should work)

pawn Код:
public OnPlayerText(playerid, text[])
{
  if(GetPlayerTeam(playerid) == TEAM_LEADER)
  {
    new str[128];
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(str, sizeof(str), "[LEADER] %s: %s", playername, text[1]);
    //for(new i = 0; i < MAX_PLAYERS; i++)
      //if(IsPlayerConnected(i) && GetPlayerTeam(i) == GetPlayerTeam(playerid))
        //SendClientMessage(i, GetPlayerColor(playerid), str);
    return 0;
  }

  return 1;
}