Broken Timer
#1

So I decided to make a timer, where every second, the game checks if your health goes under 20, when it does, you slowly begin to bleedout and have to call the EMS, only problem is, it doesn't work.
pawn Код:
public Dying() {
    foreach(Player, x) {
    if(playerVariables[x][pHealth] <= 20)
    {
    playerVariables[x][pBleedingOut] = 1;
    ApplyAnimation(x, "SWAT", "gnstwall_injurd", 4.0, 1, 0, 0, 0, 0);
    TogglePlayerControllable(x, 0);
    playerVariables[x][pHealth] -= 10;
    }
    }
}
It compiles fine, I just die.

pawn Код:
SetTimer("Dying", 1, true);
^ Under OnPlayerSpawn
Reply
#2

set timer fine, you did every 1 milisecond
try this/
pawn Код:
SetTimer("Dying", 1000, true);
Reply
#3

Quote:
Originally Posted by mineralo
Посмотреть сообщение
set timer fine, you did every 1 milisecond
try this/
pawn Код:
SetTimer("Dying", 1000, true);
Woops, I meant every milisecond.
Reply
#4

try this
pawn Код:
forward Dying();
public Dying()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(playerVariables[i][pHealth] <= 20)
    {
    playerVariables[i][pBleedingOut] = 1;
    ApplyAnimation(i, "SWAT", "gnstwall_injurd", 4.0, 1, 0, 0, 0, 0);
    TogglePlayerControllable(i, 0);
    playerVariables[i][pHealth] -= 10;
    }
}
return 1;
}
now will check every body
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)