SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 26/05/2018, 01:22 AM   #1
Banana_Ghost
Huge Clucker
 
Banana_Ghost's Avatar
 
Join Date: Jul 2011
Location: United States
Posts: 253
Reputation: 45
Default Damage Mod Detection

This include detects damage mods. Damage mods are basically a cheat that allows you to take a lower damage than the weapon actually gives, thus keeping you alive longer.

The way this script detects players damage modding is pretty interesting. It checks the shooter for the amount of damage they would want to take from another player. Meaning if I had damage mods and I shot another player, it would call the callback because I'm damage modding.

OnPlayerGiveDamage returns the following in the callback:
  • playerid - The player that issued the damage.
  • damagedid - The player that is supposed to take the damage.
  • amount - The amount of damage your character wants to take.
  • weaponid - The weapon that is giving the damage.
  • bodypart - The bodypart the damage is being given to.

Basically, it works without the player having damage mods being shot. All the player has to do is shoot someone while having them and they'll be detected.

UPDATE: May 29th, 2018:
If you wish to use OnPlayerTakeDamage for players that aren't shooting, but you want them detected. Do:
PHP Code:
#define DM_USE_OPTD 
before including this script.

The callback below has been updated to include the person that was involved with the detection as well.

Add this to your script and from there decide what to do with the damage modder:
PHP Code:
public OnPlayerDamageModding(suspectidinvolvedidweaponidFloat:damageamt)
{

    return 
1// This callback doesn't handle returns

Pastebin Link

Last edited by Banana_Ghost; 29/05/2018 at 04:25 PM.
Banana_Ghost is offline   Reply With Quote
Old 26/05/2018, 02:05 AM   #2
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,144
Reputation: 345
Default Re: Damage Mod Detection

Not sure if this is going to return false positives on several cases depending on range/lag and whatnot but overall, shouldn't this:
Code:
OnPlayerDamageModding(playerid, weaponid, amount);
Have damagedid instead? since you said an i quote:
Quote:
a cheat that allows you to take a lower damage than the weapon actually gives
So the cheater is the one taking damage not giving damage, no?
__________________
Quote:
I'm not using the forum to release stuff anymore, if you want updates for my releases or to check my new releases check the links below >
Quote:
Originally Posted by Escobar ⚠
Life sucked me in and shat me on the cruel world.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Old 26/05/2018, 04:07 AM   #3
Kar
High-roller
 
Kar's Avatar
 
Join Date: May 2010
Location: Black Asylum
Posts: 3,184
Reputation: 506
Default Re: Damage Mod Detection

Cool cool, weapon-config kinda does this.

Doesn't seem like you considered different weapon skills tho s:
Kar is offline   Reply With Quote
Old 26/05/2018, 04:15 AM   #4
tungki
Little Clucker
 
tungki's Avatar
 
Join Date: Nov 2012
Location: Indonesia
Posts: 29
Reputation: 1
Default Re: Damage Mod Detection

Good job
__________________
Forum Indonesia
tungki is offline   Reply With Quote
Old 26/05/2018, 04:42 AM   #5
Banana_Ghost
Huge Clucker
 
Banana_Ghost's Avatar
 
Join Date: Jul 2011
Location: United States
Posts: 253
Reputation: 45
Default Re: Damage Mod Detection

Quote:
Originally Posted by RogueDrifter View Post
Not sure if this is going to return false positives on several cases depending on range/lag and whatnot but overall, shouldn't this:
Code:
OnPlayerDamageModding(playerid, weaponid, amount);
Have damagedid instead? since you said an i quote:

So the cheater is the one taking damage not giving damage, no?
The cheater is the one giving the damage. OPGD's amount returns the damage the shooter would've taken with the same shot .

As far as range, lag, and what not are concerned, weapons in GTA don't differ damages by distance and stuff. A body hit with a deagle will always give 46.2___ so on and forth.

Quote:
Originally Posted by Kar
Cool cool, weapon-config kinda does this.

Doesn't seem like you considered different weapon skills tho s:
It's something I made a while back that I never considered releasing. If I get the time, I'll mess around with the skill levels and such and see what I can come of it.
Banana_Ghost is offline   Reply With Quote
Old 29/05/2018, 02:00 PM   #6
Banana_Ghost
Huge Clucker
 
Banana_Ghost's Avatar
 
Join Date: Jul 2011
Location: United States
Posts: 253
Reputation: 45
Default Re: Damage Mod Detection

@Kar
After some research into the different skill levels, there doesn't seem to be an issue with the skill levels and this. Weapons still give the same amount of damage when single or duel wielded. Duel wielding just allows faster shooting.
Banana_Ghost is offline   Reply With Quote
Old 29/05/2018, 03:43 PM   #7
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,144
Reputation: 345
Default Re: Damage Mod Detection

Quote:
Originally Posted by Banana_Ghost View Post
The cheater is the one giving the damage. OPGD's amount returns the damage the shooter would've taken with the same shot .

As far as range, lag, and whatnot are concerned, weapons in GTA don't differ damages by distance and stuff. A body hit with a Deagle will always give 46.2___ so on and forth.
If so then why not call the callback on both the player taking damage at OnPlayerTakeDamage and giving damage at OnPlayerGiveDamage to get the accurate result? what if the cheater doesn't hit others and just takes damage?

What if he decreases the damage of all weapons to 0 except the M4 and keeps killing others with M4?
__________________
Quote:
I'm not using the forum to release stuff anymore, if you want updates for my releases or to check my new releases check the links below >
Quote:
Originally Posted by Escobar ⚠
Life sucked me in and shat me on the cruel world.

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Old 29/05/2018, 04:22 PM   #8
Banana_Ghost
Huge Clucker
 
Banana_Ghost's Avatar
 
Join Date: Jul 2011
Location: United States
Posts: 253
Reputation: 45
Default Re: Damage Mod Detection

Quote:
Originally Posted by RogueDrifter View Post
If so then why not call the callback on both the player taking damage at OnPlayerTakeDamage and giving damage at OnPlayerGiveDamage to get the accurate result? what if the cheater doesn't hit others and just takes damage?

What if he decreases the damage of all weapons to 0 except the M4 and keeps killing others with M4?
The code was originally wrote to work with OnPlayerTakeDamage, check the topic for a modified version where you can enable OnPlayerTakeDamage if you wish to.

If he keeps using the M4 to shoot and the damage he would take isn't modified, then he technically isn't cheating for the moment, but if he changes weapons to one that is modified, then of course the script will take care of it.
Banana_Ghost is offline   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
Damage/Hit System - Sistema de Damage/Hit Franco33 Scripting Help 0 20/08/2016 04:53 AM
[FilterScript] Easy custom damage + damage sound Voxel Filterscripts 14 30/09/2013 04:07 PM
How to detect vehicle damage, and get damage taken? Micius Scripting Help 4 31/07/2013 04:08 PM
[Include] Car damage system - Damage a car without a driver! The_Moddler Includes 68 30/03/2012 01:38 AM


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


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