27.11.2014, 13:31
Basic repeating callback
Call it like any other function, in your case
pawn Код:
forward RepetitiveHeal(interval, Float: heal, tic);
public RepetitiveHeal(interval, Float: heal, tic) {
if(0 < tic) {
new
Float: health
;
for(new i; i != MAX_PLAYERS; ++i) { // use foreach if you have it
if(GetPlayerHealth(i, health)) {
SetPlayerHealth(i, health + heal);
}
}
SetTimerEx("RepetitiveHeal", interval, false, "ifi", interval, heal, tic - 1);
}
}
pawn Код:
cmd_virus(playerid, params[]) {
#pragma unused params
// all 1000 ms, -5.0 health each time, 15 times
RepetitiveHeal(1000, -5.0, 15);
return true;
}