SA-MP Forums Archive
Extremely important kick bug 0.3e - 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: Extremely important kick bug 0.3e (/showthread.php?tid=411744)



Extremely important kick bug 0.3e - wups - 30.01.2013

THIS BUG OCCURS ON 0.3e, i don't know about 0.3x but i guess it isn't fixed.
Hi there, this is extremely important, because it may cause major damage to the server property.
Not long ago, a cheater came to my server. He destroyed all vehicles currently in the server, also faked his death about 2000 times in about 3-4 seconds.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(GetTickCount() - LastDeath[playerid] < 1000)
    {
        DeathCount[playerid]++;
    }
    if(DeathCount[playerid] >=3)
        Kick(playerid); // anti fake-kill
    LastDeath[playerid]=GetTickCount();
}
This code only kicked him after 3-4 seconds. During that time, he faked thousands of deaths.
I don't know if Ban() would fix this problem, I store my bans in mysql, so i kick them and insert a query to mysql.
Cheers, looking forward to the 0.3x release.


Re: Extremely important kick bug 0.3e - CodyCummings - 30.01.2013

The method you used to detect fake kills detects it at minimum after 3 seconds.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    DeathCount[playerid]++;
    if(DeathCount[playerid] > 3 && GetTickCount() - LastDeath[playerid] < 1000)
    {
        //fake killing
    }
    if(GetTickCount() - LastDeath[playerid] > 1000)
    {
        DeathCount[playerid] = 0; // reset death count to avoid wrongful bans
    }
    LastDeath[playerid]=GetTickCount();
}
That should do the trick.


Re: Extremely important kick bug 0.3e - Kar - 30.01.2013

Hey! I'm also getting this issue. IDK why, I call kick directly after a fake kill / death but they still spam! I didn't think it was a sa-mp bug but I guess it is (tested on 0.3e only)

pawn Код:
if(killerid != INVALID_PLAYER_ID)
    {
        SendDeathMessage(killerid, playerid, reason);
        new time = gettime( );
        switch( time - LastDeath[ playerid ] )
        {
            case 0 .. 3:
            {
                DeathSpam{ playerid }++;
                if( DeathSpam{ playerid } == 3)
                {
                    printf("[System: Fake Kill] - %s(%d) Has Fake Killed %s(%d)", Playername(playerid), playerid, Playername(killerid), killerid);
                    MessageToAdmins(COLOR_ADMIN, "[System: Fake Kill] - %s(%d) Has Fake Killed %s(%d)", Playername(playerid), playerid, Playername(killerid), killerid);
                    format(GlobalString, sizeof(GlobalString), "10[System: Fake Kill] - %s(%d) Has Fake Killed %s(%d)", Playername(playerid), playerid, Playername(killerid), killerid);
                    IRC_GroupSay(gGroupID, ADMIN_IRC_CHANNEL, GlobalString);

                    format(GlobalString, sizeof(GlobalString), "SERVER BAN: %s(%d) Has Been Banned From The Server - Reason: Fake Killing.", Playername(playerid), playerid);
                    SendClientMessageToAll(PINK, GlobalString);
                    IRC_GroupSay(gGroupID, ECHO_IRC_CHANNEL, GlobalString);
                    IRC_GroupSay(gGroupID, ADMIN_IRC_CHANNEL, GlobalString);
                    SendClientMessage(playerid, LIGHTBLUE, "You Have Been Banned For Attempting To Fake Kill Users");
                    SafeBan(playerid, "Fake Killing", 12);
                    return 1;
                }
            }
            default: DeathSpam{ playerid } = 0;
        }
        LastDeath[ playerid ] = time;
        //ANTI FAKE DEATH
        if((GetTickCount() - GetPVarInt(killerid, "deathtime")) < 220)
        {
            SetPVarInt(killerid, "killspam", GetPVarInt(killerid, "killspam") + 1);
            if(GetPVarInt(killerid, "killspam") >= 5)
            {
                printf("[System: Fake Deaths] - %s(%d)", Playername(killerid), killerid);
                MessageToAdmins(COLOR_ADMIN, "[System: Fake Deaths] - %s(%d)",  Playername(killerid), killerid);
                format(GlobalString, sizeof(GlobalString), "10[System: Fake Deaths] - %s(%d)", Playername(killerid), killerid);
                IRC_GroupSay(gGroupID, ADMIN_IRC_CHANNEL, GlobalString);

                format(GlobalString, sizeof(GlobalString), "SERVER BAN: %s(%d) Has Been Banned From The Server - Reason: Fake Deaths.", Playername(killerid), killerid);
                SendClientMessageToAll(PINK, GlobalString);
                IRC_GroupSay(gGroupID, ECHO_IRC_CHANNEL, GlobalString);
                IRC_GroupSay(gGroupID, ADMIN_IRC_CHANNEL, GlobalString);
                SendClientMessage(killerid, LIGHTBLUE, "You Have Been Banned For Attempting To Fake Death Yourself");
                SafeBan(killerid, "Fake Deaths", 12);
                Kick(killerid);
                return 1;
            }
        }
        SetPVarInt(killerid, "deathtime", GetTickCount());
Both safe ban and safe kick call kick directly, but they still spam!


Re: Extremely important kick bug 0.3e - CodyCummings - 30.01.2013

Kar: This is 0.3x or 0.3e? We've an anti fake-kill system that bans after a few fake kills (0.3e).


Re: Extremely important kick bug 0.3e - Lorenc_ - 30.01.2013

Add a check if the player is streamed, and a check if the killerid shot the player via OnPlayerGiveDamage.

After I did this, my fake-kill situation has been completely patched. Use BanEx as it kicks faster and doesn't require any queries. I would never use my server-sided ban system for this, but instead SA-MP's default.


Re: Extremely important kick bug 0.3e - Mauzen - 30.01.2013

Might simply be due to the server lag caused by the fake deaths. Thousands of fake deaths mean thousands of callback calls, and so quite a lot of lag.


Re: Extremely important kick bug 0.3e - wups - 31.01.2013

Quote:
Originally Posted by CodyCummings
Посмотреть сообщение
The method you used to detect fake kills detects it at minimum after 3 seconds.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    DeathCount[playerid]++;
    if(DeathCount[playerid] > 3 && GetTickCount() - LastDeath[playerid] < 1000)
    {
        //fake killing
    }
    if(GetTickCount() - LastDeath[playerid] > 1000)
    {
        DeathCount[playerid] = 0; // reset death count to avoid wrongful bans
    }
    LastDeath[playerid]=GetTickCount();
}
That should do the trick.
False.
Yes, it creates major lag, which is what i want to avoid. I guess it has to do something with packet delay.
I will try doing it with the Ban() function, thanks.

ALSO
https://sampforum.blast.hk/showthread.php?tid=411975
Maybe this new update will help prevent this issue with the kick?