PDA

View Full Version : Problem: Player respawning when a player requests class


Maxips2
10/03/2013, 01:41 PM
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.


public OnPlayerRequestClass(playerid, classid)
{
if(!gCharacterInfo[playerid][characterLoaded])
gPlayerInfo[playerid][playerSkippedClassSelection] = 1;
SetTimerEx("SkipPlayerClassSelection", 1, false, "d", playerid);
return 1;
}



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?

Threshold
10/03/2013, 01:54 PM
If you're going to use SkipPlayerClassSelection in a timer, it should really be a public function...

Change:
Function:SkipPlayerClassSelection(playerid)
{
SpawnPlayer(playerid);
TogglePlayerControllable(playerid, 0); // Make sure he can't move.
}

To:
foward SkipPlayerClassSelection(playerid);i
public SkipPlayerClassSelection(playerid)
{
SpawnPlayer(playerid);
TogglePlayerControllable(playerid, 0); // Make sure he can't move.
}

Maxips2
10/03/2013, 02:07 PM
Function is a definition of forwarding and public...

#define Function:%0(%1) forward %0(%1);public %0(%1)