SA-MP Forums Archive
Player color - 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)
+--- Thread: Player color (/showthread.php?tid=476783)



Player color - iOxide - 20.11.2013

Ok so i have made this

pawn Код:
public OnPlayerText(playerid, text[])
{
      new playertext[128], name[MAX_PLAYER_NAME];
      GetPlayerName(playerid, name, sizeof(name));
      format(playertext, sizeof(playertext), "[%d]%s: {FFFFFF}%s", playerid, name, text);
      SendClientMessageToAll(playerid, playertext);
      return 0;
}
But when player sends a text, playerid and playername are black. How do i get the color of player and it's id? I want the name and id's color display as what color the player class has. How to fix it, please Help!


Re: Player color - Vince - 20.11.2013

Re-check the syntax of SendClientMessageToAll. Especially what variables should be put there.


Re: Player color - iOxide - 20.11.2013

I just want to know how do i get the player's color depending their classes.


Re: Player color - newbie scripter - 20.11.2013

return 1;

This forum requires that you wait 240 seconds between posts. Please try again in 165 seconds. Faq it

Second Post of urs:

pawn Код:
public OnPlayerText(playerid, text[])
{
      new playertext[128];
     if(Rank /* replace Rank with the enum or smthing u saved with */ == the number) // then use else { if or if.
{
      format(playertext, sizeof(playertext), "[%d]%s: {FFFFFF}%s", playerid, name, text);
}
if(Rank == 5)
{
      format(playertext, sizeof(playertext), "[%d]%s: {FFFFFF}%s", playerid, name, text); // change the HEX code to the color u want
}
      SendClientMessageToAll(playerid, playertext);
      return 1;
}



Re: Player color - InglewoodRoleplay - 20.11.2013

Your SendClientMessageToAll syntax is wrong.
If you're sending a message to everyone, you shouldn't require a playerid. The string color goes where you wrote "playerid". I think -1 means white but I'm not sure.

Check this out:
https://sampwiki.blast.hk/wiki/Function:...ntMessageToAll

pawn Код:
public OnPlayerText(playerid, text[])
{
      new playertext[128], name[MAX_PLAYER_NAME];
      GetPlayerName(playerid, name, sizeof(name));
      format(playertext, sizeof(playertext), "[%d]%s: {FFFFFF}%s", playerid, name, text);
      SendClientMessageToAll(-1, playertext);
      return 0;
}



Re: Player color - iOxide - 20.11.2013

I tried using -1, still the same problem, didn't work ._.


Re: Player color - -Prodigy- - 20.11.2013

You mean this function https://sampwiki.blast.hk/wiki/SendPlayerMessageToAll ? If so, just replace it with "SendClientMessageToAll"


Re: Player color - iOxide - 20.11.2013

I replaced SendClientMessageToAll(playerid, playertext); with SendClientMessageToAll(GetPlayerColor(playerid), playertext); and its working as i wanted lol