chat help
#1

hey I have this code here
PHP код:
if (PlayerIgnored[i][playerid] == 0) SendPlayerMessageToPlayer(i, playerid, text); 
this send the player message when he type like this Silver:balabla but I need it to send it like this Silver[id]:ballala and idk how to do it can anyone help me?
Reply
#2

PHP код:
new string[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string),"%s[%i]: %s", name, playerid, text);
if (
PlayerIgnored[i][playerid] == 0) SendPlayerMessageToPlayer(i, playerid, string); 
Reply
#3

now it sends it like Silver:Silver[id]:bala;
Reply
#4

That's because You have a custom function to send the message. Can you show the SendPlayerMessageToPlayer Function?
Reply
#5

I don't have custom
function
Reply
#6

i made this but it doesn't getplayercolor correctly
PHP код:
                new ptext[256], pname[MAX_PLAYER_NAME];
                
GetPlayerName(playerid, pname, sizeof(pname));
                
format(ptext, sizeof(ptext), "{%d}%s[%d]:{FFFFFF} %s",GetPlayerColor(playerid), pname, playerid, text);
                if (
PlayerIgnored[i][playerid] == 0) SendClientMessage(i ,COLOR_WHITE,ptext); 
Reply
#7

For the first part:
PHP код:
new string[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string),"%s[%i]: %s", name, playerid, text);
if (
PlayerIgnored[i][playerid] == 0) SendClientMessage(i, COLOR_WHITE, string); 
For the get player colour:

PHP код:
new ptext[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(ptext, sizeof(ptext), "{%06x}%s[%d]:{FFFFFF} %s", GetPlayerColor(playerid) >>> 8, pname, playerid, text);
if (
PlayerIgnored[i][playerid] == 0) SendClientMessage(i ,COLOR_WHITE,ptext); 
Reply
#8

thanks +rep
Reply


Forum Jump:


Users browsing this thread: