The open.mp logo
Home
FAQ
Forums
Servers
Partners
Docs
Blog

note Help Needed

This wiki is the result of an ongoing community effort — thank you all for helping!

If you want to provide changes to this page then please click here.

OnPlayerPickUpPickup

Description

This callback is called when a player picks up a pickup created with CreatePickup.

NameDescription
playeridThe ID of the player that picked up the pickup.
pickupidThe ID of the pickup, returned by CreatePickup

Returns

It is always called first in gamemode.

Examples

new pickup_Cash;
new pickup_Health;

public OnGameModeInit()
{
    pickup_Cash = CreatePickup(1274, 2, 0.0, 0.0, 9.0);
    pickup_Health = CreatePickup(1240, 2, 0.0, 0.0, 9.0);
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if (pickupid == pickup_Cash)
    {
        GivePlayerMoney(playerid, 1000);
    }
    else if (pickupid == pickup_Health)
    {
        SetPlayerHealth(playerid, 100.0);
    }
    return 1;
}

Related Functions

The following functions might be useful, as they're related to this callback in one way or another.

  • CreatePickup: Create a pickup.
  • DestroyPickup: Destroy a pickup.

Community

  • Discord
  • Instagram
  • Twitter
  • Twitch
  • YouTube
  • Facebook
  • VK

More

  • SA-MP
  • Blog
  • GitHub