About pickups.
#1

Hi peoples. I want to ask how to make 5 money pickups,and they all give me money?
Reply
#2

To create the actual pickups, you would use the CreatePickup function. You would then use the OnPlayerPickUpPickup callback to handle when the player enters the pickup, at which time you would use GivePlayerMoney to give them the desired amount.
Reply
#3

I know that...But i want ask,do i need create 5 variables to do that?

Код:
new Money1
new Money2
new Money3
new Money4
new Money5

Money1 = CreatePickup( ... )
...
Reply
#4

Try making something like:
pawn Код:
new MoneyPickup[5];

public OnFilterScriptInit()
{
    MoneyPickup[0] = CreatePickup//blah blah
    MoneyPickup[1] = CreatePickup//blah blah
    MoneyPickup[2] = CreatePickup//blah blah
    MoneyPickup[3] = CreatePickup//blah blah
    MoneyPickup[4] = CreatePickup//blah blah
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    for(new i = 0; i < sizeof(MoneyPickup); i++)
    {
        if(pickupid == MoneyPickup[i])
        {
            new cash = random(2000);
            GivePlayerMoney(playerid, cash);
            return 1;
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)