Could someone help me come up with a solution to this?
#1

Hi there, basically under OnPlayerTakeDamage I set a timer for the bleedout system, but of course, each time they're hit the timer starts again. What would be the simplest way to make sure it only runs once? I don't mean repeating, I mean that if they're hit once and they continue to be hit, I'd like the timer to not restart.

I did it like this and never thought it through, didn't quite work.

pawn Код:
if(TorsoBl[playerid] > 0 || GroinBl[playerid] > 0 || LArmBl[playerid] > 0 || RArmBl[playerid] > 0 || LLegBl[playerid] > 0|| LLegBl[playerid] > 0)
    {
      BleedingTime[playerid] = SetTimerEx("BleedingTimer", 120000, true, "i", playerid);
    }
Reply
#2

Might the faulth be that you're setting etc. TorsoBl to 1 when the player is shot?
Because you're only starting the timer if any of those are set higher than 0.
Reply
#3

I used that as an example, I'm trying to think of a way I can do it without it resetting. Well, All of those actually count the hits, with a maximum of 5 to calculate bleeding so I can work with damage etc.
Reply
#4

pawn Код:
if(BleedingTime[playerid] < 0)
    BleedingTime[playerid] = SetTimerEx
and in BleedingTimer is KillTimer? if yes use
pawn Код:
KillTimer(BleedingTime[playerid]);
BleedingTime[playerid] = -1;
and reset array in connect etc BleedingTime[playerid] = -1;
Reply
#5

Ahh the simplest of solutions, I couldn't even think..

Thanks Jeff(f).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)