SA-MP Forums Archive
OnPlayerSpawn called twice? - 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: OnPlayerSpawn called twice? (/showthread.php?tid=526548)



OnPlayerSpawn called twice? - Aerotactics - 18.07.2014





pawn Код:
public OnPlayerSpawn(playerid)
{
    Portal[playerid] = 1;
    PortalType[playerid] = 1;
    SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, 1);
    GivePlayerWeapon(playerid, 27, 99999);
    SendClientMessage(playerid, -1, "You've been given a Portal Gun.");
    print("OnPlayerSpawn called.");
    return 1;
}
NOTE: this is in a filterscript.


Re: OnPlayerSpawn called twice? - Laurey - 18.07.2014

Try using string to return the message?


Re: OnPlayerSpawn called twice? - Aerotactics - 18.07.2014

Quote:
Originally Posted by Laurey
Посмотреть сообщение
Try using string to return the message?
Wouldn't help.


Re: OnPlayerSpawn called twice? - BroZeus - 18.07.2014

dont use SpawnPlayer() and TogglePlayerSpectating() together it is what cazes problem
+ show us ur OnPlayerResqestClass callback if the above method doesnt work


Re: OnPlayerSpawn called twice? - Aerotactics - 18.07.2014

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
dont use SpawnPlayer() and TogglePlayerSpectating() together it is what cazes problem
+ show us ur OnPlayerResqestClass callback if the above method doesnt work
I believe this is the issue, thanks for that catch.


Re : OnPlayerSpawn called twice? - mirou123 - 18.07.2014

OnPlayerSpawn will only be called twice the first time you connect. I had the same problem, if what BroZeus didn't work try making a variable or something To count how many times you have spawned.