[Include] FairPlay - Keep the cheaters out
#1

I DON'T CODE FOR/PLAY SAMP ANYMORE, THIS IS PROBABLY VERY BUGGY AND WILL NOT WORK. DO NOT EXPECT ANY UPDATES.




Introduction

FairPlay will help you get rid of the cheaters on your server. I designed it to be easy to use while still being very effective. While it may not detect everything to the fullest extent, it won't give you any false positives.


Required Libraries

To use FairPlay, you must be running sscanf version 2 on your server. If you currently do not have sscanf, you may download it here: https://sampforum.blast.hk/showthread.php?tid=120356


Staff Member Immunity

You might be wondering how to prevent your staff members from getting detected by FairPlay. Well it's simple. You can use the custom SetPlayerFairPlayImmune function after stats are loaded to make a player immune to FairPlay detection.

Example:

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(playerStaffLevel[playerid])
    {
        SetPlayerFairPlayImmune(playerid, 1);
    }

    return 1;
}
Of course you will need to change the playerStaffLevel variable in that example to fit your needs, but you get the point.


Including

To add FairPlay to your script you must download FairPlay.inc and place it in your pawno => include folder. Once you have placed the file in the correct folder, you must add

pawn Код:
#include <FairPlay>
to the top of your script.

If you are using this in a gamemode, you must put

pawn Код:
#define FP_MASTER
before including FairPlay.


After Including

After including FairPlay into your script, you will need to add the following callback somewhere in your script:

pawn Код:
public OnPlayerUnfairPlay(playerid, playType)
{
    switch(playType)
    {
        case FP_HIGH_PING:
        {
        }

        case FP_WEAPON_HACK:
        {
        }

        case FP_VEHICLE_SPEED_HACK:
        {
        }

        case FP_JETPACK_HACK:
        {
        }

        case FP_SWEARING:
        {
        }

        case FP_FLY_HACK:
        {
        }

        case FP_CHAT_SPAM:
        {
        }

        case FP_AFK:
        {
        }

        case FP_TABBING:
        {
        }

        case FP_NINJA_JACK:
        {
        }

        case FP_CAR_RAM:
        {
        }

        case FP_HELIBLADE:
        {
        }

        case FP_VEHICLE_MOD_HACK:
        {
        }

        case FP_SERVER_AD:
        {
        }

        case FP_FAKE_KILL:
        {
        }

        case FP_TELEPORT_HACK:
        {
        }
    }

    return 1;
}
Every time unfair play is detected, that callback will be called. playerid is the player who is playing unfairly and playType is what the player is doing that is unfair.


Possible playType Values

This is a list of all possible values that playType can be along with a description of when it's called.

playTypeDescription
FP_HIGH_PINGWhen the player has reached 3 warnings for having a ping above FP_MAX_PING
FP_WEAPON_HACKWhen the player fires a weapon that was not given to them from the script
FP_VEHICLE_SPEED_HACKWhen a vehicle passes it's speed limit
FP_JETPACK_HACKWhen the player has a jetpack which was not given to them from the script
FP_DRIVER_DRIVEBY*Preventing driver drivebys
FP_DRIVEBY_WEAPONS_RESTRICT*Restricting driveby weapons to the ones specified in FP_DRIVEBY_WEAPONS
FP_SWEARING**When a player says a word that is defined in FP_CurseWords either in a command or in the chat
FP_FLY_HACKWhen a player is flying
FP_CHAT_SPAMWhen a player spams the chat or commands in a short period of time
FP_AFKWhen a player hasn't said anything in the chat, used a command, or moved in 5 minutes
FP_TABBINGWhen a player is tabbed out of the game
FP_NINJA_JACKWhen a player jacks a vehicle from another player in a certain way which results in the original driver dying
FP_CAR_RAMWhen a player rams another player with a vehicle
FP_HELIBLADEWhen a player kills another player using the blades of his helicopter
FP_VEHICLE_MOD_HACKWhen a player modifies their vehicle outside of a tuning garage
FP_SERVER_AD***When a player says a server's IP or domain in chat or a command and the IP and/or domain don't correspond to FP_SERVER_IP and FP_SERVER_DOMAIN
FP_FAKE_KILLWhen a player uses a cheat to fake a kill by another player
FP_TELEPORT_HACKWhen a player teleports to a far away location
* = Will not be called in OnPlayerUnfairPlay
** = Curse words are automatically converted to * characters
*** = Messages with server advertisements will not be sent


Avoiding Filterscript Conflicts

In order to avoid conflicts with other filterscripts forcing FairPlay to give off false positives, you must include this in all loaded filterscripts.


Settings

If you would like to disable detection for anything, you may comment out the line of where the playType is defined.

For example, if you would like to disable checking tabbed players, you would comment out the following line:

pawn Код:
#define FP_TABBING (11)
There are also some settings that you can change under all of the unfair play definitions.

FP_TIMER_INTERVAL: This is the interval at which the per-player timer will repeat itself. It is recommended that you do not change this unless you know what you are doing.

