how can i decrease player health? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: how can i decrease player health? (
/showthread.php?tid=217915)
how can i decrease player health? -
[LAG]MaXy - 29.01.2011
how can i decrease player health with a timer ?(not instant kill ex: -5 or -3)
Re: how can i decrease player health? -
cessil - 29.01.2011
by using GetPlayerHealth and SetPlayerHealth
Re: how can i decrease player health? -
[LAG]MaXy - 29.01.2011
Quote:
Originally Posted by cessil
by using GetPlayerHealth and SetPlayerHealth
|
Done but is killing, not decreasing :S
Re: how can i decrease player health? -
California - 29.01.2011
pawn Код:
#include <a_samp>
#define SECONDS 60
forward HealthDecrease(playerid);
public OnGameModeInit()
{
SetTimer("HealthDecrease", SECONDS*1000, true);
return 1;
}
public HealthDecrease(playerid)
{
new Float:HP;
GetPlayerHealth(playerid, HP);
SetPlayerHealth(playerid, HP-1);
return 1;
}
Re: how can i decrease player health? -
MrDeath537 - 29.01.2011
Quote:
Originally Posted by California
pawn Код:
#include <a_samp>
#define SECONDS 60
forward HealthDecrease(playerid);
public OnGameModeInit() { SetTimer("HealthDecrease", SECONDS*1000, true); return 1; }
public HealthDecrease(playerid) { new Float:HP; GetPlayerHealth(playerid, HP); SetPlayerHealth(playerid, HP-1); return 1; }
|
Your code doesn't work, you've to use a loop inside the callback because "(playerid)" will be always 0.
Re: how can i decrease player health? -
California - 29.01.2011
Quote:
Originally Posted by MrDeath
Your code doesn't work, you've to use a loop inside the callback because "(playerid)" will be always 0.
|
That's true, I didn't even know that, and when the timer is executed, playerid will be 0 because I didn't create a loop then use SetTimerEx to define the params.
Anyway, Armed2 was right.
Quote:
Originally Posted by Grdamn13
if u are using a gf edit just /sethp
|
No, he wants a
timer.
Re: how can i decrease player health? -
Mean - 29.01.2011
Quote:
Originally Posted by MrDeath
Your code doesn't work, you've to use a loop inside the callback because "(playerid)" will be always 0.
|
He can always use SetTimerEx
Re: how can i decrease player health? -
MrDeath537 - 30.01.2011
Quote:
Originally Posted by California
That's true, I didn't even know that, and when the timer is executed, playerid will be 0 because I didn't create a loop then use SetTimerEx to define the params.
Anyway, Armed2 was right.
No, Josh, he wants a timer.
|
I know, I only posted that because if he use your code it won't work
.
Re: how can i decrease player health? -
Lorenc_ - 30.01.2011
Quote:
Originally Posted by Mean
He can always use SetTimerEx
|
Thats crazy because your going to have all your players running that timer.
Re: how can i decrease player health? -
Mean - 30.01.2011
Quote:
Originally Posted by Lorenc_
Thats crazy because your going to have all your players running that timer.
|
Yea that is true lol.