From 0e5dda5779c9a9191bb0e8a9f02aef17ded4ac4a Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 13 Oct 2019 19:18:22 +0200 Subject: [PATCH] Added pvp to esx, fixes #302 --- client/main.lua | 9 ++++++--- config.lua | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/main.lua b/client/main.lua index 2950bcda..e829044f 100644 --- a/client/main.lua +++ b/client/main.lua @@ -72,9 +72,12 @@ AddEventHandler('playerSpawned', function() TriggerEvent('esx:restoreLoadout') -- restore loadout - isLoadoutLoaded = true - isPlayerSpawned = true - isDead = false + isLoadoutLoaded, isPlayerSpawned, isDead = true, true, false + + if Config.EnablePvP then + SetCanAttackFriendly(playerPed, true, false) + NetworkSetFriendlyFireOption(true) + end end) AddEventHandler('esx:onPlayerDeath', function() diff --git a/config.lua b/config.lua index 453d052a..ee531780 100644 --- a/config.lua +++ b/config.lua @@ -7,6 +7,7 @@ Config.AccountLabels = { bank = _U('bank'), black_money = _U('black_money Config.EnableSocietyPayouts = false -- pay from the society account that the player is employed at? Requirement: esx_society Config.DisableWantedLevel = true Config.EnableHud = true -- enable the default hud? Display current job and accounts (black, bank & cash) +Config.EnablePvP = true -- enable pvp? Config.PaycheckInterval = 7 * 60000