SA-MP Forums Archive
Wanted Level Not Going Down - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Wanted Level Not Going Down (/showthread.php?tid=538588)



Wanted Level Not Going Down - rashidkhoso37 - 22.09.2014

please help me in my server when we are robbing killing then our wanted level not decreasing how can i decrease the wanted level ? please


Re: Wanted Level Not Going Down - Eth - 22.09.2014

you can use something like that:
pawn Код:
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)-1);



Re: Wanted Level Not Going Down - XStormiest - 22.09.2014

Just do it how Eth said and you will be fine. [do it in your OnPlayerDeath callback, under your factions check - if roleplay. - else, just put it under OnPlayerDeath]

Change from killerid if you want to decrease it for the killers
Keep them playerid if you want to decrease it for the players.


Re: Wanted Level Not Going Down - LeroyII - 22.09.2014

And if you want it to go down after except few minutes you have to set timer.


Re: Wanted Level Not Going Down - rashidkhoso37 - 23.09.2014

i want to down 1 stars every 2 minutes how can i make it when player get 5 or 6 wanted level every 2 minutes he lose his 1 star


Re: Wanted Level Not Going Down - Eth - 23.09.2014

then onplayerspawn put that:
pawn Код:
SetTimerEx("WantedLevel",60000*2,1,"d",playerid);
and in any place in ur gamemode:
pawn Код:
forward WantedLevel(playerid);
public WantedLevel(playerid)
{
if(GetPlayerWantedLevel(playerid) >= 5)
{
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)-1);
}
return 1;
}



Re: Wanted Level Not Going Down - LeroyII - 23.09.2014

-DELETED-
Use Eth's much easier and better than one i just posted!


Re: Wanted Level Not Going Down - rashidkhoso37 - 23.09.2014

Eth i added your code but now when i'm getting wanted level 5 it is resetting my wanted level to 1 i want that system which lose every 2 minutes 1 wanted level like i have wanted level 6 after 2 minutes my wanted level go down to level 5 and after 2 minutes it go down to level 4 is there any way to do that?


Re: Wanted Level Not Going Down - KayJ - 23.09.2014

try this:
pawn Код:
// OnPlayerConnect:
ReduceTimer[playerid] = -1;

// OnPlayerUpdate:
if(GetPlayerWantedLevel(playerid) >= 1 && ReduceTimer[playerid] == -1)
{
    ReduceTimer[playerid] = SetTimerEx("ReduceWantedLevel", 120000, false, "i", playerid);// And btw. 1 minute = 60000
    ReduceTimer[playerid] = 0;
}

forward ReduceWantedLevel(playerid);
public ReduceWantedLevel(playerid)
{
    if (GetPlayerWantedLevel(playerid) >= 1) SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) -1);
    else
    {
        KillTimer(ReduceTimer[playerid]);
        ReduceTimer[playerid] = -1;
    }
}



Re: Wanted Level Not Going Down - Eth - 23.09.2014

edit the old forward wantedlevel(playerid);
and public WantedLevel(playerid) with this one :
pawn Код:
forward WantedLevel(playerid);
public WantedLevel(playerid)
{
if(GetPlayerWantedLevel(playerid) != 0)
{
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)-1);
}
return 1;
}