ToggleSpec | SpawnPlayer | OPS called twice bypass
#3

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];
Reply


Messages In This Thread
ToggleSpec | SpawnPlayer | OPS called twice bypass - by trapstar2020 - 31.05.2014, 18:45
Re: ToggleSpec | SpawnPlayer | OPS called twice bypass - by trapstar2020 - 01.06.2014, 01:41
Re: ToggleSpec | SpawnPlayer | OPS called twice bypass - by Threshold - 01.06.2014, 03:41

Forum Jump:


Users browsing this thread: 1 Guest(s)