SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 11/05/2017, 02:38 PM   #1
JaKe Elite
High-roller
 
JaKe Elite's Avatar
 
Join Date: Apr 2012
Location: Philippines
Posts: 3,631
Reputation: 444
Post Fight Against Undetectable weapon Hacks

Update;
Quote:
Originally Posted by JaKe Elite View Post
Thread Updated

~ Please keep in mind, If you are looking for the Anticheat for those Regular Weapon Hacks then this isn't the place for you use the SEARCH button. This anticheat only works for those Weapon Hacks which uses CLEO Mod & SAMPFUNCS.
I am not sure if this has been posted here yet but I did like to share yall something, An anti cheat against those so-called "undetectable weapon hacks". The hacks works like this they type in something which alerts the script to make their spawned hack weapons to be undetectable by the server, they then attack the players with those spawned weapons while in reality on server's perspective view they are holding nothing.

So basically, You can actually detect if they are weapon hacking and I have found my own method. You can use OnPlayerGiveDamage and check if they are giving damages to players with their bare hands if the weapons they used to give damage to the player isn't a bare hand they are possibly 99.9% weapon hacking with this so-called "undetectable weapon hack". I haven't tested this on a public server, however, I tried it on my NPC and the debug works, you may try it out yourself.

Any feedbacks are welcome, you may post your feedbacks below.

Bulleted Weapons Detection (Damage Block)

PHP Code:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloatfXFloatfYFloatfZ)
{
    
// Checks if playerid has weaponID 0, and it also checks if the weaponid OnPlayerWeaponShot.
    // If the weaponid OPWS isn't zero then they are probably hacking - CHECK IF THEY ARE DESYNC THOUGH.
    
if(GetPlayerWeapon(playerid) == && weaponid != 0)
    {
        return 
0// Blocks bullets from being sent to the server client to player client.
    
}
    return 
1;

Not Bulleted Weapons Detection (No Damage Block)
PHP Code:
public OnPlayerGiveDamage(playeriddamagedidFloat:amountweaponidbodypart)
{
    
// Checks if the playerid (The player who damages the other player) is not holding any weapon.
    // If the weaponid used to attack the other players aren't zero (null) then they are possibly weapon hacking with this undetectable weapon hack.
    
if(GetPlayerWeapon(playerid) == && weaponid != 0)
    {
        
// Your code here
    
}
    return 
1;

__________________

Click here to connect to Opis Gaming Roleplay
Known as Elaine Patterson on Opis-Gaming Roleplay (Server Admin)

Last edited by JaKe Elite; 11/05/2017 at 11:48 PM.
JaKe Elite is online now   Reply With Quote
Old 11/05/2017, 02:45 PM   #2
CamiloItchon
Little Clucker
 
CamiloItchon's Avatar
 
Join Date: Nov 2014
Posts: 4
Reputation: 0
Default Re: Fight Against Undetectable weapon Hacks

this will prevent losers to get in a server but just to hack and other shit. Good job, Jake.
__________________
money is power, power is money.
CamiloItchon is offline   Reply With Quote
Old 11/05/2017, 02:59 PM   #3
Yuri8
Big Clucker
 
Join Date: Nov 2016
Posts: 62
Reputation: 0
Default Re: Fight Against Undetectable weapon Hacks

GG man !
Yuri8 is offline   Reply With Quote
Old 11/05/2017, 03:01 PM   #4
coool
Huge Clucker
 
Join Date: Feb 2013
Location: Pakistan, Sindh
Posts: 450
Reputation: 23
Default Re: Fight Against Undetectable weapon Hacks

Very nice hack ending.
__________________
My Writing Works
Lost In Future

coool is offline   Reply With Quote
Old 11/05/2017, 03:03 PM   #5
Battlezone
Gangsta
 
Battlezone's Avatar
 
Join Date: Aug 2013
Posts: 832
Reputation: 134
Default Re: Fight Against Undetectable weapon Hacks

This should also be taken in consideration in next SA-MP update @Kalcor , instead of us having to code it in each gm.. Many people don't and will not know about this I believe
__________________
Battlezone is online now   Reply With Quote
Old 11/05/2017, 05:01 PM   #6
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 11,049
Reputation: 2647
Default Re: Fight Against Undetectable weapon Hacks

Related: http://forum.sa-mp.com/showthread.php?t=535559
__________________
Vince is offline   Reply With Quote
Old 11/05/2017, 06:02 PM   #7
Abagail
High-roller
 
Join Date: Dec 2013
Location: GetPlayerPos(playerid, pos); Scripter/Mapper.
Posts: 3,430
Reputation: 406
Default Re: Fight Against Undetectable weapon Hacks

This simply disables the server from detecting spawned in weapons through GetPlayerWeapon (and other similar functions). All bullet and other data is still processed, meaning you can also detect this through OnPlayerWeaponShot for shootable weapons (although possible desync or lag should be taken into account).

Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float: fX, Float: fY, Float: fZ)
{
      if(GetPlayerWeapon(playerid)) != weaponid || GetPlayerWeapon(playerid) == 0)
      {
           // possibly hacking, more checks needed
           return false;
      }

      return true;
}
Abagail is offline   Reply With Quote
Old 11/05/2017, 06:52 PM   #8
JaKe Elite
High-roller
 
