Plugin updated to version
1.1.1
Fixed:
- Fixed the problem when timers just stopped.
- Fixed the problem when the callback was called after the timer was deleted.
Added:
- Now you can pause the timer and continue it in the future.
Example:
PHP Code:
#include <timerfix>
new timer[MAX_PLAYERS];
forward WhileNotInVehicle(playerid);
public WhileNotInVehicle(playerid)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
timer[playerid] = SetTimerEx("WhileNotInVehicle", 1000, true, "i", playerid);
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
PauseTimer(timer[playerid]);
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
ContinueTimer(timer[playerid]);
}
- You can add additional callbacks for one timer.
Example:
PHP Code:
#include <timerfix>
forward CallbackOne(number);
public CallbackOne(number)
{
printf("[CallbackOne] Number is %d", number);
}
forward CallbackTwo(number);
public CallbackTwo(number)
{
printf("[CallbackTwo] Number is %d", number);
}
public OnGameModeInit()
{
new timer = SetTimerEx("CallbackOne", 1000, false, "i", 727);
// The same arguments will be passed for both callbacks.
AddTimerHandler(timer, "CallbackTwo");
}
- Also added the custom timers with count of executions and delay before the timer starts.
Example:
PHP Code:
#include <timerfix>
new timer;
forward CallbackOne(number);
public CallbackOne(number)
{
printf("[CallbackOne] Number is %d", number);
}
forward CallbackTwo(number);
public CallbackTwo(number)
{
printf("[CallbackTwo] Number is %d", number);
KillTimer(timer);
}
public OnGameModeInit()
{
// Set the count to -1 for infinite timer
timer = SetCustomTimerEx("CallbackOne", 1000, 500, 5, "i", 800);
// The same arguments will be passed for both callbacks.
AddTimerHandler(timer, "CallbackTwo");
}
Report about any bugs
here please.