- Documentation
- Server events
- onPickupHit
Event
onPickupHit
A player walked into a pickup. You can block the pickup.
Handler
addEventHandler("onPickupHit", root, function(thePlayer, matchingDimension) ... end)Parameters
thePlayerplayer- The player.
matchingDimensionbool- Whether in the same dimension.Not in MTA:SA
Differences from MTA:SA
- Parameters in a different colour differ from MTA:SA.
In MTA:SA
function(player thePlayer)Source
source is the pickup.
cancelEvent() blocks the pickup.
Example
addEventHandler("onPickupHit", root, function(player)
if getPedOccupiedVehicle(player) then cancelEvent() end
end)
See also
onPickupUseA player picked up a pickup (got health, armour or a weapon).createPickupCreates a pickup: a spinning item to collect - a health pack, body armour, a weapon or any model (e.g. a building entrance icon). A player collects it by walking into it; the server then firesonPickupHit(cancelEvent()there stops the collection), and the pickup hides forrespawnIntervaland comes back. The meaning ofamountdepends on the type: health or armour to add, a weapon ID, or a model ID.