[Include] [sAwh] Anti Weapons And Ammo Hack
#1

Anti Weapons And Ammo Hack


Код:
This include is perfectly working and it's even active in my server since days, I haven't received any false detection from the include till now.

If you find any bug, report it here.
Introduction:
This include is meant to detect player's using weapons hack/ammo hack. This include also excludes the situations such as using the Detonator (Thanks to RogueDrifter for reminding me about the detonator), jumping out of a plane and receiving parachute, and also contains the check against the case when sometimes while entering or exiting a vehicle the server may say they have a weapon which they do not have.

Mechanism:
When players use weapon/ammo hack, they usually do it without calling the Weapon/Ammo functions so we can easily record the player's data by using hooked functions.

Usage:
One callback is provided for this include to give users the full control of this include.
THIS INCLUDE MUST BE INCLUDED IN ALL FILTERSCRIPTS!
Код:
Only one function:
- OnPlayerWeaponsHack(playerid, weaponid, ammo, type)
 
Types:

1 - Weapons Hack
2 - Ammo Hack
3 - Different Weapon In Another Slot (I highly recommend to timeout player for this type as this can also be caused for being desycned too)
4 - Ammo freeze aka no reload aka infinite ammo
I RECOMMEND NOT TO USE KICK/BAN AS THIS INCLUDE IS IN INITIAL RELEASE.

Changelog:
Код:
V1.1
- Fixed the case when player sometimes shooting weapon gets detected as a hacker.
- Fixed the case when guns like SMG when used trigger ammo hack.
- Improved the code.
- Fixed the false detection when SetSpawnInfo is used.

V1.2
-  Added type #4, anti ammo freeze aka infinite ammo aka no reload.

V1.3
-  Fixed the out of bounds error.
-  Optimized the code.
Comments:
Thanks once again to RogueDrifter's immunity trick, and I've tested it several times for days, using all the weapon cheats, the script functions to manipulate the weapon/ammo data of the player, I have tried to hook nearly all the weapon/ammo functions of the script so that there may not be any false detection and the variables stay up to date. For the type 3, I recommend using the tip I've listed above. Also it has support for all scripts so you need to include it in all your filterscripts to avoid false detections.

Download:
GitHub
Pastebin
Attachment

I HIGHLY RECOMMEND ROGUE'S FILTER LAGGERS INCLUDE TO AVOID FALSE DETECTIONS BECAUSE OF LAGGERS. CLICK ME TO GO TO THE INCLUDE'S THREAD.
Reply
#2

Great job i'll say i didn't give this fair time reading but so far you're doing great saves me time releasing my own version, well done!
Reply
#3

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
Great job i'll say i didn't give this fair time reading but so far you're doing great saves me time releasing my own version, well done!
Thanks
Reply
#4

How do I use it?, since it detects me as a hack when the server gives me a weapon
Reply
#5

Include it in all your filter scripts if you use any.
Reply
#6

