Skip to content

Commit

Permalink
added death check when using target
Browse files Browse the repository at this point in the history
  • Loading branch information
Arius-Scripts committed Jul 11, 2024
1 parent da922ed commit b540224
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion modules/job/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ Target.addGlobalPlayer({
local _coords = GetEntityCoords(entity)
local closestStretcher = GetClosestObjectOfType(_coords.x, _coords.y, _coords.z, 5.5, `prop_ld_binbag_01`, false)

return closestStretcher ~= 0
return closestStretcher ~= 0 and not player.isDead
end,
fn = function(data)
putOnStretcher(true, type(data) == "number" and data or data.entity)
Expand Down
12 changes: 6 additions & 6 deletions modules/stretcher/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ local function vehicleInteractions()
label = locale('take_stretcher'),
groups = emsJobs,
cn = function(entity, distance, coords, name)
return isEmsVehicle(entity) and not usingStretcher
return isEmsVehicle(entity) and not usingStretcher and not player.isDead
end,
fn = function(data)
local vehicle = type(data) == "number" and data or data.entity
Expand All @@ -179,7 +179,7 @@ local function vehicleInteractions()
label = locale('put_stretcher'),
groups = emsJobs,
cn = function(entity, distance, coords, name)
return isEmsVehicle(entity) and usingStretcher and not patientOnStretcher
return isEmsVehicle(entity) and usingStretcher and not patientOnStretcher and not player.isDead
end,
fn = function(data)
local vehicle = type(data) == "number" and data or data.entity
Expand All @@ -196,7 +196,7 @@ local function vehicleInteractions()
label = locale('put_patient_in_vehicle'),
groups = emsJobs,
cn = function(entity, distance, coords, name)
return isEmsVehicle(entity) and usingStretcher and patientOnStretcher
return isEmsVehicle(entity) and usingStretcher and patientOnStretcher and not player.isDead
end,
fn = function(data)
local dataToSend = {}
Expand All @@ -214,7 +214,7 @@ local function vehicleInteractions()
label = locale('take_patient_from_vehicle'),
groups = emsJobs,
cn = function(entity, distance, coords, name)
return isEmsVehicle(entity) and Entity(entity).state?.patient
return isEmsVehicle(entity) and Entity(entity).state?.patient and not player.isDead
end,
fn = function(data)
local dataToSend = {}
Expand Down Expand Up @@ -242,7 +242,7 @@ local function stretcherInteraction()
groups = emsJobs,
distance = 3,
cn = function()
return not usingStretcher
return not usingStretcher and not player.isDead
end,
fn = function(data)
useStretcher(type(data) == "number" and data or data.entity)
Expand All @@ -255,7 +255,7 @@ local function stretcherInteraction()
groups = emsJobs,
cn = function(entity, distance, coords, name)
local playerId, playerPed, playerCoords = lib.getClosestPlayer(GetEntityCoords(entity), 2.0, false)
return GetEntityAttachedTo(playerPed) == entity
return GetEntityAttachedTo(playerPed) == entity and not player.isDead
end,
fn = function(data)
local playerId, playerPed, playerCoords = lib.getClosestPlayer(GetEntityCoords(cache.ped), 2.0, false)
Expand Down

0 comments on commit b540224

Please sign in to comment.