13.10.2011, 22:04
If you want to get numbers between a certain x digit and a certain y digit, you can add this to the bottom of your script:
Then use it to get random lotto numbers for example:
Or for a simple cash payout, between 10,000 and 20,000:
pawn Код:
// credit to KyleSmith
stock randomEx(minnum = cellmin, maxnum = cellmax)
{
return random(maxnum - minnum + 1) + minnum;
}
pawn Код:
new lotto = randomEx(1,100); // will pick a random number between 1 and 100
pawn Код:
new payout = randomEx(10000,20000); // will choose a random amount between 10k to 20k
GivePlayerMoney(playerid,payout); // give the player the random cash payout
print(payout); // print the random cash payout