Decrease the health
#8

Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
Here, you can set the target player, the value that decreases each second, and for how many seconds.
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>


new Timer[MAX_PLAYERS];
new TimerHandler[MAX_PLAYERS] = {0, ...};

CMD:decreasehp(playerid, params[])
{
    new target, Float:value, seconds;
    if(sscanf(params, "ufd", target, value,seconds))
    {
        SendClientMessage(playerid, -1, "USAGE: /decreasehp [playerid] [value] [seconds]");
    }
   
    if(value < 0) value*=-1;
    if(value == 0) value=10;

    if(seconds < 0) seconds *=-1;
    if(seconds == 0) seconds = 10;
   
    TimerHandler[target] = 0;
    Timer[target] = SetTimerEx("DecHP", 1000, true, "dfd", target, value, seconds);
    new str[128];
    format(str, sizeof str, "You are now decreasing ID %d's health by %.3f per second for %d seconds", target, value, seconds);
    SendClientMessage(playerid, -1, str);
    return 1;
}

forward DecHP(player, Float:amount, times);
public DecHP(player, Float: amount, times)
{
    if(TimerHandler[player] < times)
    {
        new Float: hp;
        GetPlayerHealth(player, hp);
        SetPlayerHealth(player, hp-amount);
        TimerHandler[player]++;
    }
    else
    {
        KillTimer(Timer[player]);
        TimerHandler[player] = 0;
    }
    return 1;
}
thank you but it's really complicated
Reply


Messages In This Thread
Decrease the health - by AnonScripter - 04.10.2013, 15:08
Re: Decrease the health - by Jankingston - 04.10.2013, 15:54
Re: Decrease the health - by Konstantinos - 04.10.2013, 15:58
Re: Decrease the health - by DanishHaq - 04.10.2013, 16:11
Re: Decrease the health - by AnonScripter - 04.10.2013, 16:13
Re: Decrease the health - by AnonScripter - 04.10.2013, 16:16
Re: Decrease the health - by [XST]O_x - 04.10.2013, 16:16
Re: Decrease the health - by AnonScripter - 04.10.2013, 16:18
Re: Decrease the health - by [XST]O_x - 04.10.2013, 16:20

Forum Jump:


Users browsing this thread: 1 Guest(s)