From GT-MP
Jump to: navigation, search
Shared Function
Utilities-terminal.png Server-Side System-users.png Client-Side
Csharp.png C# Javascript.png JavaScript

This type of event is used for handling code when the character picks up a pickup entity (pika-pika! i hear you pokemon go fans!)

Dialog-warning.pngRework required!

The contents of this page are possibly invalid or incomplete. Please treat the contents of this page with caution!

If you are able to, please modify the page so that it's factually correct.


First of all, it should be defined in your Main constructor for it to be called, otherwise it wouldn't be initiated at all!

   public Main()
      API.onPlayerPickup += OnPlayerPickupHandler;

Usage example(s)

Before we start, myAwesomePickup variable is of NetHandle type defined somewhere in the script, if missing, it will output an error

   private void OnPlayerPickupHandler(Client player, NetHandle pickup)
      if(pickup == myAwesomePickup)
         API.sendChatMessageToPlayer(player, "Wooooo! Free HEALTH!!");
         API.setPlayerHealth(player, 100);