21.03.2009, 20:11
I would like to give the player who picks up a certain pickup to get an amount of cash between $50000 and $100000. I think you have to use random but I have only used that when its a number from 0 to whatever.
#define MAX_CASH 100000
new randmoney;
if(pickupid == your_pickup)
{
randmoney = random(MAX_CASH);
GivePlayerMoney(playerid,randmoney);
}
if(pickupid == your_pickup)
{
GivePlayerMoney(playerid, (50_000 + random(50_001)));
}
GivePlayerMoney(playerid,random(100000-50000)+50000);
Originally Posted by Amit B
Try this:
pawn Код:
|
Originally Posted by ♣ ⓐⓢⓢ
Quote:
|
Originally Posted by ♣ ⓐⓢⓢ
pawn Код:
|
Originally Posted by Pyrokid
This goes at the top of your script.
pawn Код:
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);
}
Originally Posted by Amit B
Quote:
Quote:
|
Originally Posted by Kinetic
Quote:
There is no need for this #define MAX_CASH 100000 new randmoney; OnPlayerPickUpPickup. pawn Код:
|