Namechange OnPlayerConnect
#2

The way I get around any upon-connect issues (saw Simon do it years ago and I started, aswell):
This will wait with any actions until the player is fully connected.
pawn Код:
new
    bool:g_IsFullyConnected[ MAX_PLAYERS char ]
;

public OnPlayerConnect( playerid )
{
    if ( g_IsFullyConnected{ playerid } )
    {
        // do stuff ..
    }
}

public OnPlayerDisconnect( playerid, reason )
{
    g_IsFullyConnected{ playerid } = false;
}

public OnPlayerRequestClass( playerid, classid )
{
    if ( !g_IsFullyConnected{ playerid } )
    {
        g_IsFullyConnected{ playerid } = true;
       
        OnPlayerConnect( playerid );
    }
   
    // do stuff ..
    // don't forget to return 1/0
}

public OnPlayerRequestSpawn( playerid ) // Players that are in class selection during gmx/time out won't request a class upon reconnecting. That's why I use OnPlayerRequestSpawn.
{
    if ( !g_IsFullyConnected{ playerid } )
    {
        g_IsFullyConnected{ playerid } = true;
       
        OnPlayerConnect( playerid );
    }
   
    // do stuff ..
    // don't forget to return 1/0
}
Reply


Messages In This Thread
Namechange OnPlayerConnect - by Lenny the Cup - 18.10.2010, 09:14
Re: Namechange OnPlayerConnect - by Slice - 18.10.2010, 11:28
Re: Namechange OnPlayerConnect - by Lenny the Cup - 18.10.2010, 20:52
Re: Namechange OnPlayerConnect - by Macluawn - 10.11.2010, 18:05
Re: Namechange OnPlayerConnect - by Lenny the Cup - 10.11.2010, 19:36

Forum Jump:


Users browsing this thread: 1 Guest(s)