esx_ambulancejob
RegisterNetEvent('esx_ambulancejob:onPlayerDistress')
AddEventHandler('esx_ambulancejob:onPlayerDistress', function()
local source = source
local injuredPed = GetPlayerPed(source)
local injuredCoords = GetEntityCoords(injuredPed)
local playerProperty = exports['vms_housing']:GetPlayerCurrentProperty(source)
if playerProperty then
local property = exports['vms_housing']:GetProperty(playerProperty)
if property.object_id then
local building = exports['vms_housing']:GetProperty(property.object_id)
if building.type == 'building' then
property = building
end
end
if property.metadata?.exit then
injuredCoords = property.metadata.exit
end
end
if deadPlayers[source] then
deadPlayers[source] = 'distress'
local Ambulance = ESX.GetExtendedPlayers("job", "ambulance")
for _, xPlayer in pairs(Ambulance) do
xPlayer.triggerEvent('esx_ambulancejob:PlayerDistressed', source, injuredCoords)
end
end
end)ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
exports['vms_housing']:DropPlayerFromProperty(source)
-- Rest of the code
end)Last updated
Was this helpful?