Kick(playerid) function bug?
#2

Kick function used under OnPlayerConnect has got some issue. I doubt it's because Kick function is called before server accepting the client completely. All you've to do is to delay the kick or the best thing is to use delayed OnPlayerConnect.

pawn Код:
new
     g_PlayerOPCTimer[MAX_PLAYERS] = {-1, ...};

public OnPlayerConnect(playerid) {

    if(g_PlayerOPCTimer[playerid] == -1)
        g_PlayerOPCTimer[playerid] = SetTimerEx("SafeOnPlayerConnect", 300, false, "i", playerid);
    return 1;
}

forward SafeOnPlayerConnect(playerid);

public SafeOnPlayerConnect(playerid) {

    g_PlayerOPCTimer[playerid] = -1;
    if(!IsPlayerConnected(playerid)) return 1; //It has got a 300ms delay, it's possible to loose connection in that delay.
    //codes
    return 1;
}
Reply


Messages In This Thread
Kick(playerid) function bug? - by RaeF - 19.04.2015, 04:36
Re: Kick(playerid) function bug? - by Lordzy - 19.04.2015, 04:44
Re: Kick(playerid) function bug? - by RaeF - 19.04.2015, 04:47

Forum Jump:


Users browsing this thread: 1 Guest(s)