ID problems
#1

Can anyone help with the IDs in front of the name for ex. MyName(ID): <My chat text here>

I have this code where I found in forums

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128], playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, sizeof(string), "%s(%d): %s",playername, playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid),string);
    return 0;
}
But the name in chat is black can someone help me?
Reply
#2

In this line change color:
pawn Код:
SendClientMessageToAll(COLOR_CODE_HERE, string);
Reply
#3

Yes but I want to take the color from tab
Reply
#4

All you can to do to change the message color or the name of the player color what do you mean here ?
Reply
#5

I want when someone telling something in chat to appear like this SecretBoss(ID): but not with a selected color with the color which the player has when he joined in the server (Tab's color)
Reply
#6

Well then the code is ok. Its black because your name is black in game.

Put this OnPlayerSpawn just for testing:

pawn Код:
SetPlayerColor(playerid, 0xFF0000FF); // remove me when testing is over
Now write something in chat and see whats the color of chat.

And you can change this:

pawn Код:
format(string, sizeof(string), "%s(%d): %s",playername, playerid, text);
to this
pawn Код:
format(string, sizeof(string), "%s(%d): {FFFFFF}%s",playername, playerid, text);
Now only player name in chat will be as player color, text will be white.
Reply
#7

ok I will test it in some minutes I am scripting something other now

And when I tried the script I had orange color in tab no black
Reply
#8

Btw here is the right way:
PHP код:
     format(string,128,"{%06x}%s (%d): {FFFFFF}%s",GetPlayerColor(playerid) >>> 8PlayerName(playerid), playeridtext);
    
SendClientMessageToAll(-1string); 
Reply
#9

its not working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)