Help with this very confusing problem
#1

I edited Admantis second life script

I created 3 values for a variable IsDead, It checks if player is in which state (2= Alive, 1= Waiting treatment (injured) 0 = hospital)

So my first function when player is dead is
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
 new Float:pX22, Float:pY22, Float:pZ22;
 GetPlayerPos(playerid, pX22, pY22, pZ22);
 PlayerInfo[playerid][pDeathPosX] = pX22;
 PlayerInfo[playerid][pDeathPosY] = pY22;
 PlayerInfo[playerid][pDeathPosZ] = pZ22;
  if(PlayerInfo[playerid][pIsDead] == 2)
  {
    PlayerInfo[playerid][pIsDead] = 1;
  }
  if(PlayerInfo[playerid][pIsDead] == 0)
  {
   Some script here..
	return 1;
  }
  return 1;
}
Код:
	if(newstate == PLAYER_STATE_WASTED) //PLAYER DIES
	{
	    if(PlayerInfo[playerid][pJailed] == 1)
	    {
		   if(PlayerInfo[playerid][pIsDead] == 0)
		   {
			  PlayerInfo[playerid][pHospital] = 1;
		   }
		   if(PlayerInfo[playerid][pIsDead] == 2)
		   {
            PlayerInfo[playerid][pIsDead] = 1;
		   }
	    }
	}
And under onplayerspawn
Код:
		if(PlayerInfo[playerid][pIsDead] == 1)
		{
            SetPlayerPos(playerid,PlayerInfo[playerid][pDeathPosX],PlayerInfo[playerid][pDeathPosY],PlayerInfo[playerid][pDeathPosZ]);
            SetPlayerCameraPos(playerid,PlayerInfo[playerid][pDeathPosX],PlayerInfo[playerid][pDeathPosY],PlayerInfo[playerid][pDeathPosX]+5);
            SetPlayerCameraLookAt(playerid,PlayerInfo[playerid][pDeathPosX],PlayerInfo[playerid][pDeathPosY],PlayerInfo[playerid][pDeathPosZ]);
            TogglePlayerControllable(playerid, 0);
            ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0);
            SetTimerEx("AutoDeath",AUTODEATH_SECONDS * 1000,false,"i",playerid);
            SendClientMessage(playerid,CYAN,"------------------ Health Advise -----------------");
            SendClientMessage(playerid,WHITE,"You are wounded badly.");
            SendClientMessage(playerid,WHITE,"Do /service EMS For calling medics.");
            SendClientMessage(playerid,WHITE,"You can type /acceptdeath, if no medics are available.");
            SendClientMessage(playerid,CYAN,"--------------------------------------------------------");
		}
And the function SetPlayerinhospital puts player in some co-ordinates and camera e.t.c , Ok but when the player dies, He just spawns at the place he died and he can move, SendClientMessage (such as You are wounded badly) doesnt work, Any ideas? Please help it is major problme
Reply
#2

pawn Код:
GetPlayerPos(playerid, pX22, pY22, pZ22);
PlayerInfo[playerid][pDeathPosX] = pX22;
PlayerInfo[playerid][pDeathPosY] = pY22;
PlayerInfo[playerid][pDeathPosZ] = pZ22;
pawn Код:
SetPlayerPos(playerid,PlayerInfo[playerid][pDeathPosX],PlayerInfo[playerid][pDeathPosY],PlayerInfo[playerid][pDeathPosZ]);
When you death, you save the player's current position.
When they spawn, you set it back.

Also I can't see the function SetPlayerinhospital...
Reply
#3

No need to see SetPlayerinhospital function, bcuz i explained it, and it is not called up at all at the first place
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)