SA-MP Forums Archive
Uhh I need help (Random phone number).. - 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)
+--- Thread: Uhh I need help (Random phone number).. (/showthread.php?tid=464232)



Uhh I need help (Random phone number).. - Scrillex - 15.09.2013

Hello dear samp forum members.. I'm lost in generating random phone number...

Basically I have problems with generating one and checking if the phone number is free to use.

Umm for generating it I would love to know the best way..

I'm using this

pawn Код:
new randphone = 1000 + random(9999);
and one more question how big string I would need to save it?


Re: Uhh I need help (Random phone number).. - Eyce - 15.09.2013

How do you save the player's phone number? That's how you can check if it's existing or not.


Re: Uhh I need help (Random phone number).. - Scrillex - 15.09.2013

Not like that.. If itš used or not for another play so basically I need to check trough all player data.. If the number is used by another player...


Re: Uhh I need help (Random phone number).. - Eyce - 15.09.2013

Right, so what saving system are you using? Like MySQL or .INI files?


Re: Uhh I need help (Random phone number).. - Scrillex - 15.09.2013

Y_ini system so yeah.. Just that's what needed atm the most.. I just don't understand it how it's possible..


Re: Uhh I need help (Random phone number).. - Scrillex - 16.09.2013

*BUMP*


Re: Uhh I need help (Random phone number).. - Dragonsaurus - 16.09.2013

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
new
    phone[ 11 ]
;
format( phone, sizeof( phone ), "072%d%d%d%d%d%d%d", random( 10 ), random( 10 ), random( 10 ), random( 10 ), random( 10 ), random( 10 ), random( 10 ) );
// Replace the 072 with any prefix you want.
About checking for number, use strcmp.
About saving, you just need a string of size 11.


Re: Uhh I need help (Random phone number).. - Scrillex - 16.09.2013

Oh big thanks mate + rep