Players go to the hospital when they die in a event
#1

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));
Reply
#2

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

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

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);
		}
Reply
#5

What is the problem with that command?
Reply
#6

Код:
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...?
Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)