17.02.2013, 11:48
As far as I can see your code repeats calling the random function till it finds a number which hasn't be taken
The problem is if there is only one number left it will probably hang your server for serveral seconds till it randomize the last number
I will use here a static usedNumber variable, so you can remove your usednumbers array
Thats a pretty easy implantation but it should work
The problem is if there is only one number left it will probably hang your server for serveral seconds till it randomize the last number
I will use here a static usedNumber variable, so you can remove your usednumbers array
pawn Код:
//
if(time == 00 || time == 15 || time == 30 || time == 45) {
static
usedNumber
;
if(drugpointcounter == 10) {
drugpointcounter = 0;
usedNumber = 0;
}
new rand = random(10 - drugpointcounter);
while(usedNumber & (1 << rand)) {
rand++;
}
usedNumber |= 1 << rand;
MoveSmugglingPoint(rand);
drugpointcounter++;
}