OnplayerDeath
#1

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

Код:
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;
}
}
Reply
#3

wat about timer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)