I only have one FS but only with maps
PHP код:
public OnPlayerWeaponsHack(playeridweaponidammotype)
{
  if(
Server[WEAPONHACK] ==1) {
  if(
type == 1) {
    
format(StringGlobalsizeof(StringGlobal), "%s[%i] fue expulsado Razon: [ Weapon Hack: #%d Arma: %d]"NombreJugador(playerid),playeridtype,weaponid);
    
SendClientMessageToAll(0xFFAC59FFStringGlobal);
    
Kick(playerid);
    }
    }
    return 
1;

He ejects me when the server gives me weapons
Reply
#7

I have to say what I don't like here. It's all fine and dandy to check for weapon cheats but my philosophy is that weapon hacking is impossible because we can track every bullet. It just seems to me a better approach is to simply enforce a players inventory server side. In this way you completely eliminate the possibility of weapon hacking to have any effect in the first place even if a player is indeed hacking. Same goes with health hacking if it is impossible in the first place then it doesn't matter if they do it since it won't do anything.

Don't get me wrong it is good to do additional checks and if someone is indeed trying to cheat then ban them. Cheating is like a sickness in SA-MP and how do you treat a sickness? If you have a chest cold you go to the doctor and he will prescribe you antibiotics and and some kind of symptom relief medication. Cough syrup alone is not going to take care of the infection but you might feel a a lot better and it will get you by. To me this release is cough syrup you have not addressed the source of cheating but are just treating the symptoms.

Not saying that anything here is bad but you can be a lot more effective by looking at things differently.
Reply
#8

Quote:
Originally Posted by Pottus
Посмотреть сообщение
I have to say what I don't like here. It's all fine and dandy to check for weapon cheats but my philosophy is that weapon hacking is impossible because we can track every bullet. It just seems to me a better approach is to simply enforce a players inventory server side. In this way you completely eliminate the possibility of weapon hacking to have any effect in the first place even if a player is indeed hacking. Same goes with health hacking if it is impossible in the first place then it doesn't matter if they do it since it won't do anything.

Don't get me wrong it is good to do additional checks and if someone is indeed trying to cheat then ban them. Cheating is like a sickness in SA-MP and how do you treat a sickness? If you have a chest cold you go to the doctor and he will prescribe you antibiotics and and some kind of symptom relief medication. Cough syrup alone is not going to take care of the infection but you might feel a a lot better and it will get you by. To me this release is cough syrup you have not addressed the source of cheating but are just treating the symptoms.

Not saying that anything here is bad but you can be a lot more effective by looking at things differently.
I'll look forward to improve my includes, I'll try my best, thanks for the tips tho I'll surely do the server side thing for complete protection
Reply
#9

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
I'll look forward to improve my includes, I'll try my best, thanks for the tips tho I'll surely do the server side thing for complete protection
You really need to improve your code in general. You (enumaration) variable's names aren't unique which can make a lot of conflicts. You can improve some points too like this one (see below). Why do you create a new variable when you have already an enumeration for players?
PHP код:
new weaponsInfo[MAX_PLAYERS][wInfo];
new 
wtimer[MAX_PLAYERS]; 
You don't use static for internal functions which can make conflicts too like GetWeaponSlot. This function is common.

I don't know why do you set timers to reset things, it's seems completely useless.
You don't respect native functions check. I'm talking about functions which has been hooked. Providing a invalid player id (higher than MAX_PLAYERS in this occurrence) will result in a run time error.
The general structure of your code is, for me, completely wrong. A player can't have 2 weapons at the same slot, why don't you refer to that instead of creating "Weapons[53]"?
My English isn't that good like Pottus or anyone here but I hope you get my points.
Reply
#10

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
You really need to improve your code in general. You (enumaration) variable's names aren't unique which can make a lot of conflicts. You can improve some points too like this one (see below). Why do you create a new variable when you have already an enumeration for players?
PHP код:
new weaponsInfo[MAX_PLAYERS][wInfo];
new 
wtimer[MAX_PLAYERS]; 
You don't use static for internal functions which can make conflicts too like GetWeaponSlot. This function is common.

I don't know why do you set timers to reset things, it's seems completely useless.
You don't respect native functions check. I'm talking about functions which has been hooked. Providing a invalid player id (higher than MAX_PLAYERS in this occurrence) will result in a run time error.
The general structure of your code is, for me, completely wrong. A player can't have 2 weapons at the same slot, why don't you refer to that instead of creating "Weapons[53]"?
My English isn't that good like Pottus or anyone here but I hope you get my points.
I'll improve the code, will release an update today, and about the timer?
Reply
#11

Quote:
Originally Posted by Pottus
Посмотреть сообщение
I have to say what I don't like here. It's all fine and dandy to check for weapon cheats but my philosophy is that weapon hacking is impossible because we can track every bullet. It just seems to me a better approach is to simply enforce a players inventory server side. In this way you completely eliminate the possibility of weapon hacking to have any effect in the first place even if a player is indeed hacking. Same goes with health hacking if it is impossible in the first place then it doesn't matter if they do it since it won't do anything.

Don't get me wrong it is good to do additional checks and if someone is indeed trying to cheat then ban them. Cheating is like a sickness in SA-MP and how do you treat a sickness? If you have a chest cold you go to the doctor and he will prescribe you antibiotics and and some kind of symptom relief medication. Cough syrup alone is not going to take care of the infection but you might feel a a lot better and it will get you by. To me this release is cough syrup you have not addressed the source of cheating but are just treating the symptoms.

Not saying that anything here is bad but you can be a lot more effective by looking at things differently.
I don't get it, that's the point of server-sided weapon anticheats, to force the player's inventory to only contain weapons given to him by the script, can you elaborate further on that?

Regarding your tip on the health cheats, simply not everyone is gonna use a mem hacking plugin to force stream in all of the other custom health bars of other players seeing as if you do health server-sided and handled by a server-sided damage system you'll have useless health bars laying around and confused players calling each other cheaters.


@Dayerion:
Quote:

You don't use static for internal functions

Can you please explain how's that going to do any better than simply using the stock tag or not using any at all?
Quote:

I don't know why do you set timers to reset things, it's seems completely useless.

We set timers to give protection to the player in anti cheat systems for a certain amount of time so that he wouldn't get detected falsely as a cheater due to lag and high ping. Instead of giving warnings as if a player lags 3 times he'll get banned falsely, this gives a more solid detection.
Quote:

You don't respect native functions check. I'm talking about functions which has been hooked. Providing a invalid player id (higher than MAX_PLAYERS in this occurrence) will result in a run time error.

Where's that done? it's up to the scripter to not return invalid player ids otherwise he's causing problems to himself afaik.
Quote:

The general structure of your code is, for me, completely wrong. A player can't have 2 weapons at the same slot, why don't you refer to that instead of creating "Weapons[53]"?

He's using the array as weapon ids not weapon slots.
Reply
#12

Quote:
Originally Posted by Daynox12
Посмотреть сообщение
How do I use it?, since it detects me as a hack when the server gives me a weapon
Quote:
Originally Posted by Daynox12
Посмотреть сообщение
I only have one FS but only with maps
PHP код:
public OnPlayerWeaponsHack(playeridweaponidammotype)
{
  if(
Server[WEAPONHACK] ==1) {
  if(
type == 1) {
    
format(StringGlobalsizeof(StringGlobal), "%s[%i] fue expulsado Razon: [ Weapon Hack: #%d Arma: %d]"NombreJugador(playerid),playeridtype,weaponid);
    
SendClientMessageToAll(0xFFAC59FFStringGlobal);
    
Kick(playerid);
    }
    }
    return 
1;

He ejects me when the server gives me weapons
Thanks for reporting, I assume you are using SetSpawnInfo, it has been fixed in V1.1.

Update V1.1

Код:
- Fixed the case when player sometimes shooting weapon gets detected as a hacker.
- Fixed the case when guns like SMG when used trigger ammo hack.
- Improved the code.
- Fixed the false detection when SetSpawnInfo is used.

Link on main post.
Reply
#13

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
Can you please explain how's that going to do any better than simply using the stock tag or not using any at all?
Internal functions declared with static is only defined in the file it was declared on, therefore it prevents the user from accessing it which makes static and stock two entirely different things.

Internal functions are meant to be... internal, thus it should be declared with static.
Reply
#14

Quote:
Originally Posted by iKarim
Посмотреть сообщение
Internal functions declared with static is only defined in the file it was declared on, therefore it prevents the user from accessing it which makes static and stock two entirely different things.

Internal functions are meant to be... internal, thus it should be declared with static.
Ahh that makes sense, thanks for the info.
Reply
#15

Quote:
Originally Posted by iKarim
Посмотреть сообщение
Internal functions declared with static is only defined in the file it was declared on, therefore it prevents the user from accessing it which makes static and stock two entirely different things.

Internal functions are meant to be... internal, thus it should be declared with static.
Those functions are declared with static in new update v1.1.
Reply
#16

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
Those functions are declared with static in new update v1.1.
I was replying to Rogue's question why internal functions should be declared with static.
Reply
#17

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
...
@Dayerion:

Can you please explain how's that going to do any better than simply using the stock tag or not using any at all?
@iKarim answered you about what static keyword is and how useful is it for an include.

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
We set timers to give protection to the player in anti cheat systems for a certain amount of time so that he wouldn't get detected falsely as a cheater due to lag and high ping. Instead of giving warnings as if a player lags 3 times he'll get banned falsely, this gives a more solid detection.
That won't protect nothing and can probably make it worse. You can't set a randomly 3 sec timer to protect everyone from getting a spike lag or something like that. Ping change every second (it changes faster than every second, but I don't accurately know). If someone gets a lag which make the response between me and the server higher than 3 secs, I'll be considered as a cheater because you pretend to have a protection for avoiding false positive. What about people who are completely desynchronized? They cannot receive nor removed weapons.

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
Where's that done? it's up to the scripter to not return invalid player ids otherwise he's causing problems to himself afaik.
I explained that badly, sorry. I will give you an example here about what I'm talking about.
PHP код:
stock wSetPlayerAmmo(playeridweaponammo)
{
       
weaponsInfo[playerid][Ammo][weapon] = ammo;
    if(!
weaponsInfo[playerid][wImmune]) SetTimerEx("wResetImmune"3000false"i"playerid);
    
weaponsInfo[playerid][wImmune] = true;
    return 
SetPlayerAmmo(playeridweaponammo);

That is completely senseless but it can happens by a certain way.
PHP код:
SetPlayerAmmo(INVALID_PLAYER_ID3099); 
It will obviously result in a run time error. The native function handle that player isn't connected when the hooked function doesn't.

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
He's using the array as weapon ids not weapon slots.
Which is completly false. You can't get every weapons at the same times. You can get only one weapon by slot. That was my point.


By the was Dayrion is way better than Dayerion
Reply
#18

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Which is completly false. You can't get every weapons at the same times. You can get only one weapon by slot. That was my point.
Dude, you still don't understand, I don't use them for slots, these are not used as getting weapons in slot. It's used as weapon ids.Like Weapon(weaponid) = ...
Reply
#19

Quote:

That won't protect nothing and can probably make it worse. You can't set a randomly 3 sec timer to protect everyone from getting a spike lag or something like that. Ping change every second (it changes faster than every second, but I don't accurately know). If someone gets a lag which make the response between me and the server higher than 3 secs, I'll be considered as a cheater because you pretend to have a protection for avoiding false positive. What about people who are completely desynchronized? They cannot receive nor removed weapons.

I dont think you understand the concept here, it will protect the player and i know for a fact that it does seeing as i had many problems which were all fixed by applying this method, i suggest you try it before saying it wont work irrelevantly and saying it would make it worse lol.

Hows that making it worse? That doesnt make any sense, you need to understand that this will protect the player regardless of his ping seeing as it gives the protection first then gives the player a weapon, makes it impossible to get banned falsely by lag.

As for complete desync thats already taken care of in my FL include which is fixed and the OP posted in a bolted note for everyone to see.

Quote:

I explained that badly, sorry. I will give you an example here about what I'm talking about.

Nope i still dont get what youre trying to say here and im pretty sure no one does, how's that going to cause any problems when he returned the same function? Hows it supposed to look like then??

Quote:

Which is completly false. You can't get every weapons at the same times. You can get only one weapon by slot. That was my point.

So how do you counter weapon cheats by only depending on slots? So if a player gets a shotgun at slot 10 then uses cheats to spoof a spas at the same spot youll allow that? Youre very confusing sorry but it really is hard to understand what youre trying to say here. And mb i added an extra E to your name.
Reply
#20

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
I don't get it, that's the point of server-sided weapon anticheats, to force the player's inventory to only contain weapons given to him by the script, can you elaborate further on that?
What I am saying is that if you eliminate the ability of cheating completely then even if someone is cheating they can't have any effect on the game. At this point you can break down the different ways they are cheating if you can make an absolute determination then ban for unusual behavior or you might want to alert the admins to look into it.

Say for instance you give a player a deagle with 10 shots and you only ever allow 10 shots regardless of what the player is doing then there is no such thing as weapon hacking anymore.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)