> For the complete documentation index, see [llms.txt](https://docs.wise-scripts.vip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wise-scripts.vip/scripts/wise-faction/setup-ffa-and-gangwar.md).

# Setup FFA & Gangwar

## Block PlayerDeath (FFA and Gangwar)

### Example with [esx\_ambulancejob](https://github.com/esx-framework/esx_ambulancejob)

1. Open Directory <mark style="color:red;">`client/`</mark>
2. Open File <mark style="color:red;">`main.lua`</mark>
3. Search for <mark style="color:red;">`esx:onPlayerDeath`</mark> (STRG+F)
4. Replace <mark style="color:red;">`AddEventHandler`</mark> with the example below

```lua
AddEventHandler('esx:onPlayerDeath', function(data)
  if GetResourceState('wise_faction') == 'started' then 
	if not exports.wise_faction.inFight() then 
	  OnPlayerDeath()
	end
  else
    OnPlayerDeath()
  end
end)
```

### Example with [qb-ambulancejob](https://github.com/qbcore-framework/qb-ambulancejob)

1. Open Directory <mark style="color:red;">`client/`</mark>
2. Open File <mark style="color:red;">`dead.lua`</mark>
3. Search <mark style="color:red;">`gameEventTriggered`</mark> for (STRG+F)
4. Replace <mark style="color:red;">`AddEventHandler`</mark> with example below

```lua
AddEventHandler('gameEventTriggered', function(event, data)
    local inFight = false
    if GetResourceState('wise_faction') == 'started' then 
        if exports.wise_faction.inFight() 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)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wise-scripts.vip/scripts/wise-faction/setup-ffa-and-gangwar.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
