Kill system
#1

.....................
Reply
#2

This can't be done without 5 timers.
Reply
#3

will u plz explain :OOO
Reply
#4

pawn Код:
new KillTimer[MAX_PLAYERS];
command:kill(playerid)
{
      KillTimer[playerid] = SetTimerEx("TakeAwayPlayersHealth", 1000, true, "i", playerid);
      return 1;
}

fowrward TakeAwayPlayersHealth(playerid);
public TakeAwayPlayersHealth(playerid)
{
      new Float:pHP;GetPlayerHealth(playerid,pHP);
      if(pHP >=80) SetPlayerHealth(playerid, 80);
      else if(pHP >=60&& pHP <80) SetPlayerHealth(playerid, 60);
      else if(pHP >=40&& pHP <60) SetPlayerHealth(playerid, 40);
      else if(pHP >=20&& pHP <40) SetPlayerHealth(playerid, 20);
      else if(pHP >=0&& pHP <20){SetPlayerHealth(playerid, 0);KillTimer(KillTimer[playerid]);}
      return 1;
}
done with 1 timer!
Reply
#5

not works
Reply
#6

can anyone help
with it ?
Reply
#7

pawn Код:
forward TakeAwayPlayersHealth(playerid);
public TakeAwayPlayersHealth(playerid)
{
    new Float:pHP;GetPlayerHealth(playerid,pHP);
    if(pHP >=80) SetPlayerHealth(playerid, 80);
    else if(pHP >=60 && pHP <= 80) SetPlayerHealth(playerid, 60);
    else if(pHP >=40 && pHP <= 60) SetPlayerHealth(playerid, 40);
    else if(pHP >=20 && pHP <= 40) SetPlayerHealth(playerid, 20);
    else if(pHP >=0 && pHP <= 20)
    {
        SetPlayerHealth(playerid, 0);
        KillTimer(KillTimer[playerid]);
    }
    return 1;
}
Reply
#8

no effect

actually i want it like
if player type /kill
the health go down every second 20 percent
so in 5 seconds player dies
Reply
#9

Put this in your code:

pawn Код:
SetTimerEx("TakeAwayPlayersHealth", 1000, false, "i", playerid);
And you need the callback from spedico.

(This will make your health goes down with 20% after 1 second from the command and keep going down until 0.)
Reply
#10

.....................
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)