SetPlayerName Bug?
#9

I've found that OnPlayerConnect can be dodgy to do client code in sometimes. One thing I'd suggest to try is move your code to the first OnPlayerRequestClass call.

I personally do not do code in OnPlayerConnect until the player has seen the class selection, as I've had 'not fully connected' problems before. You could try something like this to 'resolve' the issue:

pawn Код:
new
    bool:g_abPlayerFullyConnected[MAX_PLAYERS],
    bool:g_abPlayerSeenClassSelect[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    // Maybe put your variable resetting here, it depends on your
    // script.

    // Halt the code, the player is not fully connected.
    if (!g_abPlayerFullyConnected[playerid])
        return 1;

    // The rest of your code here, most definately try putting SetPlayerName
    // here.
}

public OnPlayerRequestClass(playerid, classid)
{
    g_abPlayerFullyConnected[playerid] = true;

    if (!g_abPlayerSeenClassSelect[playerid])
    {
        g_abPlayerSeenClassSelect[playerid] = true;

        // This will now call the OnPlayerConnect function and it will not 'halt'
        OnPlayerConnect(playerid);
    }

    // The rest of your code here.
}

public OnPlayerDisconnect(playerid, reason)
{
    g_abPlayerFullyConnected[playerid] = false;
    g_abPlayerSeenClassSelect[playerid] = false;

    // Your code here.
}
Reply


Messages In This Thread
SetPlayerName Bug? - by XGh0stz - 11.10.2010, 22:40
Re: SetPlayerName Bug? - by Lenny the Cup - 11.10.2010, 23:45
Re: SetPlayerName Bug? - by XGh0stz - 12.10.2010, 08:21
Re: SetPlayerName Bug? - by Rachael - 12.10.2010, 08:46
Re: SetPlayerName Bug? - by Lenny the Cup - 12.10.2010, 10:13
Re: SetPlayerName Bug? - by XGh0stz - 12.10.2010, 13:11
Re: SetPlayerName Bug? - by Rachael - 12.10.2010, 14:08
Re: SetPlayerName Bug? - by XGh0stz - 13.10.2010, 05:37
Re: SetPlayerName Bug? - by Simon - 13.10.2010, 07:01
Re: SetPlayerName Bug? - by Rachael - 13.10.2010, 07:48

Forum Jump:


Users browsing this thread: 7 Guest(s)