Color chat? -
Servidor_BRASIL - 03.12.2008
Well I walked into a server, where the chat was colorful, example
[GS[F]Kaike: Hi!) his nickname was the color blue, when you sent a message he would also blue, someone knows the code? Somebody could send him please?
Thank you!
Example:
/imageshack/my.php?image=samp077pc2.jpg
Re: Color chat? -
JaTochNietDan - 03.12.2008
Well you can just do
pawn Code:
new string[128];
new name[24];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%s: %s",name,text);
SendClientMessageToAll(whatevercolor,string);
Put that in OnPlayerText and replace whatevercolor with the color you want, you can also make it so that it choses the color of their name by replacing whatevercolor with GetPlayerColor(playerid)
Re: Color chat? -
Norn - 03.12.2008
Quote:
Originally Posted by JaTochNietDan
Well you can just do
pawn Code:
new string[128]; new name[24]; GetPlayerName(playerid,name,sizeof(name)); format(string,sizeof(string),"%s: %s",name,text); SendClientMessageToAll(whatevercolor,string);
Put that in OnPlayerText and replace whatevercolor with the color you want, you can also make it so that it choses the color of their name by replacing whatevercolor with GetPlayerColor(playerid)
|
Also remember to return the function 0 or else it will display both messages.
Re: Color chat? -
Serbish - 03.12.2008
Quote:
Originally Posted by JaTochNietDan
Well you can just do
pawn Code:
new string[128]; new name[24]; GetPlayerName(playerid,name,sizeof(name)); format(string,sizeof(string),"%s: %s",name,text); SendClientMessageToAll(whatevercolor,string);
Put that in OnPlayerText and replace whatevercolor with the color you want, you can also make it so that it choses the color of their name by replacing whatevercolor with GetPlayerColor(playerid)
|
Yes.
Code:
new string[128];
new name[24];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%s: %s",name,text);
SendClientMessageToAll(GetPlayerColor(playerid),string);
Re: Color chat? -
Servidor_BRASIL - 03.12.2008
Almost gave, but failed, instead of the color out of the color of the nickname, it leaves black, regardless of the color of the player!
What could it be?
Code:
public OnPlayerText (playerid, text [])
{
new string[128];
new name[24];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%s: %s",name,text);
SendClientMessageToAll(GetPlayerColor(playerid),st ring);
return 0;
}
Thank you!
Re: Color chat? -
Serbish - 03.12.2008
Quote:
Originally Posted by Servidor_BRASIL
Almost gave, but failed, instead of the color out of the color of the nickname, it leaves black, regardless of the color of the player!
What could it be?
Code:
public OnPlayerText (playerid, text [])
{
new string[128];
new name[24];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%s: %s",name,text);
SendClientMessageToAll(GetPlayerColor(playerid),st ring);
return 1;
}
Thank you!
|
It's impossible! The GetPlayerColor(playerid) function gives the color back that the player has. It can't be black if the player is white.
Re: Color chat? -
Servidor_BRASIL - 03.12.2008
O_O ...
So how can be black, if the code is correct?
Re: Color chat? -
Mikep - 03.12.2008
GetPlayerColor doesn't return any value if SetPlayerColor hasnt been used.
Look in mikefunc (my include) and use the ColorCorrect(playerid); function.
Re: Color chat? -
Servidor_BRASIL - 03.12.2008
Mikep I' love You =D
It worked perfectly, who wanted to look:
200.155.33.83:17777 24 Hours On!
Re: Color chat? -
Mikep - 03.12.2008
You're welcome mate.
Re: Color chat? -
randomkid88 - 10.08.2010
I am also trying to do this with prox detector. I want the whole string to be one color, depending on how far away the person is. I have the same code as above, however instead of the SendClientMessageToAll, it have ProxDetector. Any suggestions?
Re: Color chat? -
bestr32 - 16.01.2012
pawn Code:
new string[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"{0000AA}%s {00AA00}[%i]{FFFFFF}: %s",name,playerid,text);
return SendClientMessageToAll(0xFFFFFFFF,string), 0;
This is it... Easy