local timer = {}
function setWantedLevel(player)
local wantedLevel = getElementData(player,"wantedLevel")
if wantedLevel == 10 then
setElementData(player,"wantedLevel",10,true)
exports.SASCnotifications:drawNotification("#FF0000[Wanted Level System]#FFFFFF Wanted level is "..wantedLevel..".",localPlayer)
else
setElementData(player,"wantedLevel",wantedLevel+1,true)
exports.SASCnotifications:drawNotification("#FF0000[Wanted Level System]#FFFFFF Wanted level increased to "..(wantedLevel+1)..".",localPlayer)
if getElementData(player,"wantedLevel") == 3 then
triggerServerEvent("setCriminalJob",player,player)
end
end
if timer[player] == false then
timer[player] = setTimer(function()
local wantedLevel = getElementData(player,"wantedLevel")
if wantedLevel == 0 then
killTimer(timer[player])
timer[player] = false
else
setElementData(player,"wantedLevel",wantedLevel-1,true)
exports.SASCnotifications:drawNotification("#FF0000[Wanted Level System]#FFFFFF Wanted level decreased to "..(wantedLevel-1)..".",player)
end
end,5000,0)
else
killTimer(timer[player])
timer[player] = false
setWantedLevel(player)
end
end
function load()
timer[source] = false
end
addEventHandler("onPlayerJoin", getRootElement(), load)
Try This