OnPlayerAirbreak - Emmet_ - 06.11.2013
OnPlayerAirbreak
Introduction
I've released the same include about a year ago. However, last year's version had several bugs that I had no time to fix. That put aside, I've made a second new version, which is cleaner and more accurate than the other version.
What is airbreaking?
Airbreaking (or sometimes known as airbraking) is a common term in SA-MP, which is using a 3rd party tool to simply fly in the air. It is discouraged in SA-MP and 99.9% of servers will ban you for it.
Most scripts on here only use a simple detection method that checks the distance and calls it airbreaking. However, in most cases, that won't work out and you'll have a false detection. This script checks many other things such as height calculation and more.
Callback
There is one callback only:
pawn Код:
public OnPlayerAirbreak(playerid)
{
return 1;
}
The callback name speaks for itself; when a player is accused of airbreaking, the system will call this function.
As of 03/23/2015, vehicle airbreak is now detected!
Notes
I've did some extensive testing and it works flawlessly. However, there might be bugs, as with all things.
This include now detects vehicle airbreaking! Simply use IsPlayerInAnyVehicle within the callback to detect it.
Installation
Simply download the include from one of the links below and put OPA.inc inside your pawno/include folder.
pawn Код:
#include <a_samp>
#include <OPA>
And you're done!
Downloads
Pastebin
GitHub
Re: OnPlayerAirbreak -
jakejohnsonusa - 06.11.2013
Well done!
+1 for the nice work!
Re: OnPlayerAirbreak - Patrick - 06.11.2013
Looks nice, but I didn't test it, I just looked at the code
Re: OnPlayerAirbreak -
Baboon - 06.11.2013
This can come in handy, so i won't have to script it myself
Re: OnPlayerAirbreak -
Pottus - 06.11.2013
I find it funny that the guy who named it "airbreaking" used the wrong variation of the word :P anyways I would like to try it but this won't work on my server without significant alteration unfortunately so I can't really give you feedback of it's effectiveness right now.
Re: OnPlayerAirbreak -
FailerZ - 07.11.2013
Very useful thank you
Re: OnPlayerAirbreak -
Richie© - 07.11.2013
I tested this in my server to see how accurate it was.
It gives many false positives, one i got while i was spectating player and advanced to spec another player.
And most false positives is from random players, i change to spec them and they are not airbreaking and i dunno why it gives ab warning.
Edit: When a player exit vehicle, it can might give false positive.
Re: OnPlayerAirbreak -
Pottus - 07.11.2013
You know Richie, it really takes a lot of patience to build a AC you just can't tell what will happen until you try. I'm sure Emmet built this good but to perfect takes time and it's a absolute must to have a public server to test on. What I do when implementing any new AC features is just report to get a feel if there is false positives. It takes while to develop confidence with any AC routine so I wouldn't throw this out but try and figure out why false positives are being thrown then try again until your confidence is high enough to have it autoban which could take a week or maybe never and you have to remove the check.
Re: OnPlayerAirbreak -
Richie© - 07.11.2013
I know Pottus, its not like im using junkbuster or anything. But i wanted to see how this worked compared to what i got and help out by testing.
After reading the include, i think the problem is in 'stock AB_Detect(playerid)'.
It checks the players position when player is not in a vehicle, then a player enter a vehicle and drive a bit and exit, then the AB_Detect sees it as airbreak.
pawn Код:
if (IsPlayerConnected(playerid) && !IsPlayerInAnyVehicle(playerid) && g_AB_PlayerSpawned[playerid])
{
if ((gettime() - g_AB_LastTick[playerid]) >= 1)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if (floatabs(g_AB_LastPosition[playerid][2] - z) < 1.0)
{
new Float:distance = GetPlayerDistanceFromPoint(playerid, g_AB_LastPosition[playerid][0], g_AB_LastPosition[playerid][1], g_AB_LastPosition[playerid][2]);
if (floatabs(distance) >= 65.0 && (floatabs(g_AB_LastPosition[playerid][1] - y) >= 45.0 || floatabs(g_AB_LastPosition[playerid][0] - x) >= 45.0))
{
CallLocalFunction("OnPlayerAirbreak", "d", playerid);
}
}
g_AB_LastTick[playerid] = gettime();
GetPlayerPos(playerid, g_AB_LastPosition[playerid][0], g_AB_LastPosition[playerid][1], g_AB_LastPosition[playerid][2]);
}
Re: OnPlayerAirbreak -
Pottus - 07.11.2013
It's good that you take the time to test to give pertinent feedback.
Re: OnPlayerAirbreak -
iZN - 07.11.2013
Looks great, it'll get handy.
Re: OnPlayerAirbreak - Emmet_ - 07.11.2013
Quote:
Originally Posted by jakejohnsonusa
Well done!
+1 for the nice work!
|
Quote:
Originally Posted by pds2k12
Looks nice, but I didn't test it, I just looked at the code
|
Quote:
Originally Posted by Strawhats
This can come in handy, so i won't have to script it myself 
|
Quote:
Originally Posted by FailerZ
Very useful thank you 
|
Thanks.
Quote:
Originally Posted by [uL]Pottus
I find it funny that the guy who named it "airbreaking" used the wrong variation of the word :P anyways I would like to try it but this won't work on my server without significant alteration unfortunately so I can't really give you feedback of it's effectiveness right now.
|
That's true, lol. "Airbreaking" doesn't make any sense, how can someone break the air? lol.
Quote:
Originally Posted by [uL]Pottus
You know Richie, it really takes a lot of patience to build a AC you just can't tell what will happen until you try. I'm sure Emmet built this good but to perfect takes time and it's a absolute must to have a public server to test on. What I do when implementing any new AC features is just report to get a feel if there is false positives. It takes while to develop confidence with any AC routine so I wouldn't throw this out but try and figure out why false positives are being thrown then try again until your confidence is high enough to have it autoban which could take a week or maybe never and you have to remove the check.
|
Thank you for your understanding. After all, I've released an airbreak detection method last year and it had way more bugs than this one, so I had to scrap it and start from scratch. It took me about 3 more tries but I've done it. :d
This is why that in most anticheat detections, it is good to have a variable that counts the number of detections, false or not. If the variable reaches a certain amount, ban that player.
pawn Код:
new g_AB_DetectCount[MAX_PLAYERS];
public OnPlayerAirbreak(playerid)
{
g_AB_DetectCount[playerid]++;
if (g_AB_DetectCount[playerid] >= 3)
{
Ban(playerid);
}
return 1;
}
@Richie©: Thanks for taking your time to report the bugs, I've worked on the script a bit and all of them should be fixed now (after 1-2 hours of testing and tweaking), sorry about that XD.
Re: OnPlayerAirbreak -
Michael@Belgium - 08.11.2013
Quote:
If you want to detect vehicle airbreak, simply find a function that gets the player's vehicle speed. Check if the vehicle speed is >= 325. If so, ban the player.
|
You sure about that ?

