SA-MP Forums Archive
Code Executed 2 Times - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Code Executed 2 Times (/showthread.php?tid=370013)



Code Executed 2 Times - Healian - 18.08.2012

pawn Код:
if(pInfo[playerid][prSTEP] >= 3)
    {
        if(FirstTimerSpawn[playerid] == 1)
        {
            SetPlayerInterior(playerid, 0);
            SetPlayerPos(playerid, 1612.3240, -2330.1670, 13.5469);
            FirstTimerSpawn[playerid] = 0;
            setPlayerStats(playerid);
        }
        else if(FirstTimerSpawn[playerid] == 0)
        {
            SetPlayerPos(playerid, pInfo[playerid][pX], pInfo[playerid][pY], pInfo[playerid][pZ]);
            setPlayerStats(playerid);  
            SendClientMessage(playerid, COL_RED, "Message");
        }
        return 0;
    }
    return 1;
The Code Abouve is my onplayerspawn code



Please Tell My Why


Re: Code Executed 2 Times - ikkentim - 18.08.2012

The code, i suppose is in another function, that function is triggered twice.


Re: Code Executed 2 Times - playbox12 - 18.08.2012

Are you calling TogglePlayerSpectating before spawning the player? It calls OnPlayerSpawn automatically, use a variable to check for it.


Re: Code Executed 2 Times - Healian - 18.08.2012

i calling TogglePlayerSpectating right before player spawn yea

my god you are right !!!! i was calling TogglePlayerSpectating and spawn player +REP for you