OnPlayerText Colour.
#1

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;
}
Reply
#2

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;
}
Reply
#3

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..
Reply
#4

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;
}
Reply
#5

You want the text to show the same as your color?
Reply
#6

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);
Reply
#7

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

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?
Reply
#9

Just add to the format... Show me your code.
Reply
#10

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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)