Customizations
Quick easy customizable functions
These are quick easy ways to implement your favourite scripts with
wasabi_ambulance
.
Notifications / Car Keys / Text UI / Target / More!
These can be changed in the wasabi_bridge resource!
Inventory Compatibility(Specifically removal of items on death)
Navigate to
wasabi_ambulance/server/sv_customize.lua
Find:
RegisterServerEvent('wasabi_ambulance:removeItemsOnDeath'
DeathScreen using Drawtext
Find:
-- Death screen related editables
function StartDeathTimer()
canRespawn = false
if not Config.DisableDeathAnimation then
SetGameplayCamRelativeHeading(-360)
end
.
.
.
.
.
function OnPlayerDeath(stagetwo)
SendReactMessage('playerDied', json.encode(true))
if not isDead or isDead ~= 'dead' then
isDead = 'dead'
TriggerServerEvent('wasabi_ambulance:setDeathStatus', 'dead', true)
DrugIntake = {}
if not stagetwo then
StartDeathTimer()
end
startDeathAnimation(false)
else
startDeathAnimation(true)
end
if Config.CompleteDeath.enabled and wsb.framework == 'esx' then
TriggerServerEvent('wasabi_ambulance:deathCount')
end
end
Replace with:
-- Death screen related editables
function StartDeathTimer()
if not Config.DisableDeathAnimation then
SetGameplayCamRelativeHeading(-360)
end
local earlySpawnTimer = math.floor(Config.RespawnTimer / 1000)
local bleedoutTimer = math.floor(Config.BleedoutTimer / 1000)
CreateThread(function()
while earlySpawnTimer > 0 and isDead do
Wait(1000)
if earlySpawnTimer > 0 then
earlySpawnTimer = earlySpawnTimer - 1
end
end
while bleedoutTimer > 0 and isDead do
Wait(1000)
if bleedoutTimer > 0 then
bleedoutTimer = bleedoutTimer - 1
end
end
end)
CreateThread(function()
local text, timeHeld
while earlySpawnTimer > 0 and isDead do
Wait(0)
if not IsCheckedIn then
text = (Strings.respawn_available_in):format(secondsToClock(earlySpawnTimer))
DrawGenericTextThisFrame()
BeginTextCommandDisplayText('STRING')
AddTextComponentSubstringPlayerName(text)
EndTextCommandDisplayText(Config.MessagePosition.respawn.x or 0.5, Config.MessagePosition.respawn.y or 0.8)
else
Wait(1000)
end
end
while bleedoutTimer > 0 and isDead do
Wait(0)
if not IsCheckedIn then
text = (Strings.respawn_bleedout_in):format(secondsToClock(bleedoutTimer)) .. Strings.respawn_bleedout_prompt
if IsControlPressed(0, 38) and timeHeld > 60 then
StartRPDeath()
break
end
if IsControlPressed(0, 38) then
timeHeld = timeHeld + 1
else
timeHeld = 0
end
DrawGenericTextThisFrame()
BeginTextCommandDisplayText('STRING')
AddTextComponentSubstringPlayerName(text)
EndTextCommandDisplayText(Config.MessagePosition.bleedout.x or 0.5, Config.MessagePosition.bleedout.y or 0.8)
else
Wait(1000)
end
end
if bleedoutTimer < 1 and isDead then
StartRPDeath()
end
end)
end
function StartDistressSignal()
CreateThread(function()
local timer = Config.BleedoutTimer
while timer > 0 and isDead do
Wait(0)
if not IsCheckedIn then
timer = timer - 30
SetTextFont(4)
SetTextScale(0.5, 0.5)
SetTextColour(255, 255, 255, 255)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextCentre(true)
BeginTextCommandDisplayText('STRING')
AddTextComponentSubstringPlayerName(Strings.distress_send)
EndTextCommandDisplayText(Config.MessagePosition.distress.x or 0.175, Config.MessagePosition.distress.y or 0.805)
if IsControlJustReleased(0, 47) then --Old 47
SendDistressSignal()
break
end
end
end
end)
end
function OnPlayerDeath(stagetwo)
if not isDead or isDead ~= 'dead' then
isDead = 'dead'
TriggerServerEvent('wasabi_ambulance:setDeathStatus', 'dead', true)
DrugIntake = {}
if not stagetwo then
StartDeathTimer()
StartDistressSignal()
end
startDeathAnimation(false)
else
startDeathAnimation(true)
end
if Config.DeathScreenEffects then
AnimpostfxPlay('DeathFailOut', 0, true)
end
if Config.CompleteDeath.enabled and wsb.framework == 'esx' then
TriggerServerEvent('wasabi_ambulance:deathCount')
end
end
function DrawGenericTextThisFrame()
SetTextFont(4)
SetTextScale(0.0, 0.5)
SetTextColour(255, 255, 255, 255)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextCentre(true)
end
Add this to config.lua
Config.MessagePosition = {
respawn = { x = 0.5, y = 0.8 },
bleedout = { x = 0.5, y = 0.8 },
distress = { x = 0.5, y = 0.86 },
}
--Make sure you have the following in String.lua
Strings = {
respawn_available_in = 'Respawn available in ~r~%s minutes %s seconds~s~\n',
respawn_bleedout_in = 'You will bleed out in ~r~%s minutes %s seconds~s~\n',
respawn_bleedout_prompt = 'Hold [~r~E~s~] to respawn',
distress_send = 'Press [~r~G~s~] to send distress signal to EMS',
}
Stealing from dead players
Navigate to
ox_inventory/client.lua
Find:
local function canOpenTarget(ped)
return IsPedFatallyInjured(ped)
or IsEntityPlayingAnim(ped, 'dead', 'dead_a', 3)
or IsPedCuffed(ped)
or IsEntityPlayingAnim(ped, 'mp_arresting', 'idle', 3)
or IsEntityPlayingAnim(ped, 'missminuteman_1ig_2', 'handsup_base', 3)
or IsEntityPlayingAnim(ped, 'missminuteman_1ig_2', 'handsup_enter', 3)
or IsEntityPlayingAnim(ped, 'random@mugging3', 'handsup_standing_base', 3)
end
Replace with:
local function canOpenTarget(ped)
local player = NetworkGetPlayerIndexFromPed(ped)
local playerID = GetPlayerServerId(player)
return IsPedFatallyInjured(ped)
or Player(playerID).state.dead
or IsEntityPlayingAnim(ped, 'dead', 'dead_a', 3)
or IsPedCuffed(ped)
or IsEntityPlayingAnim(ped, 'mp_arresting', 'idle', 3)
or IsEntityPlayingAnim(ped, 'missminuteman_1ig_2', 'handsup_base', 3)
or IsEntityPlayingAnim(ped, 'missminuteman_1ig_2', 'handsup_enter', 3)
or IsEntityPlayingAnim(ped, 'random@mugging3', 'handsup_standing_base', 3)
end
This snippet is intended for Quasar Inventory V2!
Navigate to
qs-inventory/client/custom/framework
and select lua file that corresponds with your framework.Find function named
function checkEntityDead(id, entity).
It may look something like this:
function checkEntityDead(id, entity)
local check = false
if GetEntityHealth(entity) <= 1 then
check = true
end
return check
end
Replace function with this:
function checkEntityDead(id, entity)
local check = false
local cId = NetworkGetPlayerIndexFromPed(entity)
local sId = GetPlayerServerId(cId)
local state = Player(sId).state
if GetEntityHealth(entity) < 2 or state.dead or state.isDead or state.laststand then
check = true
end
return check
end
Last updated