[HELP]Phone Number
#1

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?
Reply
#2

i don't understand you...
Plz explain?
Reply
#3

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);

Reply
#4

https://sampwiki.blast.hk/wiki/Strins && Read about the related functions.
Reply
#5

Quote:
Originally Posted by kiss
Посмотреть сообщение
i don't understand you...
Plz explain?
How did you not understand that?
Reply
#6

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.
Reply
#7

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.
Reply
#8

Its working,thank you everyone!!!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)