[Include] Anti-MGB(stops a dangerous cleo mod)
#1

This script stops the below mod

https://www.youtube.com/watch?v=S7nQRUgVQYk

http://pastebin.com/8zrqi5EU

Save that to antiMGB.inc

add #include <antiMGB> to the top of your game mode

pawn Code:
public OnMGBullDetected(playerid)
{
    if(!IsPlayerAdmin(playerid))
    {
        //kick/ban/warn etc whatever you want here
    }
    return 1;
}
Reply
#2

Trying to check "weaponid" as 0 won't be working. AFAIK, weaponid 0 doesn't get called. Secondly, usage of pVars here are not necessary. You could use static arrays to store data than using pVars. Weapons like assault rifles or sub-machine guns can get fired in less than a second. "GetTickCount" would have been always better than "gettime" as it returns milliseconds passed by. Only the first part of the include seems to be like the one which you've specified, the other seems like it's rapid firing. For rapid fires, there's an include already released by me :
https://sampforum.blast.hk/showthread.php?tid=496637

However, you can get things released better than it. Lastly, I've seen that the callback isn't hooked. You've used the defines of hooking, but it hasn't been implemented on that callback too.
Reply
#3

Quote:
Originally Posted by Lordz™
View Post
Trying to check "weaponid" as 0 won't be working. AFAIK, weaponid 0 doesn't get called. Secondly, usage of pVars here are not necessary. You could use static arrays to store data than using pVars. Weapons like assault rifles or sub-machine guns can get fired in less than a second. "GetTickCount" would have been always better than "gettime" as it returns milliseconds passed by. Only the first part of the include seems to be like the one which you've specified, the other seems like it's rapid firing. For rapid fires, there's an include already released by me :
https://sampforum.blast.hk/showthread.php?tid=496637

However, you can get things released better than it. Lastly, I've seen that the callback isn't hooked. You've used the defines of hooking, but it hasn't been implemented on that callback too.
Checking for 0 works just fine, not sure what the mod does but when you use it with fists in your hand OnPlayerWeaponShot is definately called.

Pvars work just fine here

The code doesnt' check if you shoot faster then once a second it checks if you shoot 9 bullets per second wich is faster then ak-47s and m4s.

This is a small snippet I wrote for my server to deflect against this hack and it works just fine. I haven't read over your code to well but wouldn't your code throw false positives for people drivbuying out of cars?

I've never used the default hooks before just y_hooks but i didn't want people to have to include other libraries just to use it.
Reply
#4

Quote:
Originally Posted by r3ct
View Post
Checking for 0 works just fine, not sure what the mod does but when you use it with fists in your hand OnPlayerWeaponShot is definately called.

Pvars work just fine here

The code doesnt' check if you shoot faster then once a second it checks if you shoot 9 bullets per second wich is faster then ak-47s and m4s.

This is a small snippet I wrote for my server to deflect against this hack and it works just fine. I haven't read over your code to well but wouldn't your code throw false positives for people drivbuying out of cars?

I've never used the default hooks before just y_hooks but i didn't want people to have to include other libraries just to use it.
I suggest you to check once more in regarding fists getting called on OnPlayerWeaponShot. A small snippet for debugging?
pawn Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(weaponid == 0) printf("WEAPON ID 0 HAS BEEN CALLED!");
    return 1;
}
Because melee weapons aren't being called under it as it's "WeaponShot" callback. If 0 gets called, I'm really amazed! About PVars - it's generally slow. And here, PVars aren't required. PVars are only needed if you're using it on other scripts too, like global player-variables.

9 shots may not get called, however the warning gets counted when 2-3 shots are called per-second. I haven't checked my code for driveby weapons such as Desert Eagle, thanks for reminding me. However, it provides a callback to give those an exception.

And finally, I don't use y_hooks, neither any of YSI libraries. What you said is right, getting this included with one more library don't seem to be fit from my view too. You've done the hooking part, but the code under it don't get called. You can view tutorials of hooking and see what's the mistake you've done.

This is a small suggestion, I haven't tried it tho. From the video, it seems like there's no animation while shots are going on. So, how about checking the animations? That might get worked.
Reply
#5

This particular cheat creates bullets so it may or may not be called, just keep that in mind.

Quote:
Originally Posted by r3ct
View Post
Pvars work just fine here
Just because it works it doesn't mean that it's the right thing to do. There are very few cases where PVars are ever useful, this isn't one of them. Consider that they are much slower than regular variables and that OnPlayerWeaponShot is called very frequently.
Reply
#6

Quote:
Originally Posted by Vince
View Post
This particular cheat creates bullets so it may or may not be called, just keep that in mind.
Its called every single time without fail i've been testing it for days. I have the hack installed.
Reply
#7

Quote:
Originally Posted by Lordz™
View Post
I suggest you to check once more in regarding fists getting called on OnPlayerWeaponShot. A small snippet for debugging?
pawn Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(weaponid == 0) printf("WEAPON ID 0 HAS BEEN CALLED!");
    return 1;
}
Because melee weapons aren't being called under it as it's "WeaponShot" callback. If 0 gets called, I'm really amazed! About PVars - it's generally slow. And here, PVars aren't required. PVars are only needed if you're using it on other scripts too, like global player-variables.

This is a small suggestion, I haven't tried it tho. From the video, it seems like there's no animation while shots are going on. So, how about checking the animations? That might get worked.
The animations are there on the players perspective so that would not work. If the client doesn't have the hack installed then no your code wont get called but I have a code in my script that warns the admins when a level has a gun. When I set myself as level one in game and use the hack with no gun in my hand it spams the fuck out of my screen thats how i found out its called with the hack installed. Regardless of what gun is in your hand its creating bullets from your player wich means it definately is being called.

I will look into the hooking, and make a more accurate one when I wake up thanks for the tips with pvars.
Reply
#8

Quote:
Originally Posted by r3ct
View Post
Its called every single time without fail i've been testing it for days. I have the hack installed.
The performance will be decreased, try to do some speed test with regular variables and PVars. You will see the result.
Reply
#9

It's actually a bad idea to use y_hooks for this because order means a lot you want this to be done before any other OnPlayerWeaponShot() hooks are called to prevent your system from even seeing anything illegitimate. This is a good prevention measure approach to take and will work for any server by making sure that patches are hooked FIRST.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)