FP_MAX_PING: This is the maximum amount of ping a user may have before a ping warning is given to them.

FP_DRIVEBY_WEAPONS: These are the weapons (separated with a space) with which a user can driveby with.

FP_SERVER_IP: This is your server IP.

FP_SERVER_DOMAIN: This is your server domain.

FP_CurseWords: This is a list of words (separated by a comma) which are censored and reported as swearing when said.


Issues and Suggestions

If you happen to find an issue with FairPlay or would like to suggest a new feature or to change an existing feature, please reply to this thread with your request and I will get to it shortly.


Download

Version 1.2: Pastebin - Mediafire - Puush
Version 1.1: Pastebin - Mediafire - Puush
Version 1.0: Pastebin - Mediafire - Puush



Changelog

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
Version 1.2 (critical update) has been released:
- Added another method to fake kill detection
- Resolved a critical issue with vehicle speed hack detection in airplanes
- Resolved a minor issue in which a player surfing a vehicle may get detected as teleporting in a rare case
Quote:
Originally Posted by SuperViper
Посмотреть сообщение
Version 1.1 has been released:
- Messages that contain server advertisements are now automatically not sent
- Fake kill now ignores NPCs
- Master/slave functionality
Gamemodes must have
pawn Код:
#define FP_MASTER
before including FairPlay
Credits

Scripting: SuperViper/Ricky Phelps
Testing: Chriham3/Alex Shock
Reply
#2

Another great release from SuperViper!
Reply
#3

Good script, works really well. I haven't been able to break it yet.
Reply
#4

Nice script, but I don't see any big improvement from your old anti-cheat (svCheat). It's just a slightly edited version of it. I don't think it's false positive proof mainly because it doesn't take into account the lag between server and client. You should read "Anti cheat tips" topic and also "Understanding SA-MP sync".

Also, it doesn't have master/slave type of functionality (or whatever, I don't know how to call it). If you include this to your gamemode and 9 other filterscripts, it will be doing the same checks 10 times, for example, hit the fire key, each filterscript will check your weapon etc. Anyway, I'll check back later and good luck improving it!
Reply
#5

I really don't like that is full of PVars makes absolutely no sense to be using them for this.
Reply
#6

Quote:
Originally Posted by Stylock
Посмотреть сообщение
Nice script, but I don't see any big improvement from your old anti-cheat (svCheat). It's just a slightly edited version of it. I don't think it's false positive proof mainly because it doesn't take into account the lag between server and client. You should read "Anti cheat tips" topic and also "Understanding SA-MP sync".

Also, it doesn't have master/slave type of functionality (or whatever, I don't know how to call it). If you include this to your gamemode and 9 other filterscripts, it will be doing the same checks 10 times, for example, hit the fire key, each filterscript will check your weapon etc. Anyway, I'll check back later and good luck improving it!
svCheats was quite buggy and the coding style was very messy. The lag between the server and client may cause a false positive from time to time but the code itself when executed properly won't give off false positives. I already read both of those topics. As for the master/slave functionality, I made sure the main timer didn't get duplicated and I'm still working on figuring out a way to do the rest.

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
I really don't like that is full of PVars makes absolutely no sense to be using them for this.
I used PVars so that filterscripts don't give off false positives.
Reply
#7

I think I see what you mean.....

pawn Код:
if(!GetPVarType(playerid, "FP_PlayerDetectionTimer"))
    {
        SetPVarInt(playerid, "FP_PlayerDetectionTimer", SetTimerEx("FP_Detection", FP_TIMER_INTERVAL, true, "d", playerid));
    }
So now only one timer can run makes sense.

But again I still don't like the use of PVars you don't need them, at all when you can make a simplistic include that uses CallRemoteFunction() to make calls to the gamemode for filterscripts. Yes CallRemoteFunction() is slower than PVars but overall the trade off will favor using normal variables hands down when you take into account the bottleneck they cause littered all over the include.

I also don't see the need of setting a timer every time a player connects when one timer with a foreach() loop would make a lot more sense and save a small handful of calls.

One more thing for me if I decided to use this is I don't use OnPlayerDeath() at all so I'd have to make some modifications but that would be fine with me.
Reply
#8

The difference in PVars and remote functions is minimal and both sides have their own benefits. It's unnecessary to change it. The advantage with several small timers rather than one large timer is so the server doesn't hang a lot at once but it hangs for a little in small intervals so that other things can be executed between the timers. I read a topic by ****** which said this was a better way of going about it.

I have an older version of the include before I converted it to PVars. If you don't use any filterscripts that use the hooked functions and callbacks, I highly recommend using it.

http://pastebin.com/h2kxdBFY
Reply
#9

Thanks i'll give it a shot, It looks promising and I'll even re-post my changes/updates it might give you some ideas.

@Edit - Only reason to change it is for assholes like me who would never think of using a PVar ever
Reply
#10

nice work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)