Spectate other player after death.
#1

As my title above, I would like to script like this :

When you're lose or death because shooted by enemy, the camera should spectate the enemy for 5 second or until spawn back.
Someone can make script for this??
Reply
#2

That should work.
pawn Код:
public OnPlayerDeath( playerid, killerid, reason )
{
    if( killerid != INVALID_PLAYER_ID ) // if killer is valid player
    {
        TogglePlayerSpectating( playerid, 1 ); // toggle the spectate to enabled for playerid
        PlayerSpectatePlayer( playerid, killerid ); // spectate the killer
        SetTimerEx( "OnPlayerStopSpectate", 5000, false, "i", playerid ); // set a timer that in 5 seconds it will stop spectating
    }
    return 1;
}

forward OnPlayerStopSpectate( playerid );
public OnPlayerStopSpectate( playerid ) // This will be called after 5 seconds the timer has been set
{
    TogglePlayerSpectating( playerid, 0 ); // Toggling the spectate to disabled, player re-spawns automatically
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)