👾Events / Exports
This page contains an example of a exports to integrate the death screen on your scripts.
StartDeathScreen
Example Usage:
AddEventHandler("esx:onPlayerDeath", function(data)
exports["cfx-praryo-deathscreen"]:StartDeathScreen({
time = 10
})
end)
ToggleUIMaximize
Example Usage:
RegisterCommand("toggleDeathScreen", function()
exports["cfx-praryo-deathscreen"]:ToggleUIMaximize()
end)
RemoveDeathScreen
Example Usage:
RegisterCommand("removeDeathScreen", function()
exports["cfx-praryo-deathscreen"]:RemoveDeathScreen()
end)
Spawn Events
// Client Event
AddEventHandler("cfx-praryo-deathscreen:cl_events:spawnPlayer", function(data)
local position = data.position
end)
// Server Event
RegisterNetEvent("cfx-praryo-deathscreen:sv_events:spawnPlayer", function(data)
local playerId = source
local position = data.position
end)
Example Usage:
function RespawnPed(ped, coords)
SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false)
NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.w, true, false)
SetPlayerInvincible(ped, false)
ClearPedBloodDamage(ped)
SetEntityInvincible(cache.ped, false)
TriggerServerEvent('esx:onPlayerSpawn')
TriggerEvent('esx:onPlayerSpawn')
SetEntityHealth(cache.ped, GetEntityMaxHealth(cache.ped))
end
AddEventHandler("cfx-praryo-deathscreen:cl_events:spawnPlayer", function(data)
local position = data.position
local x = position.x
local y = position.y
local z = position.z
local h = position.w
RespawnPed(cache.ped, position)
end)
Last updated