Problem: Player respawning when a player requests class - 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: Problem: Player respawning when a player requests class (
/showthread.php?tid=421665)
Problem: Player respawning when a player requests class -
Maxips2 - 10.03.2013
I've noticed that every time a player connects (and then immidietly calls OnPlayerRequestsClass), players are set back to spawn.
I have a code which skips the class selection, that might cause that but I doubt that.
pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
if(!gCharacterInfo[playerid][characterLoaded])
gPlayerInfo[playerid][playerSkippedClassSelection] = 1;
SetTimerEx("SkipPlayerClassSelection", 1, false, "d", playerid);
return 1;
}
pawn Code:
Function:SkipPlayerClassSelection(playerid)
{
SpawnPlayer(playerid);
TogglePlayerControllable(playerid, 0); // Make sure he can't move.
}
This callback, SkipPlayerClassSelection is actually beinng called for every player, when a player connects.
Maybe there is something that I am missing, but it looks like it should work properly.
Any ideas?
Re: Problem: Player respawning when a player requests class -
Threshold - 10.03.2013
If you're going to use SkipPlayerClassSelection in a timer, it should really be a public function...
Change:
pawn Code:
Function:SkipPlayerClassSelection(playerid)
{
SpawnPlayer(playerid);
TogglePlayerControllable(playerid, 0); // Make sure he can't move.
}
To:
pawn Code:
foward SkipPlayerClassSelection(playerid);i
public SkipPlayerClassSelection(playerid)
{
SpawnPlayer(playerid);
TogglePlayerControllable(playerid, 0); // Make sure he can't move.
}
Re: Problem: Player respawning when a player requests class -
Maxips2 - 10.03.2013
Function is a definition of forwarding and public...
pawn Code:
#define Function:%0(%1) forward %0(%1);public %0(%1)