View Full Version : Could someone help me come up with a solution to this?

15/02/2015, 08:03 PM
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.

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);

15/02/2015, 08:08 PM
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.

15/02/2015, 08:10 PM
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.

15/02/2015, 08:46 PM
if(BleedingTime[playerid] < 0)
BleedingTime[playerid] = SetTimerEx

and in BleedingTimer is KillTimer? if yes use
BleedingTime[playerid] = -1;

and reset array in connect etc BleedingTime[playerid] = -1;

15/02/2015, 08:51 PM
Ahh the simplest of solutions, I couldn't even think..

Thanks Jeff(f).