im probably too late but… here is my exact code

client side, inside my main.lua

	RegisterNetEvent('esx_burn:wanted')
	AddEventHandler('esx_burn:wanted', function(wantedlevel)
			if wantedlevel ~= 0 then
				--TriggerEvent('esx_burn:notif', "POLICE!", "", "Wanted Level: " .. tostring(wantedlevel), "CHAR_SOCIAL_CLUB", 4);
			end
			SetPlayerWantedLevel(PlayerId(), tonumber(wantedlevel), false);
			SetPlayerWantedLevelNow(PlayerId(), false);
	end)

then call it anywhere with

TriggerEvent('esx_burn:wanted',3)
1 Like

im probably to late lol, but i have put both of these in to my hold resource and i still dont get a wanted level, do you have an idea on what could be doing on?

sorry to hijack the post, im looking for something similar, but im wanting to lock the max about of stars to 3 stars, 4 stars is a bit to crazy

DocBurn did you require any code on the server side? New to client/server scripting

i would go to es_extended, client, main.lua around line 43 (my es_extended is modded)

and look for
SetMaxWantedLevel(3)

i dont have code server side for wanted… and you dont need to call your own function at all if you dont need to… (i do)

u can just call client side

		SetPlayerWantedLevel(PlayerId(), WantedLevelYouWant, false)
		SetPlayerWantedLevelNow(PlayerId(), false)

thanks for the reply, only thing i have for wanted levels in that clent.lua is

-- Disable wanted level
if Config.DisableWantedLevel then
	Citizen.CreateThread(function()
		while true do
			Citizen.Wait(0)

			local playerId = PlayerId()
			if GetPlayerWantedLevel(playerId) ~= 0 then
				SetPlayerWantedLevel(playerId, 0, false)
				SetPlayerWantedLevelNow(playerId, false)
			end
		end
	end)
end

I don’t know alot about scripting, I wonder if there is a way to set a else SetMaxWanted(3) or something like that?

I don’t know alot about scripting, I wonder if there is a way to set a else SetMaxWanted(3) or something like that?

Resloved this now vmenu was enabling never wanted by default so that’s been disabled now all working as it should

if Config.DisableWantedLevel then
 
    Citizen.CreateThread(function()
        while true do
            Citizen.Wait(0)

            local playerId = PlayerId()
            if GetPlayerWantedLevel(playerId) ~= 0 then
                SetPlayerWantedLevel(playerId, 0, false)
                SetPlayerWantedLevelNow(playerId, false)
                
              
              
            end
        end
    end)
    
else 
	SetMaxWantedLevel(3)
end

this was my fix

Thank you so much!!! This works great !
For the people that cant get it to work.
Go to es_extended , go to config , change false to true like here :

Config.EnableWantedLevel = true – Use Normal GTA wanted Level?

If you are using vmenu make shure wanted level is OFF.
Puth client side above in your client and use the trigger after you start a robbery or whatever you want to use it.
Thanks to docburn!!!

This is a part of my esx_holdup script:

CreateThread(function()
while true do
Wait(0)
local playerPos, letSleep = GetEntityCoords(PlayerPedId()), true
for k,v in pairs(Stores) do
local distance = #(playerPos - v.position)
if distance < Config.Marker.DrawDistance then
if not holdingUp then
letSleep = false
DrawMarker(Config.Marker.Type, v.position, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, false, false, false, false)
if distance < 2.0 then
ESX.ShowHelpNotification(_U(‘press_to_rob’, v.nameOfStore))
if IsControlJustReleased(0, 38) then
if IsPedArmed(PlayerPedId(), 4) or
IsPedArmed(PlayerPedId(), 1) then
TriggerServerEvent(‘esx_holdup:robberyStarted’, k)
TriggerEvent(‘esx_burn:wanted’,1) --Set wanted level start
else
ESX.ShowNotification(_U(‘no_threat’))
end
end
end
end
break
end
end
if holdingUp then
letSleep = false
if #(playerPos - Stores[store].position) > Config.MaxDistance then
TriggerServerEvent(‘esx_holdup:tooFar’, store)
end
end
if letSleep then
Wait(500)
end
end
end)