onPickupSpawn | Multi Theft Auto: Wiki Skip to content

onPickupSpawn

Client-side
Server-side
Shared

This event is triggered when a pickup is spawned or respawned.

Parameters

This event does not pass any parameters to the handler function.

Source

element: The source of this event is the pickup that just spawned or respawned.

Code Examples

server

This example gets the area and city name when a pickup spawns and outputs it to all the players.

function outputSpawn( )
local area = getElementZoneName( source ) -- Get the area name where the pickup spawned
local city = getElementZoneName( source, true ) -- Get the city name where the pickup spawned
outputChatBox( "A pickup has spawned in " .. area .. " ( " .. city .. " )", root, 255, 0, 0 ) -- Output a message to the chatbox
end
addEventHandler( "onPickupSpawn", root, outputSpawn ) -- Trigger the function when a pickup spawns