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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnplayerDeath (/showthread.php?tid=135608)



OnplayerDeath - YoungMoolaBaby.2010 - 21.03.2010

How do i make it so player die he goes to hospital
I had this but when player first login he/she be in hospital
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
			new string[256];
			new cut = deathcost;
			GivePlayerMoney(playerid, -cut);
			format(string, sizeof(string), "DOC: Your Medical Bill comes to $%d, Have a nice day.", cut);
			SendClientMessage(playerid, TEAM_CYAN_COLOR, string);
			MedicBill[playerid] = 0;
			MedicTime[playerid] = 0;
			NeedMedicTime[playerid] = 0;
			PlayerInfo[playerid][pDeaths] += 1;
			SetPlayerHealth(playerid, 50);
 			SetPlayerInterior(playerid, 18);
			SetPlayerPos(playerid, -219.2650,1410.5901,28.8000); // Warp the player
			SetPlayerFacingAngle(playerid, 270.0);
 			TogglePlayerControllable(playerid, 0);
 			LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); // Dieing of Crack
			GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~y~You are recovering from your ~r~wounds~y~...", 35000, 3);
 			MedicTime[playerid] = 1;
			if(PlayerInfo[playerid][pDonateRank] > 0)
			{
 				NeedMedicTime[playerid] = 30;
			}
			else
			{
	  			NeedMedicTime[playerid] = 60;
			}
	  		PlayerPlaySound(playerid, 1062, 0.0, 0.0, 0.0);
	  		SetPlayerPos(playerid,2338.6531,-1256.6045,22.5000);
				return 1;
			}
		}
	}
	if(killerid != 255)
	{
		if(GetPlayerState(killerid) == 2)
		{
			SendClientMessage(killerid, COLOR_YELLOW, "DriveBy Kill, dont abuse it, On foot gets you $$$!");
			return 1;
		}
	}
Please Help Me Its Urgent...



Re: OnplayerDeath - Rac3r - 21.03.2010

Код:
new DidPlayerDie[MAX_PLAYERS];
Код:
public OnPlayerDeath(.....
{
  DidPlayerDie[playerid]=1;
}

public OnPlayerSpawn(.....
{
  if( DidPlayerDie[playerid] )
  {
     DidPlayerDie[playerid]=0;
     SetPlayerPos(playerid, HOSPITAL_X, HOSPITAL_Y, HOSPITAL_Z);
  }
  return 1;
}
}



Re: OnplayerDeath - YoungMoolaBaby.2010 - 21.03.2010

wat about timer