If you're right you can have a cookie :3
Re: OnPlayerAirbreak -
Konstantinos - 08.11.2013
I cannot test it, so I cannot say anything about it yet.
Quote:
If you want to detect vehicle airbreak, simply find a function that gets the player's vehicle speed. Check if the vehicle speed is >= 325. If so, ban the player.
|
Not good for those server which use speedboost feature. I hope there's another way!
Re: OnPlayerAirbreak -
PT - 10.11.2013
Quote:
Originally Posted by Konstantinos
Not good for those server which use speedboost feature. I hope there's another way! 
|
good point, but for RP's server's this is usefull
great job
Re: OnPlayerAirbreak - Emmet_ - 11.11.2013
@Konstantinos, Michael@Belgium: I am working on a vehicle airbreak detection as we speak, but I'll need to thoroughly test it as vehicle airbreak can be easily detected from a server-sided feature (e.g. speed boost, teleportation).
And thanks everyone!
Respuesta: OnPlayerAirbreak -
deryan - 25.11.2013
thanks i will use this :3
Re: OnPlayerAirbreak -
daniscape - 06.12.2013
REP+ I was just looking for something like this
Re: OnPlayerAirbreak -
kristo - 06.12.2013
This happens on my friends computer but not on mine. The server files are same as they're stored in Dropbox. It's very strange, what could cause this?
[14:35:48] [debug] Server crashed while executing imperial.amx
[14:35:48] [debug] AMX backtrace:
[14:35:48] [debug] #0 native GetPVarInt () [00475c40] from samp-server.exe
[14:35:48] [debug] #1 0000cefc in public AirbreakCheck () from imperial.amx
Re: OnPlayerAirbreak - Emmet_ - 06.12.2013
Quote:
Originally Posted by kvann
This happens on my friends computer but not on mine. It's very strange, what causes this?
[14:35:48] [debug] Server crashed while executing imperial.amx
[14:35:48] [debug] AMX backtrace:
[14:35:48] [debug] #0 native GetPVarInt () [00475c40] from samp-server.exe
[14:35:48] [debug] #1 0000cefc in public AirbreakCheck () from imperial.amx
|
That's definitely a very old version of this include, from last year! This version doesn't have any PVars or the AirbreakCheck callback anymore.
Download the new version of this include from the main post and put "OPA.inc" in every "pawno/include" folder - then recompile. Make sure you #include <OPA> instead of #include <airbreak>.