Problem with spectating
#1

I made this
Код:
//-----------------------------death
new Plookingforkiller[MAX_PLAYERS];
new death[MAX_PLAYERS];
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
       if(IsPlayerInDM[playerid] != 0)
		{
		GetPlayerName(killerid, name, sizeof(name));
		format(string, sizeof(string), "%s has killed you", name );
		GameTextForPlayer(playerid, string, 3000, 4);
		SetCameraBehindPlayer(killerid);
		TogglePlayerControllable(playerid, 0);
		Plookingforkiller[playerid] = 1;
  	    }
}
Код:
public OnPlayerSpawn(playerid)
{
if (Plookingforkiller[playerid]==1)
  {
  death[playerid] = SetTimerEx("deathspec", 3000, false, "i", playerid);
  Plookingforkiller[playerid]=0;
  }
}
Код:
forward deathspec(playerid);
public deathspec(playerid)
{
	TogglePlayerControllable(playerid, 1);
	SetCameraBehindPlayer(playerid);
}
It should spectate your killer for 3 seconds and then returning to normal, but when I'm killed or I suicide, my game crashes.
Reply
#2

SetCameraBehindPlayer(killerid);
TogglePlayerControllable(playerid, 0);

SetCameraBehindPlayer(killerid) only affects the person that is the killer.

Why are you using TogglePlayerControllable(playerid,0) if the player is dead and can't move anyway?

and do a check to make sure killerid != 255 incase the player killed himself or died of other means.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)