SA-MP Forums Archive
Namechange OnPlayerConnect - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: Namechange OnPlayerConnect (/showthread.php?tid=184128)



Namechange OnPlayerConnect - Lenny the Cup - 18.10.2010

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


Re: Namechange OnPlayerConnect - Slice - 18.10.2010

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
}



Re: Namechange OnPlayerConnect - Lenny the Cup - 18.10.2010

Yes, I'm just reporting it here


Re: Namechange OnPlayerConnect - Macluawn - 10.11.2010

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


Re: Namechange OnPlayerConnect - Lenny the Cup - 10.11.2010

Yes Maclauwn, I wrote that.