[Release] Disable Wanted Level

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??

@UncleBoss No it’s not. I don’t use essential mode. I ditched it because it didn’t work right for me. If you need stars because an arrest script relies on stars, wouldn’t it make more sense to modify the arrest script?

I just want more time before a wanted star disappear, for everyone. And finally a tracking system for cops that leads to the wanted players.

@UncleBoss ah I see. I haven’t done it yet but I plan to make a server wide chat message only available to moderators with level 1(cops on duty). Saying player name has a wanted level of X in (insert location here).

so we still need to extend the wanted time :slight_smile: