How To Script Virus System Command
#8

Basic repeating callback
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);
    }
}
Call it like any other function, in your case
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;
}
Reply


Messages In This Thread
How To Script Virus System Command - by ohmy - 27.11.2014, 10:54
Re: How To Script Virus System Command - by SWAT4 - 27.11.2014, 10:58
Re: How To Script Virus System Command - by ohmy - 27.11.2014, 11:18
Re: How To Script Virus System Command - by SWAT4 - 27.11.2014, 11:37
Re: How To Script Virus System Command - by ohmy - 27.11.2014, 11:47
Re: How To Script Virus System Command - by Sparke - 27.11.2014, 12:05
Re: How To Script Virus System Command - by ohmy - 27.11.2014, 12:53
AW: How To Script Virus System Command - by Nero_3D - 27.11.2014, 13:31
Re: How To Script Virus System Command - by ohmy - 28.11.2014, 03:34
Re: How To Script Virus System Command - by Glossy42O - 28.11.2014, 03:48

Forum Jump:


Users browsing this thread: 3 Guest(s)