22.05.2015, 18:15
Hello, I have this to save the position of the admin when you use /spec, so when you use /specoff as set in the position it was before using /spec.
OnPlayerConnect
OnPlayerSpawn
/spec
/specoff
But when you use /specoff the admin returns to spawn as if he had died, why? What is wrong?
PHP код:
new
Float: Save_Position[ MAX_PLAYERS ][ 4 ],
bool: InSpectate[ MAX_PLAYERS ]
;
PHP код:
Save_Position[ playerid ][ 0 ] = 0.0;
Save_Position[ playerid ][ 1 ] = 0.0;
Save_Position[ playerid ][ 2 ] = 0.0;
Save_Position[ playerid ][ 3 ] = 0.0;
InSpectate[ playerid ] = false;
PHP код:
if( InSpectate[ playerid ] )
{
SetPlayerPos( playerid, Save_Position[ playerid ][ 0 ], Save_Position[ playerid ][ 1 ], Save_Position[ playerid ][ 2 ] );
SetPlayerFacingAngle( playerid, Save_Position[ playerid ][ 3 ] );
InSpectate[ playerid ] = false;
}
PHP код:
new SpecID[MAX_PLAYERS];
new id;
new string[44];
GetPlayerPos( playerid, Save_Position[ playerid ][ 0 ], Save_Position[ playerid ][ 1 ], Save_Position[ playerid ][ 2 ] );
GetPlayerFacingAngle( playerid, Save_Position[ playerid ][ 3 ] );
InSpectate{ playerid } = true;
TogglePlayerSpectating(playerid, 1);
SpecID[playerid] = id;
return 1;
PHP код:
TogglePlayerSpectating(playerid, 0);
SetPlayerPos( playerid, Save_Position[ playerid ][ 0 ], Save_Position[ playerid ][ 1 ], Save_Position[ playerid ][ 2 ] );
return 1;