11.07.2011, 21:46
How can I get the length of an integer? I am trying to make a system to generate a random 7 digit phone number, and I am planning to use something like this:
But I can't find a function to calculate the length of the value though.
(My while loop could be wrong, too, it is meant to keep generating random numbers until it hits a 9 digit one, and then set the player's phone number to that - am I doing it right?)
pawn Код:
new randnum;
while (intlen(randnum) != 7) {
randnum = random(9999999);
}
PlayerData[playerid][PhoneNumber] = randnum;
(My while loop could be wrong, too, it is meant to keep generating random numbers until it hits a 9 digit one, and then set the player's phone number to that - am I doing it right?)