SA-MP Forums Archive
[Include] Anti Fake Kill - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Anti Fake Kill (/showthread.php?tid=482402)



OnPlayerFakeKill[v1.2] - Patrick - 20.12.2013

OnPlayerFakeKill

Introduction What is Fake Kill? Example of Usage How to use it?
Simply, Add #include <fakekill> underneath #include <a_samp>
pawn Код:
//Would look something like this.
#include <a_samp>
#include <fakekill>
//or
#include "a_samp.inc"
#include "fakekill.inc"
Download
Available on Github! - Download

Who is looking? Credits


Re: Anti Fake Kill - Alphlax - 20.12.2013

Neat code


Re: Anti Fake Kill - Patrick - 20.12.2013

Quote:
Originally Posted by Alphlax
Посмотреть сообщение
Neat code
Thank you, I like neat indentation


Re: Anti Fake Kill - Pottus - 20.12.2013

I really don't like this method you should record the death time and if a player has two deaths or more in a certain amount of time then they're fake killing it seems prone to false positives with your method I think. I also disagree with this line maybe they have it defined already and maybe it's completely different than how you have defined it your better off just writing forward() and public() when creating any functions it really serves no purpose to do this but potentially cause problems.

#define function:%0(%1) forward %0(%1); public %0(%1)

One more point, there is no need to use y_hooks I know it's nice but it's not needed when this can work without it and some people may not want to use y_hooks for whatever reason (Even though they should).


Here is my method please keep in mind I don't use OnPlayerDeath() anywhere in the script but here so fake killing does absolutely nothing at all that is why it's set to 10 in 10 seconds.

pawn Код:
#include <YSI\y_hooks>

// Delay until a connection would be ignored
#define         FAKEKILL_DELAY            10000

// Number of times within the connection delay to constitute an attack
#define         FAKEKILL_LIMIT            10

// Connection info
enum FAKEKILLINFO
{
    DeathCount,
    LastDeathTime,
}

static FakekillData[MAX_PLAYERS][FAKEKILLINFO];

hook OnPlayerDeath(playerid, killerid, reason)
{
    if(!IsPlayerNPC(playerid))
    {
        if(GetTickCount() - FakekillData[playerid][LastDeathTime] < FAKEKILL_DELAY)
        {
            FakekillData[playerid][DeathCount]++;
            if(FakekillData[playerid][DeathCount] == FAKEKILL_LIMIT) ProcessHack(playerid, INVALID_PLAYER_ID, PATCH_ANTIFAKEKILL);
        }
        else FakekillData[playerid][DeathCount] = 1;
        FakekillData[playerid][LastDeathTime] = GetTickCount();
    }
    return 1;
}

hook OnPlayerDisconnect(playerid, reason)
{
    FakekillData[playerid][DeathCount] = 0;
    FakekillData[playerid][LastDeathTime] = 0;
    return 1;
}



Re: Anti Fake Kill - dusk - 01.01.2014

pawn Код:
#define         FAKEKILL_DELAY            10000
Pottus, thats 10 seconds, right? Why not use timestamps? This a very small issue but GetTickCount does cause problems when server runs over 24 days.


Re: Anti Fake Kill - Pottus - 01.01.2014

Quote:
Originally Posted by dusk
Посмотреть сообщение
pawn Код:
#define         FAKEKILL_DELAY            10000
Pottus, thats 10 seconds, right? Why not use timestamps? This a very small issue but GetTickCount does cause problems when server runs over 24 days.
I would never get to 24 days on my server without an update


Re: Anti Fake Kill - Djole1337 - 02.01.2014

Quote:

hook OnPlayerConnect(playerid)
{
return FakeKill{ playerid } = 0;
}

why the hell would you do that?

it returns false.


Re: Anti Fake Kill - Patrick - 02.01.2014

Quote:
Originally Posted by Djole1337
Посмотреть сообщение
why the hell would you do that?

it returns false.
How does it return false/0? Try the code below and it returned fine, without using return true/1 or return false/0, it does it job, anyways I'm always trying to improve my skills in PAWN that is why I like people criticising me, but I don't take disrespectful stuff, like you did in Useful function section.

pawn Код:
#include <a_samp>

new var;

main()
{
    SetTimer("Callback", 1000, true);
    return var = 1;
}

forward Callback();
public Callback()
{
    return printf("%i", var);
}



Re: Anti Fake Kill - PT - 02.01.2014

good job, this will help many people.


Re: Anti Fake Kill - Aliassassin123456 - 02.01.2014

It's easy to break this Anti Fake Kill ....
I go near the player, and set fake kill reason to id 0, and fake kill.
NO FAKE KILL DETECTED.
What if i fired the player and go so far from player? Fake Kill ? =)))))))