Player color
#1

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!
Reply
#2

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

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

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;
}
Reply
#5

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;
}
Reply
#6

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)