[0.3x] OnGameModeExit & OnPlayerConnect & Others Bugs
#1

At 0.3x:
  • OnGameModeExit - Can't be performed.
  • OnPlayerConnect - Client can't be kicked.
At 0.3e and older versions:
  • OnGameModeExit - Performed.
  • OnPlayerConnect - Client can be kicked.
So... May fix it?

#Edit 1:

At 0.3x:

Код:
SendClientMessage(playerid,0xFFFFFFFF,"Message");
Kick(playerid);
Client can't see anything and is kicked.

At 0.3e and older versions:

Код:
SendClientMessage(playerid,0xFFFFFFFF,"Message");
Kick(playerid);
Client see everything and is kicked.
Reply
#2

I have same problem, I solved it with timer first show message, then after 1 sek kick...
Reply
#3

It's not a bug!

It's been coded, so when Kick or ban is called, it will automatically close the connection, because of some "hack" attempt or whatever, To fix this, just make a 500ms timer and then use your own ban/kick function

Cheers!
Reply
#4

This should fix that issue.

pawn Код:
/In order to display a message (eg. reason) for the player before the connection is closed you have to use a delay:
 
forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }
 
stock KickWithMessage(playerid, message[])
{
    SendClientMessage(playerid, 0xFF4444FF, message);
    SetTimerEx("KickPublic", 1000, 0, "d", playerid);   //Delay of 1 second before kicking the player so he recieves the message
}
 
//Sample Usage
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/kickme", true) == 0)
    {
        //Kicks the player who the executed this command
        KickWithMessage(playerid, "You have been kicked.");
        return 1;
    }
    return 0;
}
//by Kye
Reply
#5

Yeah that helped me. Thanks man!
Reply
#6

Sorry for reviving the topic, but I have a serious problem in my onplayerconnect, moreover, is not just me. Use the game mode PPC_Trucking, with enough updates, but the update of SA: MP 0.3x, never hear problems in earlier versions of kick. The kicks would lose connection in 0.3e

But now the problem is different, now that I put in the SetTimer native Kick, happens to connect the player and take kick for no reason, and he reconnecting, connects normally.

I do not know what causes it, already reviewed the game mode entirely.
Use: sscanf

I hope you have any idea what this going on in my game mode.
Reply
#7

You can hook the Kick() function to prevent this issue...

pawn Код:
stock realKick(playerid)
{
    defer delayKickPlayer(playerid);
    return playerid;
}

#if defined _ALS_Kick
    #undef Kick
#define _ALS_Kick
    #define Kick realKick

timer delayKickPlayer[500](playerid)
{
    Kick(playerid);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)