Best way to make sure this number isn't the same as any others?
#7

A lot easier and faster way than creating another array:

pawn Код:
randomin(min, max) return random(max - min) + min;

bool:NumberInUse(number)
{
        for (new i; i < MAX_FURNI; i++) if (FurniCode[i] == number) return false;
        return true;
}

FreeNumber()
{
    new number = randomin(100000, 1000000);
    while (NumberInUse(number)) number = randomin(100000, 1000000);
    return number;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)