SA-MP Forums Archive
Could someone help me come up with a solution to this? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Could someone help me come up with a solution to this? (/showthread.php?tid=563418)



Could someone help me come up with a solution to this? - Dokins - 15.02.2015

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



Re: Could someone help me come up with a solution to this? - CalvinC - 15.02.2015

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.


Re: Could someone help me come up with a solution to this? - Dokins - 15.02.2015

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.


Re: Could someone help me come up with a solution to this? - Jefff - 15.02.2015

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;


Re: Could someone help me come up with a solution to this? - Dokins - 15.02.2015

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

Thanks Jeff(f).