28.07.2014, 22:25
Theres the random(max+1) function pawn. https://sampwiki.blast.hk/wiki/Random
To ensure it has 4 digits you could just do this:
Or if you want to store it as string (that would be better anyways considering that you probably want to check the pin in a cmd or something) you can also make it start with a 0:
The %04d in the format means "print 4 digits of the integer and fill empty spaces with 0"
To ensure it has 4 digits you could just do this:
pawn Код:
new pin = 1000 + random(9000);
pawn Код:
new pin[4];
format(pin, 4, "%04d", random(10000));

