[Include] Anti Fake Kill
#1

OnPlayerFakeKill

Introduction
  • I was bored, nothing to do so I said to my I should try to script something useful TODAY so I came up with Anti Fake Kill, I will not guarantee that my Include is 100% accurate, testing this include and telling what I could improve maybe I could try to make this as accurate as I can.
What is Fake Kill?
  • Fake Kill is mostly used on DM/TDM/Freeroam server to earn more kills, but sometimes it gets annoying and people spams your DeathMessage causing the VICTIM to leave the server because his Deaths is increasing expeditiously.
Example of Usage
  • pawn Код:
    public OnPlayerFakeKill(playerid)
    {
        return true;
    }
    - This callback is called when the include detects a player who is using Fake Kill.
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?
  • Quote:
    Originally Posted by Blackazur
    Посмотреть сообщение
    Hello, can someone make me a anti fake killing? i dont have an solution for that.
Credits
Reply
#2

Neat code
Reply
#3

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

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

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

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

Quote:

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

why the hell would you do that?

it returns false.
Reply
#8

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

good job, this will help many people.
Reply
#10

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 ? =)))))))
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)