11.09.2013, 18:47
Use OnPlayerStateChange instead. Store the player's ID only, not the vehicle's ID. And when they turn the spectate off, don't forget to set Spectate[id_here] to INVALID_PLAYER_ID.
pawn Код:
public OnPlayerStateChange( playerid, newstate, oldstate )
{
if( newstate == PLAYER_STATE_ONFOOT )
{
for( new i = 0; i < MAX_PLAYERS; i++ )
{
if( !IsPlayerConnected( i ) ) continue;
if( Spectate[ i ] == playerid ) PlayerSpectatePlayer( i, playerid );
}
}
return 1;
}