SA-MP Forums Archive
OnPlayerDeath :) - 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: OnPlayerDeath :) (/showthread.php?tid=506700)



OnPlayerDeath :) - ChristianIvann09 - 14.04.2014

How do i make this when im on duty admin and somebody kills me then i wont get killed. I will get revived
and it will not shown that /accept death , /service ems
Код:
public SendEMSQueue(playerid,type)
{
	switch (type)
	{
		case 1:
		{
			Streamer_UpdateEx(playerid, GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
			SetPlayerPos(playerid, GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
			SetPlayerVirtualWorld(playerid, GetPVarInt(playerid,"MedicVW"));
			SetPlayerInterior(playerid, GetPVarInt(playerid,"MedicInt"));

			SetPVarInt(playerid, "EMSAttempt", -1);

			if(GetPlayerInterior(playerid) > 0)
			{
				TogglePlayerControllable(playerid, 0);
				SetPVarInt(playerid, "LoadingObjects", 1);
				SetTimerEx("SafeLoadObjects", 4000, 0, "d", playerid);
			}

			GameTextForPlayer(playerid, "~r~Injured~n~~w~/accept death or /service ems", 5000, 3);
			ClearAnimations(playerid);
			ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.0, 0, 1, 1, 1, 0, 1);
			SetPlayerHealth(playerid, 100);
			SetPlayerArmour(playerid,0);
			if(GetPVarInt(playerid, "usingfirstaid") == 1)
			{
				firstaidexpire(playerid);
			}
			SetPVarInt(playerid,"MedicCall",1);
		}
		case 2:
		{
			SetPVarInt(playerid,"EMSAttempt", 2);
			ClearAnimations(playerid);
			ApplyAnimation(playerid, "SWAT", "gnstwall_injurd", 4.0, 0, 1, 1, 1, 0, 1);
			SetPlayerHealth(playerid, 100);
			SetPlayerArmour(playerid,0);
		}
	}
	return 1;
}



Re: OnPlayerDeath :) - Laure - 14.04.2014

The best thing you can do is on the command /aduty
have
SetPlayerHealth(playerid, 1000000);
SetPlayerArmor(playerid, 1000000);

That wont get him killed and after /aduty off add
SetPlayerHealth(playerid, 100);
SetPlayerArmor(playerid, 100);

and that will make it like normal again.
Change it to your own code.


Re: OnPlayerDeath :) - ChristianIvann09 - 14.04.2014

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
OnPlayerDeath is called when the player's health is 0 and there is no way to get it back, i suggest adding it under OnPlayerUpdate, get the player's health, if its =< 0.1 Send this!
How to code the If Player Health is 0.1 ?


Re: OnPlayerDeath :) - Hanuman - 14.04.2014

Quote:
Originally Posted by ChristianIvann09
Посмотреть сообщение
How to code the If Player Health is 0.1 ?
pawn Код:
new Float:hp;
GetPlayerHealth(playerid, hp);
if(hp =< 0.1)
{
      //your codes
}



Re: OnPlayerDeath :) - ChristianIvann09 - 14.04.2014

Quote:
Originally Posted by Hanuman
Посмотреть сообщение
pawn Код:
new Float:hp;
GetPlayerHealth(playerid, hp);
if(hp =< 0.1)
{
      //your codes
}
ty