01.06.2014, 03:41
Example:
pawn Код:
CMD:spec(playerid, params[])
{
//...
TogglePlayerSpectating(playerid, true);
//....
return 1;
}
CMD:specoff(playerid, params[])
{
//...
TogglePlayerSpectating(playerid, false); //At this point, OnPlayerSpawn will be called.
PreviousSpectate[playerid] = true; //This will let the script know that the player was previously spectating someone
return 1;
}
public OnPlayerSpawn(playerid)
{
if(PreviousSpectate[playerid]) return 1; //At the top of OnPlayerSpawn
//...
return 1;
}
public OnPlayerConnect(playerid)
{
PreviousSpectate[playerid] = false; //At the top of OnPlayerConnect, so it doesn't bug your OnPlayerSpawn.
//...
return 1;
}
//At the top of your script:
new bool:PreviousSpectate[MAX_PLAYERS];