Chat command
#1

pawn Код:
new string[128];
    format(string, sizeof(string), "%s (%d): %s ", GetPlayerNameEx(playerid), playerid, params);
    SendClientMessageToAll(0xFFFF00AA,string);
    return 1;
Ok so what im trying to do is make a public chat like system where anyone can type in something any everyone can read it etc. My problem is on the SendClientMessageToAll im trying to make it so the color of the player name is the color of what ever their "SetPlayerColor" is to so like Example John_Smith's player color is blue so it will come up John Smith(in blue) (ID) (message). How would I do that
Reply
#2

pawn Код:
new string[128];
format(string, sizeof(string), "%s {FFFF00}(%d): %s ", GetPlayerNameEx(playerid), playerid, params);
SendClientMessageToAll(GetPlayerColor(playerid),string);
return 1;
Untested. This means that it will send the client message is there player color. BUT I made it so the color you used before on SendClientMessageToAll to be applied after the players name, meaning only the players name would be colored.

Not sure if this will work, haven't decided to do this before.
Reply
#3

You want to use SendPlayerMessageToAll.

pawn Код:
new pmessage[128];
format(pmessage,128,"(%d) %s",playerid,text);
SendPlayerMessageToAll(playerid,pmessage);
SendPlayerMessageToAll allows you to send a chat message as a certain playerid [and in this case, to modify the message by adding (id)].
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)