Skip to main content

Qb-core installation

qb-ambulancejob and qb-policejob 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!

qb-ambulancejob

You have to remove everything under line 123 in client/dead.lua and replace it with that:

client/dead.lua:123
emsNotified = false

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

CreateThread(function()
while true do
local sleep = 1000
if isDead or InLaststand then
sleep = 5
local ped = PlayerPedId()
DisableAllControlActions(0)
EnableControlAction(0, 1, true)
EnableControlAction(0, 2, true)
EnableControlAction(0, 245, true)
EnableControlAction(0, 38, true)
EnableControlAction(0, 0, true)
EnableControlAction(0, 322, true)
EnableControlAction(0, 288, true)
EnableControlAction(0, 213, true)
EnableControlAction(0, 249, true)
EnableControlAction(0, 46, true)
EnableControlAction(0, 47, true)

if isDead then
if not isInHospitalBed then
if deathTime > 0 then
DrawTxt(0.93, 1.44, 1.0,1.0,0.6, Lang:t('info.respawn_txt', {deathtime = math.ceil(deathTime)}), 255, 255, 255, 255)
else
DrawTxt(0.865, 1.44, 1.0, 1.0, 0.6, Lang:t('info.respawn_revive', {holdtime = hold, cost = Config.BillCost}), 255, 255, 255, 255)
end
end

if not isInTrunk then
if IsPedInAnyVehicle(ped, false) then
loadAnimDict("veh@low@front_ps@idle_duck")
if not IsEntityPlayingAnim(ped, "veh@low@front_ps@idle_duck", "sit", 3) then
TaskPlayAnim(ped, "veh@low@front_ps@idle_duck", "sit", 1.0, 1.0, -1, 1, 0, 0, 0, 0)
end
else
if isInHospitalBed then
if not IsEntityPlayingAnim(ped, inBedDict, inBedAnim, 3) then
loadAnimDict(inBedDict)
TaskPlayAnim(ped, inBedDict, inBedAnim, 1.0, 1.0, -1, 1, 0, 0, 0, 0)
end
else
if not IsEntityPlayingAnim(ped, deadAnimDict, deadAnim, 3) then
loadAnimDict(deadAnimDict)
TaskPlayAnim(ped, deadAnimDict, deadAnim, 1.0, 1.0, -1, 1, 0, 0, 0, 0)
end
end
end
end

SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true)
elseif InLaststand then
sleep = 5

if LaststandTime > Config.MinimumRevive then
DrawTxt(0.94, 1.44, 1.0, 1.0, 0.6, Lang:t('info.bleed_out', {time = math.ceil(LaststandTime)}), 255, 255, 255, 255)
else
DrawTxt(0.845, 1.44, 1.0, 1.0, 0.6, Lang:t('info.bleed_out_help', {time = math.ceil(LaststandTime)}), 255, 255, 255, 255)
if not emsNotified then
DrawTxt(0.91, 1.40, 1.0, 1.0, 0.6, Lang:t('info.request_help'), 255, 255, 255, 255)
else
DrawTxt(0.90, 1.40, 1.0, 1.0, 0.6, Lang:t('info.help_requested'), 255, 255, 255, 255)
end

if IsControlJustPressed(0, 47) and not emsNotified then
TriggerServerEvent('hospital:server:ambulanceAlert', Lang:t('info.civ_down'))
emsNotified = true
end
end