JaKe Elite's Avatar
 
Join Date: Apr 2012
Location: Philippines
Posts: 3,631
Reputation: 444
Default Re: Fight Against Undetectable weapon Hacks

The health & armor can be resetted back once they got the damage OnPlayerGiveDamage, though this is a bad idea on my perspective. I have chosen OnPlayerGiveDamage for a reason (none bulleted weapons doesnt get called OnPlayerWeaponShot) however OnPlayerWeaponShot could work too except that this callback gets called for bullet weapons only.
__________________

Click here to connect to Opis Gaming Roleplay
Known as Elaine Patterson on Opis-Gaming Roleplay (Server Admin)
JaKe Elite is online now   Reply With Quote
Old 11/05/2017, 06:56 PM   #9
Abagail
High-roller
 
Join Date: Dec 2013
Location: GetPlayerPos(playerid, pos); Scripter/Mapper.
Posts: 3,430
Reputation: 406
Default Re: Fight Against Undetectable weapon Hacks

Quote:
Originally Posted by JaKe Elite View Post
The health & armor can be resetted back once they got the damage OnPlayerGiveDamage, though this is a bad idea on my perspective. I have chosen OnPlayerGiveDamage for a reason (none bulleted weapons doesnt get called OnPlayerWeaponShot) however OnPlayerWeaponShot could work too except that this callback gets called for bullet weapons only.
That's not wrong, GiveDamage could also be used for detecting melees or projectiles. The benefit of using OnPlayerWeaponShot for shootable weapons is that you can completely disregard every single bullet they shoot, meaning players won't be affected by hacked bullets at all (meaning no health or armor is ever lost). You're also able to detect hacked bullets that don't hit or damage a player as well.
Abagail is offline   Reply With Quote
Old 11/05/2017, 07:11 PM   #10
JaKe Elite
High-roller
 
JaKe Elite's Avatar
 
Join Date: Apr 2012
Location: Philippines
Posts: 3,631
Reputation: 444
Default Re: Fight Against Undetectable weapon Hacks

Quote:
Originally Posted by Abagail View Post
That's not wrong, GiveDamage could also be used for detecting melees or projectiles. The benefit of using OnPlayerWeaponShot for shootable weapons is that you can completely disregard every single bullet they shoot, meaning players won't be affected by hacked bullets at all (meaning no health or armor is ever lost). You're also able to detect hacked bullets that don't hit or damage a player as well.
I will update the thread tomorrow with my new experiments, I will also include the OnPlayerWeaponShot callback. Any thoughts so far if this is realiable or not, well at least it worked for me.
__________________

Click here to connect to Opis Gaming Roleplay
Known as Elaine Patterson on Opis-Gaming Roleplay (Server Admin)
JaKe Elite is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Anti Weapon hacks sscarface Scripting Help 2 02/07/2015 02:50 PM
Anti Weapon hacks STONEGOLD Scripting Help 3 24/06/2015 03:10 PM
[FilterScript] Music | Anti jet-pack hacks | Anti weapon hacks LeXuZ Filterscripts 3 23/10/2014 07:15 PM
Anti Weapon Hacks, Flooding Chat UnknownGamer Scripting Help 12 05/12/2012 01:21 PM
Anti Weapon Hacks Not Working Medardo4Life Scripting Help 5 27/11/2011 10:40 PM


All times are GMT. The time now is 11:59 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.