open.mp forum
[Pawn] How to decrease SetPlayerWantedLevel every 5 seconds? - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] How to decrease SetPlayerWantedLevel every 5 seconds? (/showthread.php?tid=2152)



How to decrease SetPlayerWantedLevel every 5 seconds? - XDK6 - 2021-07-04

Hi guys I need help how to decrease setplayerwanted levels for every 5 second


RE: How to decrease SetPlayerWantedLevel every 5 seconds? - Pinch - 2021-07-04

Code:
forward DeceraseWantedLevel(playerid);
public DecreaseWantedLevel(playerid)
{
    new level = GetPlayerWantedLevel(playerid);
    if(!level)
        return;

    SetPlayerWantedLevel(playerid, --level);
}

// Somewhere in your script
SetTimerEx("DecreaseWantedLevel", true, 5 * 1000, "d", playerid);



RE: How to decrease SetPlayerWantedLevel every 5 seconds? - Kwarde - 2021-07-04

Alternatively, if you're using YSI you can use y_timers:



Code:
//Somewhere in your script (after including y_timers ofc)

ptask DescreaseWantedLevel[5000](playerid)

{

    //Your piece of code to decrease wanted level

}



RE: How to decrease SetPlayerWantedLevel every 5 seconds? - Pinch - 2021-07-05

(2021-07-04, 06:55 PM)Kwarde Wrote: Alternatively, if you're using YSI you can use y_timers:



Code:
//Somewhere in your script (after including y_timers ofc)

ptask DescreaseWantedLevel[5000](playerid)

{

    //Your piece of code to decrease wanted level

}

You shouldn't really force people to use YSI if they do not want to do so


RE: How to decrease SetPlayerWantedLevel every 5 seconds? - Kwarde - 2021-07-05

If you pay some attention to that post again:
Quote:Alternatively, if you're using YSI you can use y_timers:
1) "if" you're using YSI
2) you "can" use y_timers

Not forcing at all :-). Merely stating they can use ptask with y_timers if they are (already) using YSI


RE: How to decrease SetPlayerWantedLevel every 5 seconds? - Pinch - 2021-07-05

Eh that's fair, I misread the first sentence


RE: How to decrease SetPlayerWantedLevel every 5 seconds? - XDK6 - 2021-07-12

okay guys thank you I'll try both? :)