[Release] Disable Wanted Level

This script disables Wanted Levels for all players serverwide, so you won’t have to deal with players who didn’t turn on Never Wanted on a trainer. Great for RP servers.

Download is here.

Installation:

  1. Go to your server directory
  2. Open up your citmp-server.yml
  3. At the buttom of the AutoStartResources, add:
  • NeverWanted
  1. Open your resources directory
  2. Extract the downloaded zip into this directory
  3. Turn on the server and enjoy the silence

nowanted.lua

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        if GetPlayerWantedLevel(PlayerId()) ~= 0 then
            SetPlayerWantedLevel(PlayerId(), 0, false)
            SetPlayerWantedLevelNow(PlayerId(), false)
        end
    end
end)
5 Likes

Please also put code here.

Great Script! Keep it up!

Added it as requested.

2 Likes

You could have just only used this instead without a loop.

  `SetMaxWantedLevel(0)`
2 Likes

Huh, I tried this at the beginning and it didn’t work. I must have had a typo when writing it then.

Edit: Just tried it out, it doesn’t work.

1 Like

any way to just make the police despawn or still have a wanted level like SetPoliceIgnorePlayer but still have stars? So we can use arrest script

1 Like

Sorry for the thread necro, but you can accomplish that by using

local player = PlayerId()

SetPoliceIgnorePlayer(player, true)
SetDispatchCopsForPlayer(player, false)

The cops will ignore the player and not dispatch after you for crimes, but the wanted levels remain.

1 Like

how the script look then? I have been looking for a way to keep wanted levels in and just disable the ai cops so how would that script work?

local player = PlayerId()

Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if GetPlayerWantedLevel(PlayerId()) ~= 0 then
SetPoliceIgnorePlayer(player, true)
SetDispatchCopsForPlayer(player, false)
end
end
end)
There you go, You can get stars, but police will not spawn.
Can somebody make sure that the stars do not disappear after 1 min.?

@UncleBoss the stars do eventually disappear, not sure if it’s one minute though. I will have the wanted level set to trigger a chat message " player name has a wanted level of X stars in (insert location here). So as long as the on duty police see the CAD call they will pursue.

If you want the wanted level to stay until manually reset, you could probably use the native function–

PLAYER::SET_PLAYER_WANTED_LEVEL_NO_DROP

SetPlayerWantedLevelNoDrop(player, curWantedLevel, false)

Though I haven’t used that function yet at all.

1 Like

Okey thank you, there is only one problem left, this script only applies for the first joined user.

@UncleBoss try using playerId instead of player. I can’t confirm if that’s a fix, as all the testing I do on my server is on my PC and by myself. So if you could test it, would be good to know.

Yeah sorry, I was ‘extending’ the script in your previous post. Sometimes things that make sense in my own head don’t make sense to others.

local player = PlayerId()

Try calling those functions after the player has loaded and spawned too. Do you use essentialmode by chance @Uncleboss?

@Anarchy_Rising I didn’t use the local player = playerId(). I used SetPoliceIgnorePlayer(playerId(), true)
SetDispatchCopsForPlayer(playerId(), false).
I used Mr.scammers format changing a few lines. Will test tonight with multiple players.

No, i don’t use essentialmode, why?

1 Like

Doesn’t work for me, about 1 min and 20 sec after committing the stars disappear.

@UncleBoss If you don’t mind me asking. Why do you need the stars to remain?

@HST it’s already in the essentialmode??