SA-MP Forums Archive
Spectator Question. - 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)
+--- Thread: Spectator Question. (/showthread.php?tid=428083)



Spectator Question. - faff - 04.04.2013

Hello,
If a player Die's, He will Spectate his killer.
But, How to add something, if the player clicks on the right mouse button, he will switch to the next Player that's ''alive''..
And if he presses the lft Mouse button, he will switch to the Previous player That's '''Alive''?


Re: Spectator Question. - RajatPawar - 04.04.2013

pawn Код:
new killer[ MAX_PLAYERS ];
public OnPlayerDeath(playerid, killerid, /* params */)
{
    killer[ playerid ] = killerid;
    TogglePlayerSpectating( playerid, killerid ) ..
    return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
   if( IsPlayerDead )
   {
      if( newkeys & KEY_WHATEVER_YOU_WANT
             TogglePlayerSpectate( killer[ playerid ] + 1, 1 );
      ..
    }
return 1;
}