Wise Scripts Docs
ShopDiscord
  • 👋Welcome
  • 💻 Scripts
    • 🚙Wise Garage
      • Installation
      • Database
      • Events
      • Example Configs
        • Main
        • Garages
        • Impounds
    • 🖥️Wise Hud
      • Installation
      • Example Configs
        • Main
    • 🦌Wise Hunting
      • Installation
      • Example Configs
        • Main
        • Animals
        • Huntareas
        • Market
    • 🔫Wise Gungame
      • Installation
      • Setup for Ambulancejob
    • 👥Wise Faction
      • Installation
      • Exports
      • Events
      • Setup FFA & Gangwar
      • Example Configs
        • Main
        • FFA
        • Gangwar
        • Robbery
        • Shop
        • Missions
    • 🔔Wise Notify
      • Installation
      • Exports & Triggers
      • ESX Replacements
    • ⚠️Wise Report
      • Installation
    • 🎮Wise Lifeinvader
      • Installation
  • 🏡PROPS
    • 🪨Wise Ore Props Pack
    • ✨Wise Crystal Props Pack
  • 🧟‍♂️PEDS
    • 🎃HALLOWEEN Pumpkin Monster
    • 🎃HALLOWEEN MR Bright
Powered by GitBook
On this page
  • Block PlayerDeath
  • Example with esx_ambulancejob
  • Example with qb-ambulancejob
  1. 💻 Scripts
  2. Wise Gungame

Setup for Ambulancejob

PreviousInstallationNextWise Faction

Last updated 10 months ago

Block PlayerDeath

Example with

  1. Open Directory client/

  2. Open File main.lua

  3. Search for esx:onPlayerDeath (STRG+F)

  4. Replace AddEventHandler with the example below

AddEventHandler('esx:onPlayerDeath', function(data)
  if GetResourceState('wise_gungame') == 'started' then 
	if not exports.wise_gungame:inLobby() then 
	  OnPlayerDeath()
	end
  else
    OnPlayerDeath()
  end
end)

Example with

  1. Open Directory client/

  2. Open File dead.lua

  3. Search gameEventTriggered for (STRG+F)

  4. Replace AddEventHandler with example below

AddEventHandler('gameEventTriggered', function(event, data)
    local inFight = false
    if GetResourceState('wise_gungame') == 'started' then 
        if exports.wise_gungame:inLobby() then
            ResetAll()
            inFight = true 
        end
    end


    if event == "CEventNetworkEntityDamage" and not inFight then
        local victim, attacker, victimDied, weapon = data[1], data[2], data[4], data[7]
        if not IsEntityAPed(victim) then return end
        if victimDied and NetworkGetPlayerIndexFromPed(victim) == PlayerId() and IsEntityDead(PlayerPedId()) then
            if not InLaststand then
                SetLaststand(true)
            elseif InLaststand and not isDead then
                SetLaststand(false)
                local playerid = NetworkGetPlayerIndexFromPed(victim)
                local playerName = GetPlayerName(playerid) .. " " .. "("..GetPlayerServerId(playerid)..")" or Lang:t('info.self_death')
                local killerId = NetworkGetPlayerIndexFromPed(attacker)
                local killerName = GetPlayerName(killerId) .. " " .. "("..GetPlayerServerId(killerId)..")" or Lang:t('info.self_death')
                local weaponLabel = QBCore.Shared.Weapons[weapon].label or 'Unknown'
                local weaponName = QBCore.Shared.Weapons[weapon].name or 'Unknown'
                TriggerServerEvent("qb-log:server:CreateLog", "death", Lang:t('logs.death_log_title', {playername = playerName, playerid = GetPlayerServerId(playerid)}), "red", Lang:t('logs.death_log_message', {killername = killerName, playername = playerName, weaponlabel = weaponLabel, weaponname = weaponName}))
                deathTime = Config.DeathTime
                OnDeath()
                DeathTimer()
            end
        end
    end
end)
🔫
esx_ambulancejob
qb-ambulancejob