Skip to main content

Wasabi installation

wasabi_ambulance and wasabi_police has to be edited before using sf-trunks. Without it animations will be bugged.

danger

Remember! Create a backup before editing files of your existing resources!

wasabi_ambulance

You have to add this code at the end of client/cl_customize.lua file.

client/cl_customize.lua
local isInTrunk = false
local oldTaskAnim = TaskPlayAnim

TaskPlayAnim = function(ped, animDictionary, animationName, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ)
if not isInTrunk then
oldTaskAnim(ped, animDictionary, animationName, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ)
end
end

local oldTaskAnimAdv = TaskPlayAnimAdvanced
TaskPlayAnimAdvanced = function(ped, animDict, animName, posX, posY, posZ, rotX, rotY, rotZ, animEnterSpeed, animExitSpeed, duration, flag, animTime, p14, p15)
if not isInTrunk then
oldTaskAnimAdv(ped, animDict, animName, posX, posY, posZ, rotX, rotY, rotZ, animEnterSpeed, animExitSpeed, duration, flag, animTime, p14, p15)
end
end

local oldIsEntityPlayingAnim = IsEntityPlayingAnim

IsEntityPlayingAnim = function(entity, animDict, animName, taskFlag)
if isInTrunk then
return 1
end
return oldIsEntityPlayingAnim(entity, animDict, animName, taskFlag)
end

AddEventHandler("sf-trunks:isUsingCamera", function(state)
isInTrunk = state
end)

AddStateBagChangeHandler("dead", ("player:%s"):format(GetPlayerServerId(PlayerId())), function(bagName, key, value, reserved, replicated)
LocalPlayer.state:set("SFTRUNKS_DEAD", type(value) == "string", true)
end)

Remember to restart wasabi_ambulance after that.

wasabi_police

You have to add this code at the end of client/cl_customize.lua file.

client/cl_customize.lua
local isInTrunk = false
local oldTaskAnim = TaskPlayAnim

TaskPlayAnim = function(ped, animDictionary, animationName, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ)
if not isInTrunk then
oldTaskAnim(ped, animDictionary, animationName, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ)
end
end

local oldTaskAnimAdv = TaskPlayAnimAdvanced
TaskPlayAnimAdvanced = function(ped, animDict, animName, posX, posY, posZ, rotX, rotY, rotZ, animEnterSpeed, animExitSpeed, duration, flag, animTime, p14, p15)
if not isInTrunk then
oldTaskAnimAdv(ped, animDict, animName, posX, posY, posZ, rotX, rotY, rotZ, animEnterSpeed, animExitSpeed, duration, flag, animTime, p14, p15)
end
end

AddEventHandler("sf-trunks:isUsingCamera", function(state)
isInTrunk = state
end)

RegisterNetEvent("wasabi_police:arrested", function()
LocalPlayer.state:set("SFTRUNKS_HANDCUFFED", true, true)
end)

RegisterNetEvent("wasabi_police:uncuff", function()
LocalPlayer.state:set("SFTRUNKS_HANDCUFFED", false, true)
end)

Remember to restart wasabi_police after that.