SA-MP Forums Archive
Decreasing wanted - 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: Decreasing wanted (/showthread.php?tid=571444)



Decreasing wanted - KiM0Ro - 18.04.2015

Hi everyone i want to know how to make a timer wich will decrease the 1 wanted star every 10 minutes and a textdraw appear under money wich the timer left.Who will help me i will rep +


Re: Decreasing wanted - Azula - 18.04.2015

PHP код:
new  myTimer[MAX_PLAYERS];
On Player Connect
myTimer
[playerid] = SetTimerEx("Wanted"1000 60 10true"i"playerid);
// 1000 =  1 second * 60 = 1 mn * 10 = 10 mn
On Player Disonnect
KillTimer
(myTimer[playerid]);
forward Wanted(playerid);
public 
Wanted(playerid) {
    
SetPlayerWantedLevel(playerid,  GetPlayerWantedLevel(playerid) - 1);




Re: Decreasing wanted - Ahmad45123 - 18.04.2015

First of all, This isn't a place where you request code... here we help you with your already writenn code.

However, Here you go:
PHP код:
//This is just some useful defines for time converting.
#define S_TO_MS(%0)            %0 * 1000
#define M_TO_MS(%0)            S_TO_MS(%0 * 60)
#define H_TO_MS(%0)            M_TO_MS(%0 * 60)
//This will be anywhere you want the timer to run.
SetTimerEx("DescreaseWantedLevel"M_TO_MS(10), 1"d"playerid);
//This will be anywhere in the script.
forward DecreaseWantedLevel(playerid);
public 
DecreaseWantedLevel(playerid)
{
    
SetPlayerWantedLevel(GetPlayerWantedLevel(playerid)--);
    return 
1;

And about textdraws, Search... There are tens of tutorials and editors about it.

E: Oh and also as Azula said, Make sure you delete the timer OnExit.


Re: Decreasing wanted - KiM0Ro - 18.04.2015

Thanks!