[HELP]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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]Phone Number (
/showthread.php?tid=184532)
[HELP]Phone Number -
SkizzoTrick - 20.10.2010
hello everyone i have something like this:
Quote:
new randphone = 55 + random(89999);
|
and i want something like everyone gets the number :07********
Can someone help PLS?
Re: [HELP]Phone Number -
kiss - 20.10.2010
i don't understand you...
Plz explain?
Re: [HELP]Phone Number -
SkizzoTrick - 20.10.2010
My system gives a phone number to everyone in login,when they buy a phone,etc
But the systems give them a type of phone number
Quote:
new randphone = 55 + random(89999);
|
i want something like
Quote:
new randphone = 07 + random(45677823);
|
Re: [HELP]Phone Number -
Cameltoe - 20.10.2010
https://sampwiki.blast.hk/wiki/Strins && Read about the related functions.
Re: [HELP]Phone Number -
Steven82 - 20.10.2010
Quote:
Originally Posted by kiss
i don't understand you...
Plz explain?
|
How did you not understand that?
Re: [HELP]Phone Number -
Sergei - 20.10.2010
You can't really have 0 on the first place because 00000000001 would be automatically changed to 1.
pawn Код:
new randphone = 700000000 + random(45677823);
This way, 7 would be at the first place and number would be always 9 digits long.
Re: [HELP]Phone Number -
DeathOnaStick - 20.10.2010
Quote:
Originally Posted by Sergei
You can't really have 0 on the first place because 00000000001 would be automatically changed to 1.
pawn Код:
new randphone = 700000000 + random(45677823);
This way, 7 would be at the first place and number would be always 9 digits long.
|
Anyway, it would be possible to not save it as an Integer, but as a String. If you would save it as a string, and work with it like one, it would be possible. For that you'd need to make it like this:
pawn Код:
new bleh[128];
format(bleh, sizeof(bleh), "07%i", random(45677823));
strval(bleh) would equal the string as an Integer, which isn't needed at all i guess.
Just use strcmp to check if the string and the phone-number are the same.
Re: [HELP]Phone Number -
SkizzoTrick - 20.10.2010
Its working,thank you everyone!!!