SA-MP Forums Archive
Kick bug - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Kick bug (/showthread.php?tid=411763)



Kick bug - IstuntmanI - 30.01.2013

Quote:
Originally Posted by Kalcor
Посмотреть сообщение
Client/Server update SA-MP 0.3x RC3

- Fixes for Kick() function not always notifying player that they have been kicked.
It is working good. But I have an older bug (since 0.3e I think) with Kick function. If you Kick him at OnPlayerConnect (maybe other callbacks too ?) it don't show a previously shown dialog, I tested it again on RC3 with this code under OnPlayerConnect and it only says that "Server closed connection." and don't shows the dialog:
pawn Код:
gsBigString[ 0 ] = EOS;

strcat( gsBigString, "{FFFFFF}U MAD ? {FF0000}U MAD ? {FFFF00}U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ?\n" );
strcat( gsBigString, "{FFFFFF}U MAD ? {FF0000}U MAD ? {FFFF00}U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ?\n" );
strcat( gsBigString, "{FFFFFF}U MAD ? {FF0000}U MAD ? {FFFF00}U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ?\n" );
strcat( gsBigString, "{FFFFFF}U MAD ? {FF0000}U MAD ? {FFFF00}U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ?\n" );
strcat( gsBigString, "{FFFFFF}U MAD ? {FF0000}U MAD ? {FFFF00}U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ?\n" );
strcat( gsBigString, "{FFFFFF}U MAD ? {FF0000}U MAD ? {FFFF00}U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ?\n" );
strcat( gsBigString, "{FFFFFF}U MAD ? {FF0000}U MAD ? {FFFF00}U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ?\n" );
strcat( gsBigString, "{FFFFFF}U MAD ? {FF0000}U MAD ? {FFFF00}U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ? U MAD ?" );

ShowPlayerDialog( playerid, DIALOG_EMPTY, DIALOG_STYLE_MSGBOX, "{FFFFFF}You were kicked:", gsBigString, "OK", "" );
Kick( playerid );
I have to use it with a timer, but it should be fixed in SA:MP until the final release.


Re: Kick bug - kurta999 - 30.01.2013

This is not bug, because Kick() packet have higher priority than dialog, message, etc.


Re: Kick bug - Killa[DGZ] - 30.01.2013

Obviously there just isn't enough time for the dialog to be returned to the player before he is kicked.


I've had a similar issues before, such as creating a 'SetPlayerBlankScreen' or 'Blind' function for Banning & Kicking.
Then when using the following together..
pawn Код:
SetPlayerBlankScreen(playerid);
Kick(playerid);
In most cases SetPlayerBlankScreen simply doesn't have enough time to do it's thing before the kick.


Re: Kick bug - Killa[DGZ] - 30.01.2013

Quote:
Originally Posted by kurta999
Посмотреть сообщение
This is not bug, because Kick() packet have higher priority than dialog, message, etc.
That could be it too


Re: Kick bug - MP2 - 30.01.2013

Timerrrrrr


Re: Kick bug - IstuntmanI - 30.01.2013

Quote:
Originally Posted by MP2
Посмотреть сообщение
Timerrrrrr
Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
I have to use it with a timer, but it should be fixed in SA:MP until the final release.
Because I saw that Kalcor fixed something about Kick, I thought it would be good to report this too. It's better without timers due some reasons.


Re: Kick bug - Killa[DGZ] - 30.01.2013

What are the reasons lol?

I would just replace your kick(playerid); with something like this,

pawn Код:
SetTimerEx("KickPlayer",500,false,"i",playerid);// Kicks player in 500ms

}
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
    Kick(playerid);
    return 1;
}



Re: Kick bug - IstuntmanI - 30.01.2013

He can see all messages until the timer is called. It could be a /fakeban also, he's just kicked and a message is sent to all players (also him, and he can see it was a fake ban) ... or other reasons.

If it's hard to be fixed, then don't fix it now, it's a minor bug, I reported it only because I saw something related to Kick was fixed.


Kick in OnPlayerConnect - leong124 - 30.01.2013

It is quite good to see that players will not be fake banned after kicking and lose connection, but the client can't see any messages before kicking.

pawn Код:
#include <a_samp>

main(){}

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid,-1,"Testing message.");
    Kick(playerid);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}
If you try to do this, you won't find "Testing message."
Is this a bug?


Re: Kick in OnPlayerConnect - IstuntmanI - 30.01.2013

I reported this too: https://sampforum.blast.hk/showthread.php?tid=411763 few hours ago.


Re: Kick bug - Riddick94 - 30.01.2013

pawn Код:
if(PlayerData[playerid][E_PLAYER_BANNED] != 0)
        {
            new string[248];
            format(string, sizeof(string), ""COL_RED"Zostałeś zbanowany na tym serwerze. "COL_DEF"Szczegуłowe informacje poniżej:\n"COL_GREEN"Data: "COL_DEF"%s\n"COL_GREEN"Nadający: "COL_DEF"%s\n"COL_GREEN"Powуd: "COL_DEF"%s", PlayerData[playerid][E_PLAYER_BAN_DATE], PlayerData[playerid][E_PLAYER_BAN_SENDER], PlayerData[playerid][E_PLAYER_BAN_REASON]);
            ShowInfo(playerid, "Banicja", string);
            Kick(playerid);
            return true;
        }
