Have Some question - 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)
+--- Thread: Have Some question (
/showthread.php?tid=619564)
Have Some question -
TYDS - 19.10.2016
How can i make a random money when player enter checkpoint . i want it random from 5000$ - 7500$
Re: Have Some question -
ThatFag - 19.10.2016
Код:
new themoney = random(5000 - 7500) + 1000;
GivePlayerMoney(playerid, themoney);
Put this under OnPlayerEnterCheckpoint or OnPlayerEnterRaceCheckpoint
Re: Have Some question -
Threshold - 19.10.2016
Quote:
Originally Posted by ThatFag
Код:
new themoney = random(5000 - 7500) + 1000;
GivePlayerMoney(playerid, themoney);
Put this under OnPlayerEnterCheckpoint or OnPlayerEnterRaceCheckpoint
|
That would give the player an amount between 1000 and 3499..
money = random(2501) + 5000;
EDIT: If I noticed that '5000' and '7500' were around the wrong way, that is...
Re: Have Some question -
TYDS - 19.10.2016
what means + 1000
Re: Have Some question -
Konstantinos - 19.10.2016
Quote:
Originally Posted by ThatFag
Код:
new themoney = random(5000 - 7500) + 1000;
GivePlayerMoney(playerid, themoney);
Put this under OnPlayerEnterCheckpoint or OnPlayerEnterRaceCheckpoint
|
This will give extremely high number actually as the value in
random function will be negative.
pawn Код:
RandomEx(min, max) return random(max - min) + min;
Since the value will be 0 to max-1, you need to add 1 to for the max parameter:
pawn Код:
GivePlayerMoney(playerid, RandomEx(5000, 7500 + 1));
Re: Have Some question -
TYDS - 19.10.2016
oh i will try all