14.10.2012, 18:45
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate != 2) NOPTrigger[playerid] = 0;
if(IsPlayerNPC(playerid))
{
if(newstate == PLAYER_STATE_SPECTATING)
{
TogglePlayerSpectating(playerid, false);
}
return 1;
}
if(GettingSpectated[playerid] != 999)
{
new spectator = GettingSpectated[playerid];
if(!IsPlayerConnected(spectator))
{
GettingSpectated[playerid] = 999;
Spectate[spectator] = 999;
}
if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[spectator][pAdmin] >= 2 || newstate == PLAYER_STATE_PASSENGER && PlayerInfo[spectator][pAdmin] >= 2)
{
TogglePlayerSpectating(spectator, true);
new carid = GetPlayerVehicleID( playerid );
PlayerSpectateVehicle( spectator, carid );
SetPVarInt(spectator, "SpecState", newstate);
}
else if(newstate == PLAYER_STATE_ONFOOT && PlayerInfo[spectator][pAdmin] >= 2)
{
TogglePlayerSpectating(spectator, true);
PlayerSpectatePlayer( spectator, playerid );
SetPlayerInterior( spectator, GetPlayerInterior( playerid ) );
SetPVarInt(spectator, "SpecState", newstate);
}
}
if(newstate == PLAYER_STATE_ONFOOT)
{
if(Audio_IsClientConnected(playerid))
{
Audio_Stop(playerid, stationidp[playerid]);
stationidp[playerid] = 0;
}