This is my code, from my GameMode. I'm using y_ini script files and before that if statement i'm using INI_ParseFile to set values to the multi-dimensional arrays. For some reason it shows user my dialog (ShowInfo) and then kicks him.


Respuesta: Kick bug - [DOG]irinel1996 - 30.01.2013

A guy from Spanish section, oOFotherOo, said me that happenes the same thing with Ban and BanEx.

costel_nistor96, may you edit your message and add that too?

Best regards!


Re: Kick bug - leong124 - 31.01.2013

I think it would be better to be sequentially run the script, that is finishing everything before the kick instruction is done internally.
If we still have to use a timer, then it isn't a big difference as compared with the situation in 0.3e. Still, I have to admit that the current fix is better than before, but I hope there can be more improvements, as the problem only exists since 0.3e or 0.3d.

BTW, will the server release its R1 version very soon too?


Re: Kick in OnPlayerConnect - Admigo - 31.01.2013

Its not a bug. Its for security reasons said Kalcor.
Quote:
Originally Posted by Kalcor
Посмотреть сообщение
It had to be changed at some point (0.3d?) so that Kick() ceased all communication with the player immediately and didn't allow them to respond to any messages. It was done because of some type of attack.

That means you'll need to Kick on a timer if you need to send them a message before booting them off the server. Maybe a future server update will have a KickWithNotice() function or something.



Re: Kick in OnPlayerConnect - leong124 - 31.01.2013

Quote:
Originally Posted by Admigo
Посмотреть сообщение
Its not a bug. Its for security reasons said Kalcor.
Actaully, is there any difference between this and kicking and then display announcement of kicking after it?


Respuesta: Kick bug - [DOG]irinel1996 - 05.02.2013

Well, sorry for bumping, maybe this helps:
pawn Код:
new kick_gTimer[MAX_PLAYERS];

stock CallDelayedKick(playerid) {
    KillTimer(kick_gTimer[playerid]);
    kick_gTimer[playerid] = SetTimerEx("DelayedKick", 1000, false, "i", playerid);
    return 1;
}

forward DelayedKick(playerid);
public DelayedKick(playerid) {
    if (!IsPlayerConnected(playerid)) return 1;
    Kick(playerid);
    return 1;
}
Example:
pawn Код:
public OnPlayerConnect(playerid) {
    if (IsPlayerTroll(playerid)) {
        SendClientMessage(playerid, -1, "We sorry, we don't accept trolls there!");
        CallDelayedKick(playerid);
    }
    return 1;
}



Re: Respuesta: Kick bug - Neil. - 08.02.2013

Quote:
Originally Posted by [DOG]irinel1996
Посмотреть сообщение
Well, sorry for bumping, maybe this helps:
pawn Код:
new kick_gTimer[MAX_PLAYERS];

stock CallDelayedKick(playerid) {
    KillTimer(kick_gTimer[playerid]);
    kick_gTimer[playerid] = SetTimerEx("DelayedKick", 1000, false, "i", playerid);
    return 1;
}

forward DelayedKick(playerid);
public DelayedKick(playerid) {
    if (!IsPlayerConnected(playerid)) return 1;
    Kick(playerid);
    return 1;
}
Example:
pawn Код:
public OnPlayerConnect(playerid) {
    if (IsPlayerTroll(playerid)) {
        SendClientMessage(playerid, -1, "We sorry, we don't accept trolls there!");
        CallDelayedKick(playerid);
    }
    return 1;
}
Thanks for sharing that, I'll use it for my Anticheat, but then i've been wondering, on that 1000ms timer, A general spammer could still spam until the delayed kick is called. My question is, is it safe to use a 62ms timer to call the kick? Tested it and it works although i'm quite not sure if it would still be safe.


Re: Kick bug - dugi - 08.02.2013

1ms timer works too, see http://forum.sa-mp.com/showpost.php?...3&postcount=65


Re: Kick bug - S0n1COwnsYou - 09.02.2013

Samp Wiki Message:
Quote:

Important Note: As of SA-MP 0.3x, any message sent to the player with SendClientMessage before Kick() will not be displayed for them.

Samp Wiki Fix: // By Kye
PHP код:
forward KickPublic(playerid);
public 
KickPublic(playerid) { Kick(playerid); }
 
stock KickWithMessage(playeridmessage[])
{
    
SendClientMessage(playerid0xFF4444FFmessage);
    
SetTimerEx("KickPublic"10000"d"playerid);     //Delay of 1 second before kicking the player so he recieves the message
}
 
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp(cmdtext"/kickme"true) == 0)
    {
        
//Kicks the player who the executed this command
        
KickWithMessage(playerid"You have been kicked.");
        return 
1;
    }
    return 
0;