[HELP] No PvP in my server

Hello,

No one can hit or shoot under my server, under any circumstances. I already put the PvP ON in the essentialmode but the same thing keeps happening. I do not know if it is a particular script or is the server itself. If you wrote the post in the wrong place you can move it to the corresponding section, please.

My resources:

#### BORRAR ####


#### MODS DEFAULT DEL SERVIDOR ####
    start mapmanager
    start chat
    start spawnmanager
    start sessionmanager
    restart sessionmanager
    start fivem
    start hardcap
    start ■■■■■■■
    #start scoreboard
    start baseevents
    start playernames

#### MYSQL ASYNC ####
    start mysql-async

#### MODS ESENCIALES ####
    start essentialmode
    start esplugin_mysql
    start es_admin2
    start es_extended
    start es_ui
    #start fivem-ipl
    start whitelist

#### MODS REQUERIDOS EN ESX ####
    start instance
    start cron
    start skinchanger
    start esx_skin
    start esx_menu_default
    start esx_menu_list
    start esx_menu_dialog
    start esx_phone
    start esx_addonaccount
    start esx_addoninventory
    start esx_datastore
    start esx_society
    start esx_service
    start esx_billing

#### ESX TRABAJOS ####
    start esx_jobs
    start esx_joblisting
    start esx_taxijob
    start esx_mechanicjob
    start esx_policejob
    start esx_property
    start esx_realestateagentjob
    start esx_bankerjob
    start esx_ambulancejob
    start esx_vehicleshop

    start esx_truck
    start esx_jobCounter
    start esx_gopostal
    start esx_mafia
    start esx_ranger
    start esx_rebel
    start esx_traffic
    start esx_truckerjob

#### CUALQUIER OTRO MOD ESX ####
    start esx_status
    start esx_basicneeds
    start esx_clotheshop
    start esx_holdup
    start esx_drugs


    start esx_identity
    start esx_voice
    start esx_animations
    start esx_license
    start esx_shops
    start esx_weaponshop
    start esx_accessories
    start esx_outlawalert
    start esx_jail
    start esx_tattooshop
    start esx_drugeffects
    start esx_locksystem
    start esx_lscustom 
    start rpchat
    start esx_legacyfuel
    start esx-kr-vehicle-push
    start esx_fwd_ui
    #start esx_discord_bot
    start esx_drp_garage
    start esx_aiomenu
    start esx_scoreboard
    start esx_dmvschool
    start esx_barbershop
    start esx_radio

#### CUALQUIER MOD QUE NO SEA ESX ####
    #start eden_animal
    start scrp-scripts
    start new_banking
    start anticheese-anticheat
    start loadinganimat

#### Autos ####
    start 370z
    start polmp4
    #start PillboxHospital
    #start PillboxHospital-doors

Hello, I do not know if it will help but in the essentialmode \ server \ util.lua folder: there is this variable

settings.defaultSettings = {
	['pvpEnabled'] = true,

In your server.cfg add the line:
set es_pvpEnabled true

still no pvp

still no pvp:(

Is it possible that it is another resource and not essentialmode?

hello, in this case try to launch your server only with the necessary resources and see if it works.
In the .cfg file you put a # in front of the resource name and if it works you remove the # from before the names one by one.

I 'll try, ty.

With the new EssentialsMode update 6.2.1 they removed pvp functionality. We are trying to figure out this as well. Will update if solution is found.

Create a folder for a new resource and name it whatever you want. Inside the folder create a pvp.lua file and paste this into it

AddEventHandler("playerSpawned", function()
  Citizen.CreateThread(function()

    local player = PlayerId()
    local playerPed = GetPlayerPed(-1)

    -- Enable pvp
    NetworkSetFriendlyFireOption(true)
    SetCanAttackFriendly(playerPed, true, true)

  end)
end)

Then create a __resource.lua file with this inside

client_scripts {
	"pvp.lua"
}

All you have to do now is add the start command to your server.cfg file and use whatever name you picked for your resource folder

3 Likes

Thanks!

What is this PsP ?
What is its use?
You explain.
Thanks

All is OK. Thanks you all.

In essentialmode/client/main.lua
set local pvpEnabled = true

and add

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)
		
		if pvpEnabled then
			for i = 0,32 do
				if NetworkIsPlayerActive(i) then
					SetCanAttackFriendly(GetPlayerPed(i), true, true)
					NetworkSetFriendlyFireOption(true)
				end
			end
		end
	end
end)

The createthread was removed in a recent update but the variable was left
remember to set 32 to 64 if you use onesync, or replace it with the maxplayers sv

3 Likes