SendClientMessageToAll Multiple Colors -
Extraordinariness - 25.02.2014
so basically this is my script
Quote:
public OnPlayerConnect(playerid)
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"%s has joined the server.",pName);
SendClientMessageToAll(COLOR_GREEN,string);
return 1;
}
|
How do I execute multiple colors? E.G.
Extraordinariness has joined the
server.
Re: SendClientMessageToAll Multiple Colors -
itsCody - 25.02.2014
Use HEX's
like
{FFFFFF} - White
{FF0000} red ect
Re: SendClientMessageToAll Multiple Colors -
Avi Raj - 25.02.2014
https://sampforum.blast.hk/showthread.php?tid=250389
Re: SendClientMessageToAll Multiple Colors -
Extraordinariness - 25.02.2014
Can I use defined ones?
EDIT: +rep'ped.
Re: SendClientMessageToAll Multiple Colors -
Avi Raj - 25.02.2014
Quote:
Originally Posted by Extraordinariness
Can I use defined ones?
|
Yes.
Re: SendClientMessageToAll Multiple Colors -
Extraordinariness - 25.02.2014
Thanks :3 +repped
NOTE: Both of you rep'ped
Re: SendClientMessageToAll Multiple Colors -
LocMax - 25.02.2014
NOTE, it has to be like this:
pawn Код:
#define YELLOW "{FFFF00}"
#define RED "{FF0000}"
#define GREY "{CCCCCC}"
and then you use it like this:
pawn Код:
public OnPlayerConnect(playerid)
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,""YELLOW"%s "GREY"has joined the "RED"server.",pName);
SendClientMessageToAll(COLOR_GREEN,string);
return 1;
}
This won't work:
pawn Код:
#define YELLOW 0xFFFF00AA
#define RED 0xFF0000AA
#define GREY 0xCCCCCCAA
pawn Код:
public OnPlayerConnect(playerid)
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,""YELLO"%s "GREY"has joined the "RED"server.",pName);
SendClientMessageToAll(COLOR_GREEN,string);
return 1;
}
Re: SendClientMessageToAll Multiple Colors -
Extraordinariness - 25.02.2014
It has been answered but... thanks

I still +rep you. :3
Re: SendClientMessageToAll Multiple Colors -
itsCody - 25.02.2014
Quote:
Originally Posted by LocMax
NOTE, it has to be like this:
pawn Код:
public OnPlayerConnect(playerid) { new string[64], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); format(string,sizeof string,""YELLOW"%s "GREY"has joined the "RED"server.",pName); SendClientMessageToAll(COLOR_GREEN,string); return 1; }
|
I find that the ugliest way ever.
Putting it like
pawn Код:
format(string,sizeof string,"{808080} %s {FFFF00} has joined the {FF0000} server.",pName);
SendClientMessageToAll(COLOR_GREEN,string);
Neat and tidy!
Re: SendClientMessageToAll Multiple Colors -
LocMax - 25.02.2014
But then, if you decide to change color of message you'll need to change it everywhere you use that color, with defines you just change it there and then it's changed in whole scripting instead of changing it in every message.