Namechange OnPlayerConnect
#1

The connecting client does not notice a namechange (SetPlayerName) that occurs OnPlayerConnect, maybe because it isn't fully connected until after the function is called and thereby isn't "notified" about it.

I'll put it in the wiki
Reply
#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
#3

Yes, I'm just reporting it here
Reply
#4

Quote:

Important Note: If you set the player's name to the same name, expect different case latters (ie "heLLO" to "hello") it will not work. If used OnPlayerConnect, the new name will not be shown for the connecting player.
quote from samp wiki
Reply
#5

Yes Maclauwn, I wrote that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)