How to make random spawn colors?
#1

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


Messages In This Thread
How to make random spawn colors? - by Remi-X - 27.04.2009, 10:30
Re: How to make random spawn colors? - by Andom - 27.04.2009, 10:56
Re: How to make random spawn colors? - by Remi-X - 27.04.2009, 17:51
Re: How to make random spawn colors? - by Remi-X - 28.04.2009, 09:31
Re: How to make random spawn colors? - by Remi-X - 30.04.2009, 11:34
Re: How to make random spawn colors? - by yom - 30.04.2009, 12:38
Re: How to make random spawn colors? - by Remi-X - 30.04.2009, 13:04
Re: How to make random spawn colors? - by aspire5630 - 30.04.2009, 15:06
Re: How to make random spawn colors? - by Remi-X - 30.04.2009, 15:17
Re: How to make random spawn colors? - by aspire5630 - 30.04.2009, 16:21

Forum Jump:


Users browsing this thread: 1 Guest(s)