SA-MP Forums Archive
[help] random colors - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [help] random colors (/showthread.php?tid=80429)



[help] random colors - borisblat - 04.06.2009

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?


Re: [help] random colors - Jefff - 04.06.2009

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;
}



Re: [help] random colors - Weirdosport - 04.06.2009

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