27.04.2009, 10:30
Hi, i want my own PlayerColors if someone spawn, but it must be random. I've got now this script, but i think it's not working very well. Zometimes i get the color purple, mostly if a am ID 1, instead of 0. And purple isn't included by this random.
So how can i make an better script?
My script:
So how can i make an better script?
My script:
pawn Код:
enum playercolor
{
color_id,
};
new PlayerColor[][playercolor] =
{
{0xE60000FF}, //Red
{0x1229FAFF}, //Blue
{0x21DD00FF}, //Green
{0xFFFF00FF}, //Yellow
{0xF97804FF}, //Orange
{0x00C2ECFF}, //Light Blue
{0x38FF06FF}, //Light Green
{0x008040FF}, //Dark Green
{0xFF8080FF} //Light Red
};
public OnPlayerConnect(playerid)
{
new randomcolor = random(sizeof(PlayerColor));
SetPlayerColor(playerid, PlayerColor[randomcolor][color_id]);
return 1;
}