Death bug!
#1

Hello all.I have a server but I have a bug on death system.When player die it should be spawned again on the death place and tell him to call ambulance and after sometime if ambulance does not come he will pass out and move to hospital.That thing is not happening.So when player health goes to 0,it automatically goes to hospital.This system is not made by me and i dont know where is the problem with it.I want to ask if you can check the code and tell me where is the problem.I would really appreciate that.Thanks

Code:
Код:
if(GetPVarInt(playerid, "Injured") == 1 && PlayerInfo[playerid][pJustLogged] == 0)
		{
		    SendEMSQueue(playerid,1);
		    return 1;
		}
		if(GetPVarInt(playerid, "IsOnFire") && PlayerInfo[playerid][pJustLogged] != 0)
		{
			TogglePlayerBurning(playerid, false);
			CanPlayerBurn(playerid, 1);
			return 1;
		}
		if(GetPVarInt(playerid, "Injured") == 1 && PlayerInfo[playerid][pJustLogged] != 0)
		{
		    SendEMSQueue(playerid,1);
		    SendClientMessageEx(playerid, COLOR_WHITE, "You have been caught in a death bug, you will be automatically revived in 5 seconds ...");
		    SetTimerEx("AutoRevive", 5000, 0, "i", playerid);
		    return 1;
		}
		if(GetPVarInt(playerid, "MedicBill") == 1 && PlayerInfo[playerid][pJailed] == 0)
		{
			PlayerInfo[playerid][pDuty] = 0;
			PlayerInfo[playerid][pVW] = 0;
			PlayerInfo[playerid][pInt] = 0;
			SetPlayerVirtualWorld(playerid, 0);
			if(IsACop(playerid) || IsALVMPDCop(playerid))
			{
				SendClientMessageEx( playerid, TEAM_CYAN_COLOR, "Hospital: Hospital staff has cleared and discharged you for patrol. Your duty weapons have been returned." );
				SetPlayerWeapons(playerid);
			}
			else
			{
				SendClientMessageEx( playerid, TEAM_CYAN_COLOR, "Hospital: Before you are discharged, hospital staff will confiscate your weapons." );
				ResetPlayerWeapons(playerid);
			}

			if( GetPVarInt( playerid, "EventToken" ) == 1 )
			{
				//SendClientMessageEx( playerid, COLOR_WHITE, "As you've just come from an event, your weapons have been refunded." );
			}

			SetPVarInt(playerid, "MedicBill", 1);
			SetPlayerInterior(playerid, 0);
			new string[70+MAX_PLAYER_NAME];
			if(PlayerInfo[playerid][pInsurance] == 1)
			{
			    if(PlayerInfo[playerid][pWantedLevel] >= 1)
				{
				    SendClientMessageEx(playerid, COLOR_YELLOW, " The police has been warned that you are wanted and they are on their way.");
				    format(string, sizeof(string), " County General Hospital has reported %s as a wanted person.", GetPlayerNameEx(playerid));
				    SendRadioMessage(1, DEPTRADIO, string);
					SendRadioMessage(2, DEPTRADIO, string);
					SendRadioMessage(3, DEPTRADIO, string);
					SendRadioMessage(5, DEPTRADIO, string);
					SendRadioMessage(7, DEPTRADIO, string);
					SendRadioMessage(11, DEPTRADIO, string);
					SendRadioMessage(13, DEPTRADIO, string);
					SendRadioMessage(18, DEPTRADIO, string);
				}
				SetPlayerCameraPos(playerid,1999.5308,-1449.3281,13.5594+6.0);
				SetPlayerCameraLookAt(playerid,2036.2179,-1410.3223,17.1641);
				SetPlayerPos(playerid, 1999.5308,-1449.3281,10.5594);
				SetPVarInt(playerid, "Hospital", 2);
			}
			else if(PlayerInfo[playerid][pInsurance] == 2)
			{
			    if(PlayerInfo[playerid][pWantedLevel] >= 1)
				{
				    SendClientMessageEx(playerid, COLOR_YELLOW, " The police has been warned that you are wanted and they are on their way.");
				    format(string, sizeof(string), " All Saints Hospital has reported %s as a wanted person.", GetPlayerNameEx(playerid));
				    SendRadioMessage(1, DEPTRADIO, string);
					SendRadioMessage(2, DEPTRADIO, string);
					SendRadioMessage(3, DEPTRADIO, string);
					SendRadioMessage(5, DEPTRADIO, string);
					SendRadioMessage(7, DEPTRADIO, string);
					SendRadioMessage(11, DEPTRADIO, string);
					SendRadioMessage(13, DEPTRADIO, string);
					SendRadioMessage(18, DEPTRADIO, string);
				}
				SetPlayerCameraPos(playerid,1188.4574,-1309.2242,13.5625+6.0);
				SetPlayerCameraLookAt(playerid,1175.5581,-1324.7922,18.1610);
				SetPlayerPos(playerid, 1188.4574,-1309.2242,10.5625); // Warp the player
				SetPVarInt(playerid, "Hospital", 1);
			}
			else if(PlayerInfo[playerid][pInsurance] == 3)
			{
			    if(PlayerInfo[playerid][pWantedLevel] >= 1)
				{
				    SendClientMessageEx(playerid, COLOR_YELLOW, " The police has been warned that you are wanted and they are on their way.");
				    format(string, sizeof(string), " Red County Hospital has reported %s as a wanted person.", GetPlayerNameEx(playerid));
				    SendRadioMessage(1, DEPTRADIO, string);
					SendRadioMessage(2, DEPTRADIO, string);
					SendRadioMessage(3, DEPTRADIO, string);
					SendRadioMessage(5, DEPTRADIO, string);
					SendRadioMessage(7, DEPTRADIO, string);
					SendRadioMessage(11, DEPTRADIO, string);
					SendRadioMessage(13, DEPTRADIO, string);
					SendRadioMessage(18, DEPTRADIO, string);
				}
				SetPlayerCameraPos(playerid,1248.4147,338.8385,19.4063+6.0);
				SetPlayerCameraLookAt(playerid,1241.4449,326.3389,19.7555);
				SetPlayerPos(playerid, 1248.4147,338.8385,19.4063);
				SetPVarInt(playerid, "Hospital", 3);
			}
   			else if(PlayerInfo[playerid][pInsurance] == 4)
			{
			    if(PlayerInfo[playerid][pWantedLevel] >= 1)
				{
				    SendClientMessageEx(playerid, COLOR_YELLOW, " The police has been warned that you are wanted and they are on their way.");
				    format(string, sizeof(string), " Fort Carson Hospital has reported %s as a wanted person.", GetPlayerNameEx(playerid));
				    SendRadioMessage(1, DEPTRADIO, string);
					SendRadioMessage(2, DEPTRADIO, string);
					SendRadioMessage(3, DEPTRADIO, string);
					SendRadioMessage(5, DEPTRADIO, string);
					SendRadioMessage(7, DEPTRADIO, string);
					SendRadioMessage(11, DEPTRADIO, string);
					SendRadioMessage(13, DEPTRADIO, string);
					SendRadioMessage(18, DEPTRADIO, string);
				}
				SetPlayerCameraPos(playerid,-314.0242,1060.7919,19.5938+6.0);
				SetPlayerCameraLookAt(playerid,-320.0992,1049.0341,20.3403);
				SetPlayerPos(playerid, -314.0242,1060.7919,19.5938);
				SetPVarInt(playerid, "Hospital", 4);
			}
			else if(PlayerInfo[playerid][pInsurance] == 5)
			{
			    if(PlayerInfo[playerid][pWantedLevel] >= 1)
				{
				    SendClientMessageEx(playerid, COLOR_YELLOW, " The police has been warned that you are wanted and they are on their way.");
				    format(string, sizeof(string), " Las Vegas Medical Center has reported %s as a wanted person.", GetPlayerNameEx(playerid));
				    SendRadioMessage(1, DEPTRADIO, string);
					SendRadioMessage(2, DEPTRADIO, string);
					SendRadioMessage(3, DEPTRADIO, string);
					SendRadioMessage(5, DEPTRADIO, string);
					SendRadioMessage(7, DEPTRADIO, string);
					SendRadioMessage(11, DEPTRADIO, string);
					SendRadioMessage(13, DEPTRADIO, string);
					SendRadioMessage(18, DEPTRADIO, string);
					SendRadioMessage(19, DEPTRADIO, string);
				}
				SetPlayerCameraPos(playerid,-2571.2766,558.7813,68.1754);
				SetPlayerCameraLookAt(playerid,-2619.2883,596.2850,49.0966);
				SetPlayerPos(playerid, -2653.6685,626.6485,4.8930);
				SetPVarInt(playerid, "Hospital", 5);
			}
			else if(PlayerInfo[playerid][pInsurance] == 6)
			{
				SetPlayerCameraPos(playerid,2787.102050, 2392.162841, 1243.898681);
				SetPlayerCameraLookAt(playerid,2801.281982, 2404.575683, 1240.531127);
				SetPlayerPos(playerid, 2788.561523, 2387.321044, 1227.350219);
				SetPVarInt(playerid, "Hospital", 7);
			}
			else if(PlayerInfo[playerid][pInsurance] == 7)
			{
				SetPlayerCameraPos(playerid,2787.102050, 2392.162841, 1243.898681);
				SetPlayerCameraLookAt(playerid,2801.281982, 2404.575683, 1240.531127);
				SetPlayerPos(playerid, 2788.561523, 2387.321044, 1227.350219);
				SetPVarInt(playerid, "Hospital", 8);
			}
			else if(PlayerInfo[playerid][pInsurance] == 8)
			{
			    if(PlayerInfo[playerid][pMember] != 11 && PlayerInfo[playerid][pLeader] != 11)
			    {
			        PlayerInfo[playerid][pInsurance] = 0;
			        SetPlayerSpawn(playerid);
				}
			    new Float:X, Float:Y, Float:Z;
				GetObjectPos(Carrier[0], X, Y, Z);
				SetPlayerCameraPos(playerid,(X-100),(Y-100),30);
				SetPlayerCameraLookAt(playerid,X, Y, Z);
				SetPlayerPos(playerid, (X-0.377671),(Y-10.917018),0);
				SetPVarInt(playerid, "Hospital", 9);
			}
			else if(PlayerInfo[playerid][pInsurance] == 9)
			{
				SetPlayerCameraPos(playerid, -1529.847167, 2539.394042, 62.038913);
				SetPlayerCameraLookAt(playerid, -1514.883300, 2527.161132, 55.743553);
				SetPlayerPos(playerid, -1514.809204, 2526.305175, 51.865501);
				SetPVarInt(playerid, "Hospital", 10);
			}
			else if(PlayerInfo[playerid][pInsurance] == 10)
			{
				if(PlayerInfo[playerid][pMember] != 11 && PlayerInfo[playerid][pLeader] != 11)
			    {
			        PlayerInfo[playerid][pInsurance] = 0;
			        SetPlayerSpawn(playerid);
				}
				SetPlayerPos(playerid, 272.3733,2043.6031,-100.0);
				SetPlayerCameraPos(playerid, 150.1812,2000.4531,51.3394);
				SetPlayerCameraLookAt(playerid, 150.1812,2000.4531,51.3394);
				TogglePlayerControllable(playerid, 0);
				SetPVarInt(playerid, "Hospital", 11);
			}
   			if(PlayerInfo[playerid][pInsurance] == 0)
			{
				new randhos = Random(1,4);
 				switch (randhos)
   				{
    				case 1:
  	    			{
    					if(PlayerInfo[playerid][pWantedLevel] >= 1)
						{
				    		SendClientMessageEx(playerid, COLOR_YELLOW, " The police has been warned that you are wanted and they are on their way.");
				    		format(string, sizeof(string), " All Saints Hospital has reported %s as a wanted person.", GetPlayerNameEx(playerid));
				    		SendRadioMessage(1, DEPTRADIO, string);
							SendRadioMessage(2, DEPTRADIO, string);
							SendRadioMessage(3, DEPTRADIO, string);
							SendRadioMessage(5, DEPTRADIO, string);
							SendRadioMessage(7, DEPTRADIO, string);
							SendRadioMessage(11, DEPTRADIO, string);
							SendRadioMessage(13, DEPTRADIO, string);
							SendRadioMessage(18, DEPTRADIO, string);
						}

						SetPlayerCameraPos(playerid,1188.4574,-1309.2242,13.5625+6.0);
						SetPlayerCameraLookAt(playerid,1175.5581,-1324.7922,18.1610);
						SetPlayerPos(playerid, 1188.4574,-1309.2242,10.5625); // Warp the player
						SetPVarInt(playerid, "Hospital", 6);
  	    			}
    	    		case 2:
	    	    	{
    			    	if(PlayerInfo[playerid][pWantedLevel] >= 1)
						{
				    		SendClientMessageEx(playerid, COLOR_YELLOW, " The police has been warned that you are wanted and they are on their way.");
				    		format(string, sizeof(string), " County General Hospital has reported %s as a wanted person.", GetPlayerNameEx(playerid));
				    		SendRadioMessage(1, DEPTRADIO, string);
							SendRadioMessage(2, DEPTRADIO, string);
							SendRadioMessage(3, DEPTRADIO, string);
							SendRadioMessage(5, DEPTRADIO, string);
							SendRadioMessage(7, DEPTRADIO, string);
							SendRadioMessage(11, DEPTRADIO, string);
							SendRadioMessage(13, DEPTRADIO, string);
							SendRadioMessage(18, DEPTRADIO, string);
						}

						SetPlayerCameraPos(playerid,1999.5308,-1449.3281,13.5594+6.0);
						SetPlayerCameraLookAt(playerid,2036.2179,-1410.3223,17.1641);
						SetPlayerPos(playerid, 1999.5308,-1449.3281,10.5594);
						SetPVarInt(playerid, "Hospital", 2);
   					}
					case 3:
	    	    	{
    			    	if(PlayerInfo[playerid][pWantedLevel] >= 1)
						{
							SendClientMessageEx(playerid, COLOR_YELLOW, " The police has been warned that you are wanted and they are on their way.");
							format(string, sizeof(string), " Las Vegas Medical Center has reported %s as a wanted person.", GetPlayerNameEx(playerid));
							SendRadioMessage(1, DEPTRADIO, string);
							SendRadioMessage(2, DEPTRADIO, string);
							SendRadioMessage(3, DEPTRADIO, string);
							SendRadioMessage(5, DEPTRADIO, string);
							SendRadioMessage(7, DEPTRADIO, string);
							SendRadioMessage(11, DEPTRADIO, string);
							SendRadioMessage(13, DEPTRADIO, string);
							SendRadioMessage(18, DEPTRADIO, string);
							SendRadioMessage(19, DEPTRADIO, string);
						}

						SetPlayerCameraPos(playerid,-2571.2766,558.7813,68.1754);
						SetPlayerCameraLookAt(playerid,-2619.2883,596.2850,49.0966);
						SetPlayerPos(playerid, -2653.6685,626.6485,4.8930);
						SetPVarInt(playerid, "Hospital", 12);
   					}
   				}
			}

			TogglePlayerControllable(playerid, 0);
			SetPlayerHealth(playerid, 0.5);
			SetPVarInt(playerid, "HospitalTimer", 30);
			SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_HOSPITALTIMER);
			return 1;
		}
		if(GetPVarInt(playerid, "FirstSpawn") == 1 && GetPVarInt(playerid, "Hospital") == 0)
		{
			SetPlayerPos(playerid,PlayerInfo[playerid][pPos_x],PlayerInfo[playerid][pPos_y],PlayerInfo[playerid][pPos_z]);
			//PlayerInfo[playerid][pInterior] = PlayerInfo[playerid][pInt];
			SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
			SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPos_r]);
			SetPlayerInterior(playerid,PlayerInfo[playerid][pInt]);
			SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
			SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
			SetCameraBehindPlayer(playerid);
			if(PlayerInfo[playerid][pInt] > 0)
			{
			    TogglePlayerControllable(playerid, 0);
			    GameTextForPlayer(playerid, "Objects loading...", 4000, 5);
			    SetPVarInt(playerid, "LoadingObjects", 1);
			    SetTimerEx("SafeLoadObjects", 4000, 0, "d", playerid);
		    }
		}
		else if(GetPVarInt(playerid, "FirstSpawn") == 1 && GetPVarInt(playerid, "Hospital") != 0)
		{
		    PlayerInfo[playerid][pDuty] = 0;
			PlayerInfo[playerid][pVW] = 0;
			PlayerInfo[playerid][pInt] = 0;
			SetPlayerVirtualWorld(playerid, 0);
			if( GetPVarInt( playerid, "EventToken" ) == 1 )
			{
				//SendClientMessageEx( playerid, COLOR_WHITE, "As you've just come from an event, your weapons have been refunded." );
			}
			else
			{
				ResetPlayerWeaponsEx(playerid);
			}

			SetPVarInt(playerid, "MedicBill", 1);
			new string[70+MAX_PLAYER_NAME];
			if(PlayerInfo[playerid][pInsurance] == 1)
			{
			    if(PlayerInfo[playerid][pWantedLevel] >= 1)
				{
				    SendClientMessageEx(playerid, COLOR_YELLOW, "The police have been informed of your current location and are on their way.");
				    format(string, sizeof(string), " County General Hospital has reported %s as a wanted person.", GetPlayerNameEx(playerid));
				    SendRadioMessage(1, DEPTRADIO, string);
					SendRadioMessage(2, DEPTRADIO, string);
					SendRadioMessage(3, DEPTRADIO, string);
					SendRadioMessage(5, DEPTRADIO, string);
					SendRadioMessage(7, DEPTRADIO, string);
					SendRadioMessage(11, DEPTRADIO, string);
					SendRadioMessage(13, DEPTRADIO, string);
					SendRadioMessage(18, DEPTRADIO, string);
				}
				SetPlayerCameraPos(playerid,1999.5308,-1449.3281,13.5594+6.0);
				SetPlayerCameraLookAt(playerid,2036.2179,-1410.3223,17.1641);
				SetPlayerPos(playerid, 1999.5308,-1449.3281,10.5594);
				SetPVarInt(playerid, "Hospital", 2);
			}
			else if(PlayerInfo[playerid][pInsurance] == 2)
			{
			    if(PlayerInfo[playerid][pWantedLevel] >= 1)
				{
				    SendClientMessageEx(playerid, COLOR_YELLOW, "The police have been informed of your current location and are on their way.");
				    format(string, sizeof(string), " All Saints Hospital has reported %s as a wanted person.", GetPlayerNameEx(playerid));
				    SendRadioMessage(1, DEPTRADIO, string);
					SendRadioMessage(2, DEPTRADIO, string);
					SendRadioMessage(3, DEPTRADIO, string);
					SendRadioMessage(5, DEPTRADIO, string);
					SendRadioMessage(7, DEPTRADIO, string);
					SendRadioMessage(11, DEPTRADIO, string);
					SendRadioMessage(13, DEPTRADIO, string);
					SendRadioMessage(18, DEPTRADIO, string);
				}
				SetPlayerCameraPos(playerid,1188.4574,-1309.2242,13.5625+6.0);
				SetPlayerCameraLookAt(playerid,1175.5581,-1324.7922,18.1610);
				SetPlayerPos(playerid, 1188.4574,-1309.2242,10.5625); // Warp the player
				SetPVarInt(playerid, "Hospital", 1);
			}
			else if(PlayerInfo[playerid][pInsurance] == 3)
			{
			    if(PlayerInfo[playerid][pWantedLevel] >= 1)
				{
				    SendClientMessageEx(playerid, COLOR_YELLOW, "The police have been informed of your current location and are on their way.");
				    format(string, sizeof(string), " Red County Hospital has reported %s as a wanted person.", GetPlayerNameEx(playerid));
				    SendRadioMessage(1, DEPTRADIO, string);
					SendRadioMessage(2, DEPTRADIO, string);
					SendRadioMessage(3, DEPTRADIO, string);
					SendRadioMessage(5, DEPTRADIO, string);
					SendRadioMessage(7, DEPTRADIO, string);
					SendRadioMessage(11, DEPTRADIO, string);
					SendRadioMessage(13, DEPTRADIO, string);
					SendRadioMessage(18, DEPTRADIO, string);
				}
				SetPlayerCameraPos(playerid,1248.4147,338.8385,19.4063+6.0);
				SetPlayerCameraLookAt(playerid,1241.4449,326.3389,19.7555);
				SetPlayerPos(playerid, 1248.4147,338.8385,19.4063);
				SetPVarInt(playerid, "Hospital", 3);
			}
   			else if(PlayerInfo[playerid][pInsurance] == 4)
			{
			    if(PlayerInfo[playerid][pWantedLevel] >= 1)
				{
				    SendClientMessageEx(playerid, COLOR_YELLOW, "The police have been informed of your current location and are on their way.");
				    format(string, sizeof(string), " Fort Carson Hospital has reported %s as a wanted person.", GetPlayerNameEx(playerid));
				    SendRadioMessage(1, DEPTRADIO, string);
					SendRadioMessage(2, DEPTRADIO, string);
					SendRadioMessage(3, DEPTRADIO, string);
					SendRadioMessage(5, DEPTRADIO, string);
					SendRadioMessage(7, DEPTRADIO, string);
					SendRadioMessage(11, DEPTRADIO, string);
					SendRadioMessage(13, DEPTRADIO, string);
					SendRadioMessage(18, DEPTRADIO, string);
				}
				SetPlayerCameraPos(playerid,-314.0242,1060.7919,19.5938+6.0);
				SetPlayerCameraLookAt(playerid,-320.0992,1049.0341,20.3403);
				SetPlayerPos(playerid, -314.0242,1060.7919,19.5938);
				SetPVarInt(playerid, "Hospital", 4);
			}
			else if(PlayerInfo[playerid][pInsurance] == 5)
			{
			    if(PlayerInfo[playerid][pWantedLevel] >= 1)
				{
				    SendClientMessageEx(playerid, COLOR_YELLOW, " The police has been warned that you are wanted and they are on their way.");
				    format(string, sizeof(string), " Las Vegas Medical Center has reported %s as a wanted person.", GetPlayerNameEx(playerid));
				    SendRadioMessage(1, DEPTRADIO, string);
					SendRadioMessage(2, DEPTRADIO, string);
					SendRadioMessage(3, DEPTRADIO, string);
					SendRadioMessage(5, DEPTRADIO, string);
					SendRadioMessage(7, DEPTRADIO, string);
					SendRadioMessage(11, DEPTRADIO, string);
					SendRadioMessage(13, DEPTRADIO, string);
					SendRadioMessage(18, DEPTRADIO, string);
					SendRadioMessage(19, DEPTRADIO, string);
				}
				SetPlayerCameraPos(playerid,-2571.2766,558.7813,68.1754);
				SetPlayerCameraLookAt(playerid,-2619.2883,596.2850,49.0966);
				SetPlayerPos(playerid, -2653.6685,626.6485,4.8930);
				SetPVarInt(playerid, "Hospital", 5);
			}
			else if(PlayerInfo[playerid][pInsurance] == 6)
			{
				SetPlayerCameraPos(playerid,2787.102050, 2392.162841, 1243.898681);
				SetPlayerCameraLookAt(playerid,2801.281982, 2404.575683, 1240.531127);
				SetPlayerPos(playerid, 2788.561523, 2387.321044, 1227.350219);
				SetPVarInt(playerid, "Hospital", 7);
			}
			else if(PlayerInfo[playerid][pInsurance] == 7)
			{
				SetPlayerCameraPos(playerid,2787.102050, 2392.162841, 1243.898681);
				SetPlayerCameraLookAt(playerid,2801.281982, 2404.575683, 1240.531127);
				SetPlayerPos(playerid, 2788.561523, 2387.321044, 1227.350219);
				SetPVarInt(playerid, "Hospital", 8);
			}
			else if(PlayerInfo[playerid][pInsurance] == 8)
			{
			    new Float:X, Float:Y, Float:Z;
				GetObjectPos(Carrier[0], X, Y, Z);
				SetPlayerCameraPos(playerid,(X-100),(Y-100),30);
				SetPlayerCameraLookAt(playerid,X, Y, Z);
				SetPlayerPos(playerid, (X-0.377671),(Y-10.917018),0);
				SetPVarInt(playerid, "Hospital", 9);
			}
			else if(PlayerInfo[playerid][pInsurance] == 9)
			{
				SetPlayerCameraPos(playerid, -1529.847167, 2539.394042, 62.038913);
				SetPlayerCameraLookAt(playerid, -1514.883300, 2527.161132, 55.743553);
				SetPlayerPos(playerid, -1514.809204, 2526.305175, 51.865501);
				SetPVarInt(playerid, "Hospital", 10);
			}
   			if(PlayerInfo[playerid][pInsurance] == 0)
			{
				new randhos = Random(1,3);
 				switch(randhos)
   				{
    				case 1:
  	    			{
    					if(PlayerInfo[playerid][pWantedLevel] >= 1)
						{
				    		SendClientMessageEx(playerid, COLOR_YELLOW, " The police has been warned that you are wanted and they are on their way.");
				    		format(string, sizeof(string), " All Saints Hospital has reported %s as a wanted person.", GetPlayerNameEx(playerid));
				    		SendRadioMessage(1, DEPTRADIO, string);
							SendRadioMessage(2, DEPTRADIO, string);
							SendRadioMessage(3, DEPTRADIO, string);
							SendRadioMessage(5, DEPTRADIO, string);
							SendRadioMessage(7, DEPTRADIO, string);
							SendRadioMessage(11, DEPTRADIO, string);
							SendRadioMessage(13, DEPTRADIO, string);
							SendRadioMessage(18, DEPTRADIO, string);
						}

						SetPlayerCameraPos(playerid,1188.4574,-1309.2242,13.5625+6.0);
						SetPlayerCameraLookAt(playerid,1175.5581,-1324.7922,18.1610);
						SetPlayerPos(playerid, 1188.4574,-1309.2242,10.5625); // Warp the player
						SetPVarInt(playerid, "Hospital", 6);
  	    			}
    	    		case 2:
	    	    	{
    			    	if(PlayerInfo[playerid][pWantedLevel] >= 1)
						{
				    		SendClientMessageEx(playerid, COLOR_YELLOW, " The police has been warned that you are wanted and they are on their way.");
				    		format(string, sizeof(string), " County General Hospital has reported %s as a wanted person.", GetPlayerNameEx(playerid));
				    		SendRadioMessage(1, DEPTRADIO, string);
							SendRadioMessage(2, DEPTRADIO, string);
							SendRadioMessage(3, DEPTRADIO, string);
							SendRadioMessage(5, DEPTRADIO, string);
							SendRadioMessage(7, DEPTRADIO, string);
							SendRadioMessage(11, DEPTRADIO, string);
							SendRadioMessage(13, DEPTRADIO, string);
							SendRadioMessage(18, DEPTRADIO, string);
						}

						SetPlayerCameraPos(playerid,1999.5308,-1449.3281,13.5594+6.0);
						SetPlayerCameraLookAt(playerid,2036.2179,-1410.3223,17.1641);
						SetPlayerPos(playerid, 1999.5308,-1449.3281,10.5594);
						SetPVarInt(playerid, "Hospital", 2);
   					}
   				}
			}
			TogglePlayerControllable(playerid, 0);
			SetPlayerHealth(playerid, 0.5);
			SetPVarInt(playerid, "HospitalTimer", 30);
			SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_HOSPITALTIMER);
		}
		new Float: x, Float: y, Float: z;
		GetPlayerPos(playerid, x, y, z);
		if(x == 0.0 && y == 0.0)
		{
  			SetPlayerInterior(playerid,0);
			SetPlayerPos(playerid, 1715.1201,-1903.1711,13.5665);
			SetPlayerFacingAngle(playerid, 359.4621);
			SetCameraBehindPlayer(playerid);
		}
		SetPlayerToTeamColor(playerid);
		return 1;
	}
	return 1;
}//------------------------------------------------------------------------------------------------------

