OnPlayerTakeDamage - 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: OnPlayerTakeDamage (
/showthread.php?tid=606810)
OnPlayerTakeDamage -
GoldenLion - 09.05.2016
For some reason this doesn't work:
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if (GodMode[playerid] == 1)
{
new Float:health;
GetPlayerHealth(playerid,health);
if (health < 150.0)
{
SetPlayerHealth(playerid, 200.0);
}
}
I have a /god command for level 3+ admins which enables god mode, but the code above doesn't seem to work. Also don't suggest making it SetPlayerHealth(playerid, 9999999) when typing /god, because this doesn't work for some reason in my server.
Does anybody know what is the issue?
Re: OnPlayerTakeDamage -
Slawiii - 09.05.2016
maybe this need be under
OnPlayerUpdate
Re: OnPlayerTakeDamage -
Konstantinos - 09.05.2016
I'm not sure if GetPlayerHealth returns the old health so the if statement is always false but I will suggest something else:
pawn Код:
SetPlayerHealth(playerid, Float: 0x7F800000);
for infinity health.
Re: OnPlayerTakeDamage -
GoldenLion - 09.05.2016
OnPlayerUpdate worked, thanks.