SA-MP Forums Archive
ForceClassSelection gets called again somehow - 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: ForceClassSelection gets called again somehow (/showthread.php?tid=538628)



ForceClassSelection gets called again somehow - PaYkOK - 22.09.2014

After a player goes off admin duty the script forces his class selection, and if he dies he is prompted into Class Selection again, this happens after the event too...
Код:
.
.
.
case 1: // <------- if hes on duty
{
ForceClassSelection(playerid);
print("force class - command");
TogglePlayerSpectating(playerid, true);
TogglePlayerSpectating(playerid, false);
TPLI[playerid][aduty] = 0;
}
I tried debugging, it gets called normally, it doesn't call it twice...


Re: ForceClassSelection gets called again somehow - DaTa[X] - 22.09.2014

pawn Код:
TogglePlayerSpectating(playerid, true);
TogglePlayerSpectating(playerid, false);
using TogglePlayerSpectating(playerid, true); in OnPlayerRequestClass will call the callback twice i really don't know why yet


Re: ForceClassSelection gets called again somehow - ThePhenix - 22.09.2014

Quote:
Originally Posted by DaTa[X]
Посмотреть сообщение
pawn Код:
TogglePlayerSpectating(playerid, true);
TogglePlayerSpectating(playerid, false);
using TogglePlayerSpectating(playerid, true); in OnPlayerRequestClass will call the callback twice i really don't know why yet
TogglePlayerSpectating false will call OnPlayerSpawn.


Re: ForceClassSelection gets called again somehow - PaYkOK - 23.09.2014

Quote:
Originally Posted by ******
Посмотреть сообщение
The problem is that the player doesn't die, you just return them. ForceClassSelection only resets when you DIE, not when you select a new class. Just add some logic to OnPlayerRequestClass to detect this double call, and spawn them if so.
Thanks for the info, I did that, I really hoped I didn't have to do that, but yeah, works normal now...