HospitalSpawn(playerid)
{
	if(GetPVarInt(playerid, "MedicBill") == 1 && PlayerInfo[playerid][pJailed] == 0)
	{
		if(GetPVarInt(playerid, "Hospital") == 1 && PlayerInfo[playerid][pInsurance] == 2)
		{
			SetPlayerArmour(playerid, PlayerInfo[playerid][pSHealth]);
			SetPlayerHealth(playerid, 50.0);
			DeletePVar(playerid, "MedicBill");
			GivePlayerCash(playerid, -1500);
			SendClientMessageEx(playerid, TEAM_CYAN_COLOR, "Hospital: Your Medical Bill comes to $1,500, Have a nice day.");
			SetPlayerPos(playerid, 1175.0586,-1324.2463,14.5938);
			SetPlayerFacingAngle(playerid, 268.9748);
            DeletePVar(playerid, "Hospital");
			SetCameraBehindPlayer(playerid);
			TogglePlayerControllable(playerid, 1);
		}
		else if(GetPVarInt(playerid, "Hospital") == 2 && PlayerInfo[playerid][pInsurance] == 1)
		{
			SetPlayerArmour(playerid, PlayerInfo[playerid][pSHealth]);
			SetPlayerHealth(playerid, 50.0);
			DeletePVar(playerid, "MedicBill");
			GivePlayerCash(playerid, -1500);
			SendClientMessageEx(playerid, TEAM_CYAN_COLOR, "Hospital: Your Medical Bill comes to $1,500, Have a nice day.");
			SetPlayerPos(playerid, 2034.2269,-1404.3459,17.2617);
			SetPlayerFacingAngle(playerid, 179.4258);
			DeletePVar(playerid, "Hospital");
			SetCameraBehindPlayer(playerid);
			TogglePlayerControllable(playerid, 1);
		}
		else if(GetPVarInt(playerid, "Hospital") == 3 && PlayerInfo[playerid][pInsurance] == 3)
		{
			SetPlayerArmour(playerid, PlayerInfo[playerid][pSHealth]);
			SetPlayerHealth(playerid, 50.0);
			DeletePVar(playerid, "MedicBill");
			GivePlayerCash(playerid, -500);
			SendClientMessageEx(playerid, TEAM_CYAN_COLOR, "Hospital: Your Medical Bill comes to $500, Have a nice day.");
			SetPlayerPos(playerid, 1241.4888,325.9947,19.7555);
			SetPlayerFacingAngle(playerid, 345.0);
			DeletePVar(playerid, "Hospital");
			SetCameraBehindPlayer(playerid);
			TogglePlayerControllable(playerid, 1);
		}
		else if(GetPVarInt(playerid, "Hospital") == 4 && PlayerInfo[playerid][pInsurance] == 4)
		{
			SetPlayerArmour(playerid, PlayerInfo[playerid][pSHealth]);
			SetPlayerHealth(playerid, 50.0);
			DeletePVar(playerid, "MedicBill");
			GivePlayerCash(playerid, -1500);
			SendClientMessageEx(playerid, TEAM_CYAN_COLOR, "Hospital: Your Medical Bill comes to $1500, Have a nice day.");
			SetPlayerPos(playerid, 1175.0586,-1324.2463,14.5938);
			SetPlayerFacingAngle(playerid, 268.9748);
			DeletePVar(playerid, "Hospital");
			SetCameraBehindPlayer(playerid);
			TogglePlayerControllable(playerid, 1);
		}
		else if(GetPVarInt(playerid, "Hospital") == 5 && PlayerInfo[playerid][pInsurance] == 5)
		{
			SetPlayerArmour(playerid, PlayerInfo[playerid][pSHealth]);
			SetPlayerHealth(playerid, 50.0);
			DeletePVar(playerid, "MedicBill");
			GivePlayerCash(playerid, -1500);
			SendClientMessageEx(playerid, TEAM_CYAN_COLOR, "Hospital: Your Medical Bill comes to $1500, Have a nice day.");
			SetPlayerPos(playerid, 1175.0586,-1324.2463,14.5938);
			SetPlayerFacingAngle(playerid, 268.9748);
			DeletePVar(playerid, "Hospital");
			SetCameraBehindPlayer(playerid);
			TogglePlayerControllable(playerid, 1);
		}
		else if(GetPVarInt(playerid, "Hospital") == 6 && PlayerInfo[playerid][pInsurance] == 0)
		{
			SetPlayerArmour(playerid, PlayerInfo[playerid][pSHealth]);
			SetPlayerHealth(playerid, 50.0);
			DeletePVar(playerid, "MedicBill");
			GivePlayerCash(playerid, -2000);
			SendClientMessageEx(playerid, TEAM_CYAN_COLOR, "Hospital: Your Medical Bill comes to $2,000, Have a nice day.");
			GameTextForPlayer( playerid, "~w~You are presently uninsured, ~n~buy insurance!", 5000, 6 );
			SendClientMessageEx( playerid, COLOR_WHITE, "(( Look for the insurance points next to each hospital. Type /insurehelp for more details. ))" );
			SetPlayerPos(playerid, 1175.0586,-1324.2463,14.5938);
			SetPlayerFacingAngle(playerid, 268.9748);
			DeletePVar(playerid, "Hospital");
			SetCameraBehindPlayer(playerid);
			TogglePlayerControllable(playerid, 1);

		}
		else if(GetPVarInt(playerid, "Hospital") == 2 && PlayerInfo[playerid][pInsurance] == 0)
		{
			SetPlayerArmour(playerid, PlayerInfo[playerid][pSHealth]);
			SetPlayerHealth(playerid, 50.0);
			DeletePVar(playerid, "MedicBill");
			GivePlayerCash(playerid, -2000);
			SendClientMessageEx(playerid, TEAM_CYAN_COLOR, "Hospital: Your Medical Bill comes to $2,000, Have a nice day.");
			GameTextForPlayer( playerid, "~w~You are presently uninsured, ~n~buy insurance!", 5000, 6 );
			SendClientMessageEx( playerid, COLOR_WHITE, "(( Look for the insurance points next to each hospital. Type /insurehelp for more details. ))" );
			SetPlayerPos(playerid, 2034.2269,-1404.3459,17.2617);
			SetPlayerFacingAngle(playerid, 179.4258);
			DeletePVar(playerid, "Hospital");
			SetCameraBehindPlayer(playerid);
			TogglePlayerControllable(playerid, 1);

		}
		else if(GetPVarInt(playerid, "Hospital") == 12 && PlayerInfo[playerid][pInsurance] == 0)
		{
			SetPlayerArmour(playerid, PlayerInfo[playerid][pSHealth]);
			SetPlayerHealth(playerid, 50.0);
			DeletePVar(playerid, "MedicBill");
			GivePlayerCash(playerid, -2000);
			SendClientMessageEx(playerid, TEAM_CYAN_COLOR, "Hospital: Your Medical Bill comes to $2,000, Have a nice day.");
			GameTextForPlayer( playerid, "~w~You are presently uninsured, ~n~buy insurance!", 5000, 6 );
			SendClientMessageEx( playerid, COLOR_WHITE, "(( Look for the insurance points next to each hospital. Type /insurehelp for more details. ))" );
			SetPlayerPos(playerid, 1175.0586,-1324.2463,14.5938);
			SetPlayerFacingAngle(playerid, 268.9748);
			DeletePVar(playerid, "Hospital");
			SetCameraBehindPlayer(playerid);
			TogglePlayerControllable(playerid, 1);

		}
		else if(GetPVarInt(playerid, "Hospital") == 7 && PlayerInfo[playerid][pInsurance] == 6)
		{
			SetPlayerArmour(playerid, PlayerInfo[playerid][pSHealth]);
			SetPlayerHealth(playerid, 50.0);
			DeletePVar(playerid, "MedicBill");
			GivePlayerCash(playerid, -1500);
			SendClientMessageEx(playerid, TEAM_CYAN_COLOR, "Hospital: Your Medical Bill comes to $1500, Have a nice day.");
			SetPlayerPos(playerid, 1175.0586,-1324.2463,14.5938);
			SetPlayerFacingAngle(playerid, 268.9748);
			SetPlayerInterior(playerid, 1);
			DeletePVar(playerid, "Hospital");
			SetCameraBehindPlayer(playerid);
			TogglePlayerControllable(playerid, 1);
		}
		else if(GetPVarInt(playerid, "Hospital") == 8 && PlayerInfo[playerid][pInsurance] == 7)
		{
			SetPlayerArmour(playerid, PlayerInfo[playerid][pSHealth]);
			SetPlayerHealth(playerid, 50.0);
			DeletePVar(playerid, "MedicBill");
			GivePlayerCash(playerid, -1500);
			SendClientMessageEx(playerid, TEAM_CYAN_COLOR, "Hospital: Your Medical Bill comes to $1500, Have a nice day.");
			SendClientMessageEx(playerid, COLOR_YELLOW, "Platinum VIP: You have spawned at your home.");

			for(new i = 0; i < sizeof(HouseInfo); i++)
            {
				if(PlayerInfo[playerid][pPhousekey] == i || PlayerInfo[playerid][pPhousekey2] == i)
				{
					Streamer_UpdateEx(playerid, HouseInfo[i][hInteriorX],HouseInfo[i][hInteriorY],HouseInfo[i][hInteriorZ]);
					SetPlayerInterior(playerid,HouseInfo[i][hHInteriorWorld]);
					if(HouseInfo[i][hCustomInterior] == 1)
					{
		    			TogglePlayerControllable(playerid, 0);
		        		GameTextForPlayer(playerid, "Loading Objects.", 4000, 5);
		    			SetPVarInt(playerid, "LoadingObjects", 1);
		    			SetTimerEx("SafeLoadObjects", 4000, 0, "d", playerid);
      				}
					SetPlayerPos(playerid,HouseInfo[i][hInteriorX],HouseInfo[i][hInteriorY],HouseInfo[i][hInteriorZ]);
					GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
					PlayerInfo[playerid][pInt] = HouseInfo[i][hHInteriorWorld];
					PlayerInfo[playerid][pLocal] = i+6000;
					PlayerInfo[playerid][pVW] = i+6000;
					SetPlayerVirtualWorld(playerid, i+6000);
				}
			}

			DeletePVar(playerid, "Hospital");
			SetCameraBehindPlayer(playerid);
			TogglePlayerControllable(playerid, 1);
		}
		else if(GetPVarInt(playerid, "Hospital") == 9 && PlayerInfo[playerid][pInsurance] == 8)
		{
		    if(PlayerInfo[playerid][pMember] != 11 && PlayerInfo[playerid][pLeader] != 11)
		    {
		        PlayerInfo[playerid][pInsurance] = 0;
		        HospitalSpawn(playerid);
			}
			SetPlayerArmour(playerid, PlayerInfo[playerid][pSHealth]);
			SetPlayerHealth(playerid, 50.0);
			DeletePVar(playerid, "MedicBill");
			SendClientMessageEx(playerid, TEAM_CYAN_COLOR, "Hospital: Have a nice day.");
			new Float:X, Float:Y, Float:Z;
			GetObjectPos(Carrier[0], X, Y, Z);
			SetPlayerPos(playerid, (X-0.377671),(Y-10.917018),11.6986);
			SetPlayerFacingAngle(playerid, 0);
			DeletePVar(playerid, "Hospital");
			SetCameraBehindPlayer(playerid);
			TogglePlayerControllable(playerid, 1);
		}
		else if(GetPVarInt(playerid, "Hospital") == 10 && PlayerInfo[playerid][pInsurance] == 9)
		{
			SetPlayerArmour(playerid, PlayerInfo[playerid][pSHealth]);
			SetPlayerHealth(playerid, 50.0);
			DeletePVar(playerid, "MedicBill");
			GivePlayerCash(playerid, -1500);
			SendClientMessageEx(playerid, TEAM_CYAN_COLOR, "Hospital: Your Medical Bill comes to $1500, Have a nice day.");
			SetPlayerPos(playerid, 1175.0586,-1324.2463,14.5938);
			SetPlayerFacingAngle(playerid, 268.9748);
			DeletePVar(playerid, "Hospital");
			SetCameraBehindPlayer(playerid);
			TogglePlayerControllable(playerid, 1);
		}
		else if(GetPVarInt(playerid, "Hospital") == 11 && PlayerInfo[playerid][pInsurance] == 10)
		{
  			if(PlayerInfo[playerid][pMember] != 11 && PlayerInfo[playerid][pLeader] != 11)
		    {
		        PlayerInfo[playerid][pInsurance] = 0;
		        HospitalSpawn(playerid);
			}
			SetPlayerArmour(playerid, PlayerInfo[playerid][pSHealth]);
			SetPlayerHealth(playerid, 50.0);
			SendClientMessageEx(playerid, TEAM_CYAN_COLOR, "Hospital: Your Medical Bill is free of charge, Have a nice day.");
			SetPlayerPos(playerid, 1175.0586,-1324.2463,14.5938);
			SetPlayerFacingAngle(playerid, 0);
			SetPlayerPos(playerid, 1175.0586,-1324.2463,14.5938);
			DeletePVar(playerid, "Hospital");
			SetCameraBehindPlayer(playerid);
			TogglePlayerControllable(playerid, 1);
		}
	}
}

