The custom random
#9

You can just use a player variable.
pawn Код:
new oldInt[MAX_PLAYERS] = {-1, ...};

stock randomEx(playerid, min, max)
{
    new ints;
    do {
            ints = Randomize(min, max+1);
    }
    while(ints == oldInt[playerid]);
    oldInt[playerid] = ints;
    printf("%d", ints);
    return oldInt[playerid];
}

CMD:ur(playerid, params[])
{
    SendClientMessageEx(playerid, 0xFF0000AA, "Random Number: %d", randomEx(playerid, 0, 100));
    return 1;
}
Reply


Messages In This Thread
The custom random - by ProjectMan - 14.08.2013, 10:22
Re: The custom random - by ProjectMan - 14.08.2013, 10:35
Re: The custom random - by Dragonsaurus - 14.08.2013, 10:37
Re: The custom random - by ProjectMan - 14.08.2013, 10:47
Re: The custom random - by Dragonsaurus - 14.08.2013, 10:54
Re: The custom random - by [XST]O_x - 14.08.2013, 10:57
Re: The custom random - by ProjectMan - 14.08.2013, 11:17
Re: The custom random - by ProjectMan - 14.08.2013, 11:45
Re: The custom random - by [XST]O_x - 14.08.2013, 11:57
Re: The custom random - by [XST]O_x - 14.08.2013, 12:15

Forum Jump:


Users browsing this thread: 1 Guest(s)