[Help] Putting a time - 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: [Help] Putting a time (
/showthread.php?tid=664837)
[Help] Putting a time -
Duartstrocci - 12.03.2019
Good night, I'm in need of a little help.
The system is the following when a player is hit with a shot, he start to lose life
the problem is that he lose life very fast.
I need have he lose life every 15 seconds.
I will be very grateful if anyone can help!
CODE
PHP код:
if(PlayerInfo[i][pTakesashot] > 0)
{
if(OtherInfos[i][oLoselife] < 5) OtherInfos[i][oLoselife]++;
else
{
OtherInfos[i][oLoselife] = 0;
SendClientMessage(i, COLOR_LIGHTRED, "You are losing your life due to an untreated bullet or stab wound.");
new Float:Lose;
if(PlayerInfo[i][pHeavyShot] > 0) Lose= 8.0;
else Lose= 5.0;
new Float:health;
GetPlayerHealth(i,health);
SetPlayerHealth(i, health-Lose);
HealthPlayerid[i] = health-Lose;
}
}
Re: [Help] Putting a time -
andrejc999 - 12.03.2019
We need more code...
Re: [Help] Putting a time -
L0K3D - 12.03.2019
Код:
new lastHPLose;
timer loseHP[1000]() {
if(!lastHPLose) lastHPLose = gettime();
else if(lastHPLose && (gettime()-lastHPLose) == 15) {
// your code
lastHPLose = gettime();
}
}