ToggleSpec | SpawnPlayer | OPS called twice bypass
#1

I "HAVE" to use toggple spec and then spawn The Player because i am using setspawn info and the player cannot click the spawn, i don't want them to cause i'm using textdraw is there anyway to bypass OnPlayerSpawn calling twice.... when i use ToggleSpec(id, 0) and then SpawnPlayer ?
Reply
#2

bump
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)