if not isInTrunk then
if not isEscorted then
if IsPedInAnyVehicle(ped, false) then
loadAnimDict("veh@low@front_ps@idle_duck")
if not IsEntityPlayingAnim(ped, "veh@low@front_ps@idle_duck", "sit", 3) then
TaskPlayAnim(ped, "veh@low@front_ps@idle_duck", "sit", 1.0, 1.0, -1, 1, 0, 0, 0, 0)
end
else
loadAnimDict(lastStandDict)
if not IsEntityPlayingAnim(ped, lastStandDict, lastStandAnim, 3) then
TaskPlayAnim(ped, lastStandDict, lastStandAnim, 1.0, 1.0, -1, 1, 0, 0, 0, 0)
end
end
else
if IsPedInAnyVehicle(ped, false) then
loadAnimDict("veh@low@front_ps@idle_duck")
if IsEntityPlayingAnim(ped, "veh@low@front_ps@idle_duck", "sit", 3) then
StopAnimTask(ped, "veh@low@front_ps@idle_duck", "sit", 3)
end
else
loadAnimDict(lastStandDict)
if IsEntityPlayingAnim(ped, lastStandDict, lastStandAnim, 3) then
StopAnimTask(ped, lastStandDict, lastStandAnim, 3)
end
end
end
end
end
end
Wait(sleep)
end
end)

qb-policejob

You have to remove everything under line 401 in client/interactions.lua and replace it with that:

client/interactions.lua:401
local isInTrunk = false
AddEventHandler("sf-trunks:isUsingCamera", function(state)
isInTrunk = state
end)

-- Threads
CreateThread(function()
while true do
Wait(1)
if isEscorted then
DisableAllControlActions(0)
EnableControlAction(0, 1, true)
EnableControlAction(0, 2, true)
EnableControlAction(0, 245, true)
EnableControlAction(0, 38, true)
EnableControlAction(0, 322, true)
EnableControlAction(0, 249, true)
EnableControlAction(0, 46, true)
end

if isHandcuffed then
DisableControlAction(0, 24, true) -- Attack
DisableControlAction(0, 257, true) -- Attack 2
DisableControlAction(0, 25, true) -- Aim
DisableControlAction(0, 263, true) -- Melee Attack 1

DisableControlAction(0, 45, true) -- Reload
DisableControlAction(0, 22, true) -- Jump
DisableControlAction(0, 44, true) -- Cover
DisableControlAction(0, 37, true) -- Select Weapon
DisableControlAction(0, 23, true) -- Also 'enter'?

DisableControlAction(0, 288, true) -- Disable phone
DisableControlAction(0, 289, true) -- Inventory
DisableControlAction(0, 170, true) -- Animations
DisableControlAction(0, 167, true) -- Job

DisableControlAction(0, 26, true) -- Disable looking behind
DisableControlAction(0, 73, true) -- Disable clearing animation
DisableControlAction(2, 199, true) -- Disable pause screen

DisableControlAction(0, 59, true) -- Disable steering in vehicle
DisableControlAction(0, 71, true) -- Disable driving forward in vehicle
DisableControlAction(0, 72, true) -- Disable reversing in vehicle

DisableControlAction(2, 36, true) -- Disable going stealth

DisableControlAction(0, 264, true) -- Disable melee
DisableControlAction(0, 257, true) -- Disable melee
DisableControlAction(0, 140, true) -- Disable melee
DisableControlAction(0, 141, true) -- Disable melee
DisableControlAction(0, 142, true) -- Disable melee
DisableControlAction(0, 143, true) -- Disable melee
DisableControlAction(0, 75, true) -- Disable exit vehicle
DisableControlAction(27, 75, true) -- Disable exit vehicle
EnableControlAction(0, 249, true) -- Added for talking while cuffed
EnableControlAction(0, 46, true) -- Added for talking while cuffed

if not isInTrunk and (not IsEntityPlayingAnim(PlayerPedId(), "mp_arresting", "idle", 3) and not IsEntityPlayingAnim(PlayerPedId(), "mp_arrest_paired", "crook_p2_back_right", 3)) and not QBCore.Functions.GetPlayerData().metadata["isdead"] then
loadAnimDict("mp_arresting")
TaskPlayAnim(PlayerPedId(), "mp_arresting", "idle", 8.0, -8, -1, cuffType, 0, 0, 0, 0)
end
end
if not isHandcuffed and not isEscorted then
Wait(2000)
end
end
end)