PDA

View Full Version : Color chat?


Servidor_BRASIL
03/12/2008, 07:38 PM
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: http://img267.imageshack.us/my.php?image=samp077pc2.jpg

JaTochNietDan
03/12/2008, 07:41 PM
Well you can just do


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)

Norn
03/12/2008, 07:54 PM
Well you can just do


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.

Serbish
03/12/2008, 07:55 PM
Well you can just do


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.

new string[128];
new name[24];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%s: %s",name,text);
SendClientMessageToAll(GetPlayerColor(playerid),st ring);

Servidor_BRASIL
03/12/2008, 08:01 PM
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!

Serbish
03/12/2008, 08:05 PM
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. :)

Servidor_BRASIL
03/12/2008, 08:09 PM
O_O ...

So how can be black, if the code is correct? :roll:

Mikep
03/12/2008, 08:14 PM
GetPlayerColor doesn't return any value if SetPlayerColor hasnt been used.

Look in mikefunc (my include) and use the ColorCorrect(playerid); function.

Servidor_BRASIL
03/12/2008, 09:35 PM
Mikep I' love You =D


It worked perfectly, who wanted to look:

200.155.33.83:17777 24 Hours On!

Mikep
03/12/2008, 09:38 PM
You're welcome mate.

randomkid88
10/08/2010, 03:13 AM
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?

bestr32
16/01/2012, 07:15 PM
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