Quote:
|
Originally Posted by Amit B
Quote:
|
Originally Posted by ♣ ⓐⓢⓢ
Quote:
|
Originally Posted by Amit B
Try this:
pawn Код:
GivePlayerMoney(playerid,random(100000-50000)+50000);
|
if you can sub 50000 from 100000 than you see its 50000 and that would be the same as in my post, I just put +1 because he wanted 100000 included
|
Quote:
|
Originally Posted by ♣ ⓐⓢⓢ
pawn Код:
if(pickupid == your_pickup) { GivePlayerMoney(playerid, ([b]50_000[/b] + random([b]50_001[/b]))); }
|
50 _000? 
|
I just use they to better read the numbers, or do you think 300000000000 is better readable as 300_000_000_000 ?
Quote:
|
Originally Posted by Kinetic
Quote:
|
Originally Posted by Pyrokid
This goes at the top of your script.
pawn Код:
#define MAX_CASH 100000 new randmoney;
Then put this in OnPlayerPickUpPickup.
pawn Код:
if(pickupid == your_pickup) { randmoney = random(MAX_CASH); GivePlayerMoney(playerid,randmoney); }
|
Close, but no cigar. It should be like this.
There is no need for this
#define MAX_CASH 100000
new randmoney;
OnPlayerPickUpPickup.
pawn Код:
if(pickupid == your_pickup) { new str[44]; new randmoney = random(100001) - 50000; format(str, sizeof(str), " >> Player picked up %s and recieved $%d", your_pickup, randmoney); SendClientMessage(playerid, 0xffffffff, str); GivePlayerMoney(playerid, randmoney); }
|
Did you even looked my or Amit B's post ?, because they have the right answer not yours
Reason:
random(100001) will be a number from 0 till 100000 (0 and 100000 included)
and then you do "- 50000" also lets say the random returns 300 => 300 - 50000 = -40700 :S
I hate this kinds of topics, the right solution got posted in one of the first posts (the 4th in this topic) and gets one page big