SA-MP Forums Archive
Setplayerspec/SpawnPlayer once, OnPlayerSpawn being called twice. [REP++] - 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: Setplayerspec/SpawnPlayer once, OnPlayerSpawn being called twice. [REP++] (/showthread.php?tid=436595)



Setplayerspec/SpawnPlayer once, OnPlayerSpawn being called twice. [REP++] - Hoborific - 12.05.2013

Been bothering me for a while, the way I handle peoples weapons and such it doesn't usually bother me but people have been managing to double their ammo by repeatedly logging in/out.

So my question is, why under the circumstances that I toggleplayerspec when they requestclass, show a dialog, then spawn them after the dialog, that they'd spawn twice?


Respuesta: Setplayerspec/SpawnPlayer once, OnPlayerSpawn being called twice. [REP++] - JustBored - 12.05.2013

We are not magician's, give us some code that u think that is wrong or that the bug is there.


Re: Setplayerspec/SpawnPlayer once, OnPlayerSpawn being called twice. [REP++] - Hoborific - 12.05.2013

Alright my new problem I found after fixing this is: If I don't SpawnPlayer() after I TogglePlayerSpectating(), they get kicked, but if I do this, they spawn twice essentially, with double the ammo they should have.

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    TogglePlayerSpectating(playerid,1);
....
        ShowPlayerDialog()
pawn Код:
if(response)
        {
        TogglePlayerSpectating(playerid,0);
        SpawnPlayer(playerid);