SA-MP Forums Archive
Players go to the hospital when they die in a event - 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: Players go to the hospital when they die in a event (/showthread.php?tid=206500)



Players go to the hospital when they die in a event - Mr. Despair - 04.01.2011

I'm having this issue with players joining the event and when they get killed by another player, they end up getting sent to the hospital instead of being sent back to where they were when they /join'ed the event. I want when they die, they go back to where they join'ed the event with their guns and whatever HP and Armor they had.

This is my OnPlayerDeath

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
//   printf("OnPlayerDeath: playerid: %d, killerid: %d, reason: %s", playerid, killerid, reason); //debug
    ClearGuns(playerid);
    SetPlayerColor(playerid, TCOLOR_HOSPITAL);
    SetPlayerVirtualWorld(playerid, 0);
    PlayerInfo[playerid][pOnDuty] = 0;
    PlayerInfo[playerid][pBombs] = 0;
    PlayerInfo[playerid][pScope] = 0;
    PlayerInfo[playerid][pLocal] = 999;
    PlayerInfo[playerid][pVirtualWorld] = 0;
    PlayerInfo[killerid][pKills] += 1;
    CapturingTimer[playerid] = 0;
    STDPlayer[playerid] = 0;
    IsAtEvent[playerid] = 0;
	new name[MAX_PLAYER_NAME];
	new killa[MAX_PLAYER_NAME];
	new string[128];
	new caller = Mobile[playerid];
	GetPlayerName(playerid, name, sizeof(name));
	GetPlayerName(killerid, killa, sizeof(killa));



Re: Players go to the hospital when they die in a event - ToPhrESH - 04.01.2011

You have IsAtEvent[playerid] = 0. Well then when you have on playerdeath you do this
pawn Код:
public OnPlayerDeath
{
     if(IsAtEvent[playerid] == 0)
     {
          SetPlayerPos(); //Use your coords for event
          //Also but all the script that you want to happen when they spawn at the event
      }
     else(IsAtEvent[playerid] == 1)
     {
          SetPlayerPos(); //Use your outside event spawn positions here
     }
};
Now tell me if this works or not ..


Re: Players go to the hospital when they die in a event - Mr. Despair - 04.01.2011

I want them to go back to the position where they typed "/joinevent", not just a desginated coordinate


Re: Players go to the hospital when they die in a event - Mr. Despair - 04.01.2011

What's wrong with this command? I'm putting it below OnPlayerDeath...

Код:
if(IsAtEvent[playerid] == 1)
     {
        SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
		SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
		SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
		SetPlayerPos(playerid, PlayerInfo[playerid][pEventj_x], PlayerInfo[playerid][pEventj_y], PlayerInfo[playerid][pEventj_z]);
		SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);
		SetCameraBehindPlayer(playerid);
		}



Re: Players go to the hospital when they die in a event - ToPhrESH - 04.01.2011

What is the problem with that command?


Re: Players go to the hospital when they die in a event - Mr. Despair - 04.01.2011

Код:
if(IsAtEvent[playerid] == 1)
     {
        SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
		SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
		SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
		SetPlayerPos(playerid, PlayerInfo[playerid][pEventj_x], PlayerInfo[playerid][pEventj_y], PlayerInfo[playerid][pEventj_z]);
		SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);
		SetCameraBehindPlayer(playerid);
		}
It just doesn't work. I get the event set up and I /joinevent and I /kill and I still get sent to the hospital...?


Re: Players go to the hospital when they die in a event - ToPhrESH - 04.01.2011

Quote:
Originally Posted by Mr. Despair
Посмотреть сообщение
Код:
if(IsAtEvent[playerid] == 1)
     {
        SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
		SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
		SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
		SetPlayerPos(playerid, PlayerInfo[playerid][pEventj_x], PlayerInfo[playerid][pEventj_y], PlayerInfo[playerid][pEventj_z]);
		SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);
		SetCameraBehindPlayer(playerid);
		}
It just doesn't work. I get the event set up and I /joinevent and I /kill and I still get sent to the hospital...?
Try using DisableTeleports(playerid); in the OnPlayerDeath too