Skip to content

Forcing trunks

  1. A locked trunk shows Force trunk on the lid. The player needs one of Config.Force.tools.
  2. The server checks distance, lock, cooldown and who may force, and sends the challenge.
  3. The minigame runs. The server refuses a success faster than the minigame allows.
  4. Success: the trunk opens (the car stays locked) and its props are there. Chance of alarm and police alert from success.
  5. Failure: chance the tool breaks (breakTool) and of alarm and alert from fail. It can be tried again after cooldown.

npc and player have their own settings: NPC cars are the world’s; player cars are any car spawned by a script (garages, dealers).

Checked in this order: blockedJobs (on duty), allowedJobs, minPolice of the vehicle type (players on duty in Config.Dispatch.jobs), then your own check:

config.lua
Config.Force.canForce = function(src, kind, vehicle)
if kind == 'player' and not IsPlayerAceAllowed(src, 'gang.member') then
return false, 'Only gangs force player cars'
end
return true
end

It runs on the server; kind is 'npc' or 'player'. Return false, 'message' to tell the player why.

  • 'sl_trunk': a ring anchored on the trunk. Each entry of phases is one lap: duration (ms) and arc (the band, in degrees). A slower lap or a wider band is easier. Each phase asks for a different key.
  • 'ox_lib': lib.skillCheck with oxLib.npc / oxLib.player as difficulty and oxLib.inputs as keys. ox_lib has to be started.
  • 'custom': your function, on the client. It can wait until your minigame ends:
config.lua
Config.SkillCheck.custom = function(vehicle, kind)
return exports['my-minigame']:Start(kind == 'player' and 5 or 3) -- true = forced
end

If the chosen one is not available, the ring is used and the console says so.

  • ps-dispatch and cd_dispatch are used if they are running (Config.Dispatch.system = 'auto').
  • Any other dispatch: listen to the server event sl_trunk:alert, see Developers.
  • At most one alert per vehicle every Config.Force.dispatchEvery ms, so retries do not flood the police.