SA-MP Forums Archive
Using random - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Using random (/showthread.php?tid=94561)



Using random - Mattjones17 - 30.08.2009

Hi
I've currently got this code for phone numbers

{
//generate number
new number;
while(number == 0)
{
number = random(8999)+1000;
if(GetPlayerIDFromPhoneNumber(number) != INVALID_PLAYER_ID) number = 0;
}

is there any way I could change it so that all the numbers will have 444 in front of the random number? So they are like 4445562, 4442262 etc

Thanks
Matt


Re: Using random - Zeex - 30.08.2009

pawn Код:
number = 4440000 + random(10000);



Re: Using random - Mattjones17 - 30.08.2009

ahh that makes sens

how come you've used random(1000) and not (8999)+1000?