It would be great if FiveM add an option to disable Peds, Generated vehicles and so on because right now we have to do it with loops and it’s not a reliable solution because when someone’s connection interrupts it’s going spawn hell of peds and vehicles for others and it’s really annoying
We do have a such a thing on FiveM forced in onsync_infinity so how about adding it to the onesync and onesync+ as convar so we can manually turn it on or off
there is no point on using this I know how to remove NPC but the problem is it’s not a reliable solution because when player’s connection interrupts it start generating bots and when player reconnect it will bring all of those bots with himself also it’s a loop with 0ms delay which impact performance
Set entity lockdown mode to strict or relaxed
You can also cancel it during EntityCreating event, but in this case, you should disable population client side too because the game won’t stop trying to create entities
I tried this both in client and server side it’s not a native or I am doing something wrong
Error loading script server.lua in resource esx_aduty: @esx_aduty/server.lua:2286: attempt to call a nil value (global 'SetEntityLockdownMode')
stack traceback:
@esx_aduty/server.lua:2286: in main chunk
Failed to load script server.lua.
Started resource esx_aduty
This is a server side native and the name is SET_SYNC_ENTITY_LOCKDOWN_MODE (0x0071321B).
I use C# and it was not defined either (like DeleteEntity server side).
You have to call with the hex value, I don’t know lua but it shoud be:
Citizen.InvokeNative(0x0071321B, “relaxed”)
Possible values : “relaxed”, “strict” or “inactive”
Man you are a savior thank you so much <3
and I didn’t know DeleteEntity exist on serverside it can be so useful if you don’t mind can you send me the hex value of that native so I can call it please?
@Less thank you for help and it was working, but it was not what I expected because when you set the mode to relaxed or strict it will despawn every entity you spawn, I need something like onesync_infinity to only disable NPC which generating by game
Setting EntityLockDown to strict will to the same because it check if onesync bigmode or EntityLockDown is strict (+ it disable all client side entities)
To reply to your first question, if you want be 100% sure client won’t create entities, you have to use the “No-NPC” script + cancel the entityCreating event (see my code above) OR lockdown strict + create entities server side ?
Options are here
Worked great thanks, it gives the functionality I wanted but soon I am gonna implement your 2nd advice in my code create entities server side thanks for help