Forcing trunks
How it goes
Section titled “How it goes”- A locked trunk shows Force trunk on the lid. The player needs one of
Config.Force.tools. - The server checks distance, lock, cooldown and who may force, and sends the challenge.
- The minigame runs. The server refuses a success faster than the minigame allows.
- Success: the trunk opens (the car stays locked) and its props are there. Chance of alarm and police alert from
success. - Failure: chance the tool breaks (
breakTool) and of alarm and alert fromfail. It can be tried again aftercooldown.
npc and player have their own settings: NPC cars are the world’s; player cars are any car spawned by a script (garages, dealers).
Who may force
Section titled “Who may force”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.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 trueendIt runs on the server; kind is 'npc' or 'player'. Return false, 'message' to tell the player why.
Minigame
Section titled “Minigame”'sl_trunk': a ring anchored on the trunk. Each entry ofphasesis one lap:duration(ms) andarc(the band, in degrees). A slower lap or a wider band is easier. Each phase asks for a different key.'ox_lib':lib.skillCheckwithoxLib.npc/oxLib.playeras difficulty andoxLib.inputsas keys. ox_lib has to be started.'custom': your function, on the client. It can wait until your minigame ends:
Config.SkillCheck.custom = function(vehicle, kind) return exports['my-minigame']:Start(kind == 'player' and 5 or 3) -- true = forcedendIf the chosen one is not available, the ring is used and the console says so.
Police alerts
Section titled “Police alerts”- 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.dispatchEveryms, so retries do not flood the police.