18.04.2015, 19:45
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 +
new myTimer[MAX_PLAYERS];
On Player Connect
myTimer[playerid] = SetTimerEx("Wanted", 1000 * 60 * 10, true, "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);
}
//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;
}