Vehicle MinigamesEvents and exports

Events and exports

Hook Vehicle Minigames into police alerts, logs, XP or stress.

On this page

Server events

Police alert

Fires with each police alert tr_minigames sends (see Police alerts). Use it for logs or your own police scripts.

server.lua
AddEventHandler('tr_minigames:alert', function(src, kind, netId, plate)
    -- kind: 'lockpickAlarm', 'hotwireAlarm', 'hotwired' or 'siphoned'
end)

Alarm

Fires when a pick snaps (reason = 'failed') or an alarmed car is opened after being picked (reason = 'opened'). tr_minigames sends its own police alert for it; use this for anything else.

server.lua
AddEventHandler('tr_minigames:lockpick:alarm', function(src, netId, coords, reason)
    -- src: the player, netId: the car, coords: where it is
end)

Lock picked

Fires when a player picks a lock and the door unlocks. Use it for logs, XP or stress.

server.lua
AddEventHandler('tr_minigames:lockpick:picked', function(src, netId, plate)
end)

Car siphoned

Fires when a player finishes siphoning a car. Use it for logs, XP or police alerts.

server.lua
AddEventHandler('tr_minigames:siphon:siphoned', function(src, netId, plate, litres, spilled)
    -- litres: what went into the can, spilled: what ended up on the ground
end)

Exports

Start lockpicking

Starts lockpicking for the player, at the nearest locked door in reach. This is what the lishi_pick item calls when it's used from ox_inventory.

client.lua
exports.tr_minigames:lockpick()

Start siphoning

Starts siphoning at the car the player stands at. This is what the siphon_hose item calls when it's used from ox_inventory.

client.lua
exports.tr_minigames:siphon()

State bags

StateSet onMeaning
tr_hotwiredThe cartrue once it's been hotwired
tr_hotwire_coverThe cartrue while its column cover is off
tr_lock_jamThe carThe time (os.time) a snapped pick tip stops jamming its lock
tr_siphonedThe carThe time (os.time) it can be siphoned again
client.lua
if Entity(vehicle).state.tr_hotwired then
    -- this car was hotwired
end
Was this page helpful?

Still stuck? Open a ticket on Discord.Privacy