OnPlayerTakeDamage
#1

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?
Reply
#2

maybe this need be under OnPlayerUpdate
Reply
#3

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.
Reply
#4

OnPlayerUpdate worked, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)