SA-MP Forums Archive
OnPlayerText Colour. - 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 Colour. (/showthread.php?tid=419842)



OnPlayerText Colour. - Patrick - 02.03.2013

hello guys. i just have a problem about OnPlayerText

SetPlayerColor(playerid, COLOR_BLUE); sets player to color blue.
but how even my color is blue it doesn't show the right color everytime i wrote a message it just stays white

Here's my whole OnPlayerText

pawn Код:
public OnPlayerText(playerid, text[])
{
    new playercolour =GetPlayerColor(playerid);
    new msg[128];
    format(msg,sizeof(msg),"%s[%d]: {FFFFFF}%s",PlayerName(playerid),playerid, text[0]);
    SendPlayerMessageToAll(playercolour, msg);
    return 0;
}



Re: OnPlayerText Colour. - DaRk_RaiN - 02.03.2013

pawn Код:
public OnPlayerText(playerid, text[])
{
    new playercolour =GetPlayerColor(playerid);
    new msg[128];
    format(msg,sizeof(msg),"%s[%d]: %s",PlayerName(playerid),playerid, text[0]);
    SendPlayerMessageToAll(playercolour, msg);
    return 0;
}



Re: OnPlayerText Colour. - Patrick - 02.03.2013

Dark_Rain now the message doesn't show. but it shows on my print

PS: the problem is not on the {FFFFFF} i just want the name and id will be the same colour as they are and the message will be white..


Re: OnPlayerText Colour. - DaRk_RaiN - 02.03.2013

Oh you returned 0 on the call back
Try this
pawn Код:
public OnPlayerText(playerid, text[])
{
    new playercolour =GetPlayerColor(playerid);
    new msg[128];
    format(msg,sizeof(msg),"%s[%d]: %s",PlayerName(playerid),playerid, text[0]);
    SendPlayerMessageToAll(playercolour, msg);
    return 1;
}
P.S: if you want the text in white and the name in the player color use
pawn Код:
public OnPlayerText(playerid, text[])
{
    new playercolour =GetPlayerColor(playerid);
    new msg[128];
    format(msg,sizeof(msg),"%s[%d]:{FFFFFF} %s",PlayerName(playerid),playerid, text[0]);
    SendPlayerMessageToAll(playercolour, msg);
    return 1;
}



Re: OnPlayerText Colour. - Denying - 02.03.2013

You want the text to show the same as your color?


Re: OnPlayerText Colour. - Catalyst- - 02.03.2013

This will display the players' name in color, and his message in white:
pawn Код:
new msg[128];
format(msg,sizeof(msg),"[%d]: %s", playerid, text[0]);
SendPlayerMessageToAll(playerid, msg);



Re: OnPlayerText Colour. - Vince - 02.03.2013

Why doesn't anyone notice that the function parameters are wrong?
https://sampwiki.blast.hk/wiki/SendPlayerMessageToAll


Re: OnPlayerText Colour. - Patrick - 02.03.2013

it works. but it only show

<PlayerName>: <Message>
not same as the script
<PlayerName>[playerid]: <Message>

its returned 0; because sometimes if u have edited OnPlayertext you must have return it to 0 because or else it will show double message

@Catalyst Trying your code now.

EDIT:

@Catalyst- Thanks working man. isn't it possible to be like PlayerName and PlayerID can be the same colour and only the message will be white?


Re: OnPlayerText Colour. - Denying - 02.03.2013

Just add to the format... Show me your code.


Re: OnPlayerText Colour. - Catalyst- - 02.03.2013

Quote:
Originally Posted by pds2012
Посмотреть сообщение
isn't it possible to be like PlayerName and PlayerID can be the same colour and only the message will be white?
Yes:
pawn Код:
new msg[145];
format(msg,sizeof(msg),"%s [%d]: {FFFFFF}%s", PlayerName(playerid), playerid, text[0]);
SendClientMessageToAll(GetPlayerColor(playerid), msg);