SA-MP Forums Archive
When Dieing going straight to hospital problem - 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: When Dieing going straight to hospital problem (/showthread.php?tid=498098)



When Dieing going straight to hospital problem - FutureGenerationGaming - 02.03.2014

Okay so ive been trying to figure this out when i die i goto the hospital right away. I have the /service ems and i have FD on and it dont work still.

Heres the code to Death and EMS;

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	PlayerInfo[playerid][pOverdose] = 0;
	
    new string[128];
    // Anti-Fake Kill by Nick Mirra
	if(PlayerInfo[playerid][pAdmin] < 2)
	{
		new time = gettime();
	    switch(time - LastDeath[playerid])
	    {
	        case 0..3:
	        {
	            DeathSpam[playerid]++;
	            if(DeathSpam[playerid] == 3) // The maximum spam of deaths after the cheater will get banned.
	            {
	                new IP[128];
	                GetPlayerIp(playerid, IP, sizeof(IP));
	                format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has been automatically kicked for death spamming.", GetPlayerNameEx(playerid), playerid);
					ABroadCast(COLOR_YELLOW, string, 2);
	            
	                format(string, sizeof(string), "[Death Spam] %s has been kicked for death spam. (IP: %s)",GetPlayerNameEx(playerid), playerid, IP);
	                Log("logs/fakedeath.log", string);
	            
	               	ShowPlayerDialog(playerid, DIALOG_SHOW_INFO, DIALOG_STYLE_MSGBOX, "{FFFFFF}Kicked from server", "You have been kicked from the server for fake kill.", "Ok", "Cancel");
                    SetTimerEx("SendToKick", 300, 0, "i", playerid);
	            }
	            return 1;
	        }
	        default: DeathSpam[playerid] = 0;
	    }
	    LastDeath[playerid] = time;
Heres the EMS Code;

Код:
public KillEMSQueue(playerid)
{
    DeletePVar(playerid, "Injured");
    DeletePVar(playerid, "EMSAttempt");
	SetPVarInt(playerid, "MedicBill", 1);
	DeletePVar(playerid, "MedicCall");

	return 1;
}

forward SendEMSQueue(playerid,type);
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) Player_StreamPrep(playerid, GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"), 4000);
			GameTextForPlayer(playerid, "~r~Injured~n~~w~ /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: When Dieing going straight to hospital problem - FutureGenerationGaming - 02.03.2014

Any Help?


Re: When Dieing going straight to hospital problem - FalconWingsX - 02.03.2014

You should try checking at OnPlayerSpawn if the player is injured, if it is true, set the players position to the location of death and setting the animation


Re: When Dieing going straight to hospital problem - NEXT0LIFE0RP - 02.04.2014

Try changing playerspawn