Kick bug
#1

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.
Reply
#2

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

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.
Reply
#4

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

Timerrrrrr
Reply
#6

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.
Reply
#7

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;
}
Reply
#8

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.
Reply
#9

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?
Reply
#10

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

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.
Reply
#12

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!
Reply
#13

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?
Reply
#14

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.
Reply
#15

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?
Reply
#16

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;
}
Reply
#17

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.
Reply
#18

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

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;

Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)