Color chat?
#1


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

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

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

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

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!
Reply
#6

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


O_O ...

So how can be black, if the code is correct?
Reply
#8

GetPlayerColor doesn't return any value if SetPlayerColor hasnt been used.

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

Mikep I' love You =D


It worked perfectly, who wanted to look:

200.155.33.83:17777 24 Hours On!
Reply
#10

You're welcome mate.
Reply
#11

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)