Optional edits
These edits are not required but will make your live easier as a K9 unit! I highly recommend doing at least the qb-ambulancejob edits.
qb-ambulancejob
Go to
client > dead.lua
Replace the OnDeath function to this
function OnDeath()
if not isDead then
isDead = true
TriggerServerEvent('hospital:server:SetDeathStatus', true)
TriggerServerEvent('InteractSound_SV:PlayOnSource', 'demo', 0.1)
local player = PlayerPedId()
while GetEntitySpeed(player) > 0.5 or IsPedRagdoll(player) do
Wait(10)
end
if isDead then
local pos = GetEntityCoords(player)
local heading = GetEntityHeading(player)
local ped = PlayerPedId()
if IsPedInAnyVehicle(ped) then
local veh = GetVehiclePedIsIn(ped)
local vehseats = GetVehicleModelNumberOfSeats(GetHashKey(GetEntityModel(veh)))
for i = -1, vehseats do
local occupant = GetPedInVehicleSeat(veh, i)
if occupant == ped then
NetworkResurrectLocalPlayer(pos.x, pos.y, pos.z + 0.5, heading, true, false)
SetPedIntoVehicle(ped, veh, i)
end
end
else
NetworkResurrectLocalPlayer(pos.x, pos.y, pos.z + 0.5, heading, true, false)
end
SetEntityInvincible(player, true)
SetEntityHealth(player, GetEntityMaxHealth(player))
if IsPedInAnyVehicle(player, false) then
loadAnimDict('veh@low@front_ps@idle_duck')
TaskPlayAnim(player, 'veh@low@front_ps@idle_duck', 'sit', 1.0, 1.0, -1, 1, 0, 0, 0, 0)
else
if exports['lumio-k9']:HasK9Model(GetEntityModel(ped)) then
loadAnimDict("creatures@dog@move")
TaskPlayAnim(ped, "creatures@dog@move", "dying", 8.0, 8.0, -1, 2, 0, 0, 0, 0)
else
loadAnimDict(deadAnimDict)
TaskPlayAnim(player, deadAnimDict, deadAnim, 1.0, 1.0, -1, 1, 0, 0, 0, 0)
end
end
TriggerServerEvent('hospital:server:ambulanceAlert', Lang:t('info.civ_died'))
end
end
end
Then scroll a bit down to around line 131 and replace it fully with this
CreateThread(function()
local pedRequested = false
while true do
local sleep = 1000
if isDead or InLaststand then
sleep = 5
local ped = PlayerPedId()
if IsPauseMenuActive() then
SetFrontendActive(false)
end
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 pedRequested then
pedRequested = exports['lumio-k9']:HasK9Model(GetEntityModel(ped))
end
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 IsPedInAnyVehicle(ped, false) then
if pedRequested then
loadAnimDict("creatures@dog@move")
if not IsEntityPlayingAnim(ped, "creatures@dog@move", "dying", 3) then
TaskPlayAnim(ped, "creatures@dog@move", "dying", 8.0, 8.0, -1, 2, 0, 0, 0, 0)
end
else
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
end
else
if isInHospitalBed then
if pedRequested then
if not IsEntityPlayingAnim(ped, "creatures@dog@move", "dying", 3) then
loadAnimDict("creatures@dog@move")
TaskPlayAnim(ped, "creatures@dog@move", "dying", 8.0, 8.0, -1, 2, 0, 0, 0, 0)
end
else
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
end
else
if pedRequested then
if not IsEntityPlayingAnim(ped, "creatures@dog@move", "dying", 3) then
loadAnimDict("creatures@dog@move")
TaskPlayAnim(ped, "creatures@dog@move", "dying", 8.0, 8.0, -1, 2, 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
if not pedRequested then
pedRequested = exports['lumio-k9']:HasK9Model(GetEntityModel(ped))
end
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 isEscorted then
if IsPedInAnyVehicle(ped, false) then
if pedRequested then
loadAnimDict("creatures@dog@move")
if not IsEntityPlayingAnim(ped, "creatures@dog@move", "dying", 3) then
TaskPlayAnim(ped, "creatures@dog@move", "dying", 8.0, 8.0, -1, 2, 0, 0, 0, 0)
end
else
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
end
else
if pedRequested then
if not IsEntityPlayingAnim(ped, "creatures@dog@move", "dying", 3) then
loadAnimDict("creatures@dog@move")
TaskPlayAnim(ped, "creatures@dog@move", "dying", 8.0, 8.0, -1, 2, 0, 0, 0, 0)
end
else
if not IsEntityPlayingAnim(ped, lastStandDict, lastStandAnim, 3) then
loadAnimDict(lastStandDict)
TaskPlayAnim(ped, lastStandDict, lastStandAnim, 1.0, 1.0, -1, 1, 0, 0, 0, 0)
end
end
end
else
if IsPedInAnyVehicle(ped, false) then
if pedRequested then
loadAnimDict("creatures@dog@move")
if IsEntityPlayingAnim(ped, "creatures@dog@move", "dying", 3) then
StopAnimTask(ped, "creatures@dog@move", "dying", 3)
end
else
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
end
else
if pedRequested then
if IsEntityPlayingAnim(ped, "creatures@dog@move", "dying", 3) then
loadAnimDict("creatures@dog@move")
StopAnimTask(ped, "creatures@dog@move", "dying", 3)
end
else
if IsEntityPlayingAnim(ped, lastStandDict, lastStandAnim, 3) then
loadAnimDict(lastStandDict)
StopAnimTask(ped, lastStandDict, lastStandAnim, 3)
end
end
end
end
end
end
Wait(sleep)
end
end)
If using qb-target
In data > bones.lua
at the bottom replace this
Bones.Options['seat_dside_f'] = {
["Toggle Front Door"] = {
icon = "fas fa-door-open",
label = "Toggle Front Door",
canInteract = function(entity)
return GetEntityBoneIndexByName(entity, 'door_dside_f') ~= -1
end,
action = function(entity)
ToggleDoor(entity, 0)
end,
distance = 1.2
}
}
Bones.Options['seat_pside_f'] = {
["Toggle Front Door"] = {
icon = "fas fa-door-open",
label = "Toggle Front Door",
canInteract = function(entity)
return GetEntityBoneIndexByName(entity, 'door_pside_f') ~= -1
end,
action = function(entity)
ToggleDoor(entity, 1)
end,
distance = 1.2
}
}
Bones.Options['seat_dside_r'] = {
["Toggle Rear Door"] = {
icon = "fas fa-door-open",
label = "Toggle Rear Door",
canInteract = function(entity)
return GetEntityBoneIndexByName(entity, 'door_dside_r') ~= -1
end,
action = function(entity)
ToggleDoor(entity, 2)
end,
distance = 1.2
}
}
Bones.Options['seat_pside_r'] = {
["Toggle Rear Door"] = {
icon = "fas fa-door-open",
label = "Toggle Rear Door",
canInteract = function(entity)
return GetEntityBoneIndexByName(entity, 'door_pside_r') ~= -1
end,
action = function(entity)
ToggleDoor(entity, 3)
end,
distance = 1.2
}
}
Bones.Options['bonnet'] = {
["Toggle Hood"] = {
icon = "fa-duotone fa-engine",
label = "Toggle Hood",
action = function(entity)
ToggleDoor(entity, BackEngineVehicles[GetEntityModel(entity)] and 5 or 4)
end,
distance = 0.9
}
}
Bones.Options['boot'] = {
["Toggle Trunk"] = {
icon = "fas fa-truck-ramp-box",
label = "Toggle Trunk",
action = function(entity)
ToggleDoor(entity, BackEngineVehicles[GetEntityModel(entity)] and 4 or 5)
end,
distance = 0.9
}
}
With this
Bones.Options['seat_dside_f'] = {
["Toggle Front Door"] = {
icon = "fas fa-door-open",
label = "Toggle Front Door",
canInteract = function(entity)
return GetEntityBoneIndexByName(entity, 'door_dside_f') ~= -1 and exports['lumio-k9']:CheckAccess(QBCore.Functions.GetPlayerData().source)
end,
action = function(entity)
ToggleDoor(entity, 0)
end,
distance = 1.2
}
}
Bones.Options['seat_pside_f'] = {
["Toggle Front Door"] = {
icon = "fas fa-door-open",
label = "Toggle Front Door",
canInteract = function(entity)
return GetEntityBoneIndexByName(entity, 'door_pside_f') ~= -1 and exports['lumio-k9']:CheckAccess(QBCore.Functions.GetPlayerData().source)
end,
action = function(entity)
ToggleDoor(entity, 1)
end,
distance = 1.2
}
}
Bones.Options['seat_dside_r'] = {
["Toggle Rear Door"] = {
icon = "fas fa-door-open",
label = "Toggle Rear Door",
canInteract = function(entity)
return GetEntityBoneIndexByName(entity, 'door_dside_r') ~= -1 and exports['lumio-k9']:CheckAccess(QBCore.Functions.GetPlayerData().source)
end,
action = function(entity)
ToggleDoor(entity, 2)
end,
distance = 1.2
}
}
Bones.Options['seat_pside_r'] = {
["Toggle Rear Door"] = {
icon = "fas fa-door-open",
label = "Toggle Rear Door",
canInteract = function(entity)
return GetEntityBoneIndexByName(entity, 'door_pside_r') ~= -1 and exports['lumio-k9']:CheckAccess(QBCore.Functions.GetPlayerData().source)
end,
action = function(entity)
ToggleDoor(entity, 3)
end,
distance = 1.2
}
}
Bones.Options['bonnet'] = {
["Toggle Hood"] = {
icon = "fa-duotone fa-engine",
label = "Toggle Hood",
action = function(entity)
ToggleDoor(entity, BackEngineVehicles[GetEntityModel(entity)] and 5 or 4)
end,
canInteract = function()
return exports['lumio-k9']:CheckAccess(QBCore.Functions.GetPlayerData().source)
end,
distance = 0.9
}
}
Bones.Options['boot'] = {
["Toggle Trunk"] = {
icon = "fas fa-truck-ramp-box",
label = "Toggle Trunk",
action = function(entity)
ToggleDoor(entity, BackEngineVehicles[GetEntityModel(entity)] and 4 or 5)
end,
canInteract = function()
return exports['lumio-k9']:CheckAccess(QBCore.Functions.GetPlayerData().source)
end,
distance = 0.9
}
}
Last updated