public OnPlayerDeath(playerid, killerid, reason)
{
	PlayerInfo[playerid][pOverdose] = 0;

    new string[128];
    // Anti-Fake Kill by Neonman
	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;
	}
	if(IsPlayerConnected(killerid))
	{
		new hour,minute,second, weaponname[32];
		gettime(hour,minute,second);
		FixHour(hour);
		hour = shifthour;
		GetWeaponName(reason, weaponname, sizeof(weaponname));
		format(PlayerInfo[playerid][pKillLog9], 256, "%s", PlayerInfo[playerid][pKillLog8]);
		format(PlayerInfo[playerid][pKillLog8], 256, "%s", PlayerInfo[playerid][pKillLog7]);
		format(PlayerInfo[playerid][pKillLog7], 256, "%s", PlayerInfo[playerid][pKillLog6]);
		format(PlayerInfo[playerid][pKillLog6], 256, "%s", PlayerInfo[playerid][pKillLog5]);
		format(PlayerInfo[playerid][pKillLog5], 256, "%s", PlayerInfo[playerid][pKillLog4]);
		format(PlayerInfo[playerid][pKillLog4], 256, "%s", PlayerInfo[playerid][pKillLog3]);
		format(PlayerInfo[playerid][pKillLog3], 256, "%s", PlayerInfo[playerid][pKillLog2]);
		format(PlayerInfo[playerid][pKillLog2], 256, "%s", PlayerInfo[playerid][pKillLog1]);
		format(PlayerInfo[playerid][pKillLog1], 256, "%s", PlayerInfo[playerid][pKillLog0]);
	 	format(PlayerInfo[playerid][pKillLog0], 256, "(%d:%d:%d) %s killed me with %s", hour,minute,second,GetPlayerNameEx(killerid), weaponname);

	 	format(PlayerInfo[killerid][pKillLog9], 256, "%s", PlayerInfo[killerid][pKillLog8]);
		format(PlayerInfo[killerid][pKillLog8], 256, "%s", PlayerInfo[killerid][pKillLog7]);
		format(PlayerInfo[killerid][pKillLog7], 256, "%s", PlayerInfo[killerid][pKillLog6]);
		format(PlayerInfo[killerid][pKillLog6], 256, "%s", PlayerInfo[killerid][pKillLog5]);
		format(PlayerInfo[killerid][pKillLog5], 256, "%s", PlayerInfo[killerid][pKillLog4]);
		format(PlayerInfo[killerid][pKillLog4], 256, "%s", PlayerInfo[killerid][pKillLog3]);
		format(PlayerInfo[killerid][pKillLog3], 256, "%s", PlayerInfo[killerid][pKillLog2]);
		format(PlayerInfo[killerid][pKillLog2], 256, "%s", PlayerInfo[killerid][pKillLog1]);
		format(PlayerInfo[killerid][pKillLog1], 256, "%s", PlayerInfo[killerid][pKillLog0]);
	 	format(PlayerInfo[killerid][pKillLog0], 256, "(%d:%d:%d) Killed %s with %s", hour,minute,second,GetPlayerNameEx(playerid), weaponname);
	 	if(GetPVarInt(killerid, "IsInArena") == 0) PlayerInfo[killerid][pDMKills]++;
	}
	pTazer[playerid] = 0;
	InsideShamal[playerid] = INVALID_VEHICLE_ID;
	DeletePVar(playerid, "SpeedRadar");
    DeletePVar(playerid, "UsingSprunk");
	if(arr_Wrecking[playerid] != INVALID_VEHICLE_ID)
	{
		//UnwreckVehicle(arr_Wrecking[playerid], 1);
		arr_Wrecking[playerid] = INVALID_VEHICLE_ID;
	}
	DestroyDynamicObject(GetPVarInt(playerid, "neon"));
	DestroyDynamicObject(GetPVarInt(playerid, "neon1"));
	DeletePVar(playerid, "neon0");
	DeletePVar(playerid, "neon1");
    KillTimer(GetPVarInt(playerid, "firstaid5"));
  	DeletePVar(playerid, "usingfirstaid");
	DeletePVar(playerid, "usingbandage");
	if(GetPVarInt(playerid, "MovingStretcher") != -1)
	{
	    KillTimer(GetPVarInt(playerid, "TickEMSMove"));
	    DeletePVar(GetPVarInt(playerid, "MovingStretcher"), "OnStretcher");
	    SetPVarInt(playerid, "MovingStretcher", -1);
	}
	if(GetPVarInt(playerid, "runningRadar") >= 1)
	{
		new vehid = gLastCar[playerid];
		if(CheckingSpeed[vehid] > 0)
	    {
	        KillTimer(CheckingSpeed[vehid]);
	        CheckingSpeed[vehid] = 0;
	    }
		PlayerTextDrawDestroy(playerid, RadarHud);
		PlayerTextDrawDestroy(playerid, SpeedAndModel);
		DeletePVar(playerid, "runningRadar");
		Radars -= 1;
	}
	new caller = Mobile[playerid];
	if(IsPlayerConnected(Mobile[playerid]))
	{
		SendClientMessageEx(caller,  COLOR_GRAD2, "The line went dead.");
		format(string, sizeof(string), "* %s puts away their cellphone.", GetPlayerNameEx(caller));
		ProxDetector(30.0, caller, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		CellTime[caller] = 0;
		KillTimer(VmailTmer[caller]);
		KillTimer(VmailTmer[playerid]);
		Mobile[caller] = INVALID_PLAYER_ID;
	}
	Mobile[playerid] = INVALID_PLAYER_ID;
	CellTime[playerid] = 0;
	KillTimer(VmailTmer[playerid]);
	KillTimer(VmailTmer[caller]);
	RingTone[playerid] = 0;

	foreach(Player, i)
	{
		if(EMSAccepted[i] < 999)
		{
 			if(EMSAccepted[i] == playerid)
   			{
     			EMSAccepted[i] = 999;
       			GameTextForPlayer(i, "~w~EMS Caller~n~~r~Has Died", 5000, 1);
	        	EMSCallTime[i] = 0;
	        	DisablePlayerCheckpoint(i);
			}
		}
	}

	if( GetPVarInt(playerid, "SpecOff" ) == 1 )
	{
		SpawnPlayer(playerid);
		return 1;
	}

	if(GetPVarInt(playerid, "Injured") == 1)
	{
     	SendClientMessageEx(playerid, COLOR_WHITE, "You appear to be stuck in limbo, medics are trying to revive you.");
	    KillEMSQueue(playerid);
	    ResetPlayerWeaponsEx(playerid);
		if(GetPVarInt(playerid, "activesling") > 0)
		{
			DeletePVar(playerid, "activesling");
		}
	    //SpawnPlayer(playerid);
	    return 1;
	}
	if(GetPVarInt(playerid, "IsOnFire"))
	{
		TogglePlayerBurning(playerid, false);
		return 1;
	}
	new Float:px,Float:py,Float:pz;
	if(GetPVarInt(playerid, "EventToken") == 0)
	{
	    if(GetPVarInt(playerid, "IsInArena") == -1)
		{
			SetPVarInt(playerid, "Injured", 1);

			new Float:mX, Float:mY, Float:mZ;
			GetPlayerPos(playerid, mX, mY, mZ);

			SetPVarFloat(playerid, "MedicX", mX);
			SetPVarFloat(playerid, "MedicY", mY);
			SetPVarFloat(playerid, "MedicZ", mZ);
			SetPVarInt(playerid, "MedicVW", GetPlayerVirtualWorld(playerid));
			SetPVarInt(playerid, "MedicInt", GetPlayerInterior(playerid));
		}
	}
	gPlayerSpawned[playerid] = 0;
	if(GetPVarInt(playerid, "IsInArena") >= 0)
	{
	    if(GetPVarInt(playerid, "AOSlotPaintballFlag") != -1)
	    {
     		switch(PlayerInfo[playerid][pPaintTeam])
       		{
         		case 1:
           		{
					DropFlagPaintballArena(playerid, GetPVarInt(playerid, "IsInArena"), 2);
     			}
        		case 2:
          		{
            		DropFlagPaintballArena(playerid, GetPVarInt(playerid, "IsInArena"), 1);
            	}
        	}
	    }
		if(reason >= 0 && reason <= 46)
		{
		    new weapon[24];
		    PlayerInfo[killerid][pKills] += 1;
		    PlayerInfo[playerid][pDeaths] += 1;
			if(PlayerInfo[killerid][pPaintTeam] == 1)
			{
			    if(PlayerInfo[killerid][pPaintTeam] == PlayerInfo[playerid][pPaintTeam])
			    {
			        PaintBallArena[GetPVarInt(killerid, "IsInArena")][pbTeamRedKills] -= 1;
			        PaintBallArena[GetPVarInt(playerid, "IsInArena")][pbTeamBlueKills] += 1;
			        SetPlayerHealth(killerid, 0);
			        PlayerInfo[killerid][pKills] -= 2;
			        PlayerInfo[killerid][pDeaths] += 1;
		    		PlayerInfo[playerid][pDeaths] -= 1;
			        SendClientMessageEx(killerid, COLOR_WHITE, "You have been warned, do not team-kill!");
			    }
			    else
			    {
		    		PaintBallArena[GetPVarInt(killerid, "IsInArena")][pbTeamRedKills] += 1;
		    		PaintBallArena[GetPVarInt(playerid, "IsInArena")][pbTeamBlueDeaths] += 1;
				}
			}
			if(PlayerInfo[killerid][pPaintTeam] == 2)
			{
			    if(PlayerInfo[killerid][pPaintTeam] == PlayerInfo[playerid][pPaintTeam])
			    {
			        PaintBallArena[GetPVarInt(killerid, "IsInArena")][pbTeamBlueKills] -= 1;
			        PaintBallArena[GetPVarInt(playerid, "IsInArena")][pbTeamRedKills] += 1;
			        SetPlayerHealth(killerid, 0);
			        PlayerInfo[killerid][pKills] -= 2;
			        PlayerInfo[killerid][pDeaths] += 1;
		    		PlayerInfo[playerid][pDeaths] -= 1;
			        SendClientMessageEx(killerid, COLOR_WHITE, "You have been warned, do not team-kill!");
			    }
		    	PaintBallArena[GetPVarInt(killerid, "IsInArena")][pbTeamBlueKills] += 1;
		    	PaintBallArena[GetPVarInt(playerid, "IsInArena")][pbTeamRedDeaths] += 1;
			}
		    GetWeaponName(reason,weapon,sizeof(weapon));
			if(reason == 0)
			{
			    if(PaintBallArena[GetPVarInt(killerid, "IsInArena")][pbTimeLeft] < 12)
			    {
			        GivePlayerCash(killerid, 1000);
			        format(string,sizeof(string),"[Paintball Arena] %s has earned $1000 bonus for a sudden death kill!",GetPlayerNameEx(killerid));
					SendPaintballArenaMessage(GetPVarInt(killerid,"IsInArena"), COLOR_YELLOW, string);
			    }
	    		format(string,sizeof(string),"[Paintball Arena] %s has killed %s with their bare hands!",GetPlayerNameEx(killerid),GetPlayerNameEx(playerid));
			}
			else
			{
			    if(PaintBallArena[GetPVarInt(killerid, "IsInArena")][pbTimeLeft] < 12)
			    {
			        GivePlayerCash(killerid, 1000);
			        format(string,sizeof(string),"[Paintball Arena] %s has earned $1000 bonus for a sudden death kill!",GetPlayerNameEx(killerid));
					SendPaintballArenaMessage(GetPVarInt(killerid,"IsInArena"), COLOR_YELLOW, string);
			    }
			    format(string,sizeof(string),"[Paintball Arena] %s has killed %s with a %s.",GetPlayerNameEx(killerid),GetPlayerNameEx(playerid),weapon);
			}
		}
		else
		{
		    PlayerInfo[playerid][pDeaths] += 1;
			format(string,sizeof(string),"[Paintball Arena] %s has died.",GetPlayerNameEx(playerid));
		}
	    SendPaintballArenaMessage(GetPVarInt(playerid,"IsInArena"), COLOR_RED, string);
	}
	PlayerInfo[playerid][pLocal] = 255;
	GetPlayerPos(playerid, px, py, pz);

	if(GetPVarInt(playerid, "Injured") == 0)
	{
		if( GetPVarInt(playerid, "EventToken") >= 1 || GetPVarInt(playerid, "IsInArena") >= 0)
		{
			ResetPlayerWeapons(playerid);
		}
		else
		{
			ResetPlayerWeaponsEx(playerid);
		}
	}
	if(PlayerInfo[killerid][pAdmin] < 2)
	{
	    if(reason == 49)
	    {
			format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just car-parked the shit out of %s (ID %d) to death.", GetPlayerNameEx(killerid), killerid, GetPlayerNameEx(playerid), playerid);
	    	ABroadCast(COLOR_YELLOW, string, 2);
	    	print(string);

	    }
	    if(reason == 50)
	    {
	        if(IsAHelicopter(GetPlayerVehicleID(killerid)))
	        {
	    		format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just blade-killed the shit out of %s (ID %d).", GetPlayerNameEx(killerid), killerid, GetPlayerNameEx(playerid), playerid);
	    		ABroadCast(COLOR_YELLOW, string, 2);
	    		print(string);
	    	}
	    	else
	    	{
	    	    if(GetPlayerWeapon(killerid) != 32 || GetPlayerWeapon(killerid) != 28 || GetPlayerWeapon(killerid) != 29)
	    	    {
					format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just car-parked the shit out of %s (ID %d) to death.", GetPlayerNameEx(killerid), killerid, GetPlayerNameEx(playerid), playerid);
	    			ABroadCast(COLOR_YELLOW, string, 2);
	    			print(string);
	    		}
	    		else
	    		{
					format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) has possibly just driver-shot the shit out of %s (ID %d) to death.", GetPlayerNameEx(killerid), killerid, GetPlayerNameEx(playerid), playerid);
	    			ABroadCast(COLOR_YELLOW, string, 2);
	    			print(string);
	    		}
	    	}
	    }
	}
	if (gPlayerCheckpointStatus[playerid] > 4 && gPlayerCheckpointStatus[playerid] < 11)
	{
		DisablePlayerCheckpoint(playerid);
		gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
	}
	if(HaveGPS[playerid])
	{
		KillTimer(GPSTimer[playerid]);
		HaveGPS[playerid] = false;
		GPSTimer[playerid] = 0;
	}

	ClearCrime(playerid);
	if(PlayerInfo[playerid][pHeadValue] >= 1)
	{
		if(IsPlayerConnected(killerid))
		{
			if(GoChase[killerid] == playerid)
			{
				new killer[MAX_PLAYER_NAME],
					name[MAX_PLAYER_NAME], ID;

				new takemoney = PlayerInfo[playerid][pHeadValue] / 4 * 2;
			 	name = GetPlayerNameEx(playerid);
				killer = GetPlayerNameEx(killerid);
				GivePlayerCash(killerid, takemoney);
				sscanf(PlayerInfo[playerid][pContractBy],"u",ID);
				if(!IsPlayerConnected(ID))
				{
				    OnPlayerOfflineLogin(PlayerInfo[playerid][pContractBy]);
					PlayerInfo[MAX_PLAYERS][pAccount] -= takemoney;
					OnPlayerOfflineSave(PlayerInfo[playerid][pContractBy]);
				}
				else
				{
					format(string, sizeof(string), "Hitman %s has fulfilled the contract on %s and you have paid them $%d.",killer,name,takemoney);
					SendClientMessageEx(ID, COLOR_YELLOW, string);
					GivePlayerCash(ID, -takemoney);
				}
				format(string,128,"Hitman %s has fulfilled the contract on %s and collected $%d.",killer,name,PlayerInfo[playerid][pHeadValue] / 4 * 2);
				SendFamilyMessage(8, COLOR_YELLOW, string);
				format(string,128,"You have been critically injured by a hitman.",takemoney);
   				ResetPlayerWeaponsEx(playerid);
				// SpawnPlayer(playerid);
				SendClientMessageEx(playerid, COLOR_YELLOW, string);
				// KillEMSQueue(playerid);
				PlayerInfo[playerid][pHeadValue] = 0;
				PlayerInfo[killerid][pCHits] += 1;
				GotHit[playerid] = 0;
				GetChased[playerid] = 999;
				GoChase[killerid] = 999;
			}
		}
	}
	if(IsPlayerConnected(killerid))
 	{
		if(GoChase[playerid] == killerid)
		{
			new killer[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
			new takemoney = PlayerInfo[playerid][pHeadValue] / 4 * 2;
			GivePlayerCash(killerid, takemoney);
			name = GetPlayerNameEx(playerid);
			killer = GetPlayerNameEx(killerid);
			format(string,128,"Hitman %s has failed the contract on %s and lost $%d.",name,killer,PlayerInfo[killerid][pHeadValue] / 4 * 2);
			SendFamilyMessage(8, COLOR_YELLOW, string);
			GivePlayerCash(playerid, -takemoney);
		   	format(string,128,"You have just killed a hitman and gained $%d, removing the contact on your head.",PlayerInfo[killerid][pHeadValue] / 4 * 2);
			SendClientMessageEx(killerid, COLOR_YELLOW, string);
			PlayerInfo[killerid][pHeadValue] = 0;
			PlayerInfo[playerid][pFHits] += 1;
			GotHit[playerid] = 0;
			GetChased[killerid] = 999;
			GoChase[playerid] = 999;
		}
	}
	killerid = INVALID_PLAYER_ID;
	SetPlayerColor(playerid,TEAM_HIT_COLOR);
	return 1;
}
Код:
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;
}
Please help me!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)