[help] random colors
#1

new ServerColors[10] = {
0x6495EDAA, 0x4EEE94AA, 0xC0FF3EAA, 0xFFFF00AA, 0xFFB90FAA,
0x7171C6AA, 0x9B30FFAA, 0xA2B5CDAA, 0xC0FF3EAA, 0xFFD700AA
};


public OnPlayerConnect(playerid)
{
new string[256], name[MAX_PLAYER_NAME];
new randcolor = random(sizeof(ServerColors));
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string, 256, ".התחבר/ה לשרת %s", name);
SendClientMessageToAll(randcolor, string);


return 1;
}

why it's giving me black all the time?
Reply
#2

Because is WRONG :P

Код:
public OnPlayerConnect(playerid)
{
	new string[64], name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, MAX_PLAYER_NAME);
	format(string, 64, ".התחבר/ה לשרת %s", name);
	SendClientMessageToAll(ServerColors[random(sizeof(ServerColors))], string);
	return 1;
}
Reply
#3

random returns the random number, not the value of the cell you're after.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)