Problem: Player respawning when a player requests class
#1

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?
Reply
#2

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.
}
Reply
#3

Function is a definition of forwarding and public...

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


Forum Jump:


Users browsing this thread: 1 Guest(s)