SA-MP Forums Archive
OnPlayerText not getting 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: OnPlayerText not getting player color. (/showthread.php?tid=446353)



OnPlayerText not getting player color. - RiChArD_A - 25.06.2013

Hi, this isn't getting the player color, even if I change the color in-game it will throw it on white
Code:
pawn Код:
public OnPlayerText(playerid, text[])
{
new message[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(message, sizeof(message), "%s(%i): %s", name, playerid, text);
SendClientMessageToAll(-1, message);
return 0;
}



Re: OnPlayerText not getting player color. - KingHual - 25.06.2013

I'm sorry, what?


AW: OnPlayerText not getting player color. - BigETI - 25.06.2013

You have to use the color of the player to show the correct color.
pawn Код:
public OnPlayerText(playerid, text[])
{
    new message[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(message, sizeof message, "%s(%d): {FFFFFF}%s", name, playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid), message);
    return 0;
}



Re: OnPlayerText not getting player color. - dEcooR - 25.06.2013

try this

Код:
public OnPlayerText(playerid, text[])
{
new message[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(message, sizeof(message), "%s(%i): {ffffff}%s", name, playerid, text);
SendClientMessageToAll(GetPlayerColor(playerid), message);
return 0;
}



Re: AW: OnPlayerText not getting player color. - RiChArD_A - 25.06.2013

Quote:
Originally Posted by BigETI
Посмотреть сообщение
You have to use the color of the player to show the correct color.
pawn Код:
public OnPlayerText(playerid, text[])
{
    new message[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(message, sizeof message, "%s(%d): {FFFFFF}%s", name, playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid), message);
    return 0;
}
Ok i'll try it.


haha i was trying like this lol
pawn Код:
public OnPlayerText(playerid, text[])
{
    new message[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        GetPlayerColor(playerid);
    format(message, sizeof message, "%s(%d): {FFFFFF}%s", name, playerid, text);
    SendClientMessageToAll(playerid, message);
    return 0;
}
EDIT: YES! it works perfectly thanks
but it sets the player color to black. is there a way to make it random. because everyone will be black in the server lol


Re: OnPlayerText not getting player color. - [jS]Thomas - 25.06.2013

Are you even serious?

You're using GetPlayerColor then going no where with it.


Re: OnPlayerText not getting player color. - Vince - 25.06.2013

SendPlayerMessageToAll is probably a better option than SendClientMessageToAll.


AW: OnPlayerText not getting player color. - BigETI - 25.06.2013

You have to set the player's color before you use GetPlayerColor, otherwise it will return 0.


Re: OnPlayerText not getting player color. - RiChArD_A - 26.06.2013

Quote:
Originally Posted by Vince
Посмотреть сообщение
SendPlayerMessageToAll is probably a better option than SendClientMessageToAll.
Hey! this is exactly what I needed. This whole thing was because I wanted to show the player id next to the name.

Thanks Vince!!

Thanks BigETI!!