Anti ammo hack
#31

Here I'll share my Anti Ammo Hack in my Survival gamemode using OPWS. erm not perfect but it detects Unlimited Ammo and Ammo Hacking.
I haven't tried on desync players. if player is desync even though not hacking they will be detect as hacking. So good luck on improving.

every player shoots an ammo from their weapon OPWS will be called. So Basically I add subtraction code of especific ammo with ttheir weapons and check if the client side ammo is greater ethan the server side ammo 2x or 3x it means the player is cheating.

*note: the reason why I add +10 isi because the ammo of the client lose an ammo before it calls the opws.
(honestly I'm not sure aobut what I'm talking about lol but based on my experrience I try my best to explain )
Code:
switch(weaponid)
	{
		case 25..34:
		{
			PlayerData[playerid][pPrimaryAmmo]--;
			//format(szString, sizeof(szString), "Weapon: %s Ammo: %d", GetWeaponNameEx(PlayerData[playerid][pPrimaryGun]), PlayerData[playerid][pPrimaryAmmo]);
			//SendClientMessageEx(playerid, COLOR_WHITE, szString);
			if(GetPlayerAmmo(playerid) > PlayerData[playerid][pPrimaryAmmo]+10) // Add +10 or +5 it depends on how your server syncing performed.
			{
				SetPVarInt(playerid, "AmmoHacking", GetPVarInt(playerid, "AmmoHacking")+1);
				if(GetPVarInt(playerid, "AmmoHacking") > 2)
				{
					ServerSecurityMessage(GetPlayerNameEx(playerid), "Kick", "Ammo Hacking");
					KickEx(playerid);
					return 1;
				}
			}

			if(PlayerData[playerid][pPrimaryAmmo] <= 0) 
			{
				//SendClientMessage(playerid, COLOR_WHITE, "Out of Ammo");
				PlayerData[playerid][pPrimaryGun] = 0;
				//RemovePlayerAttachedObject(playerid, ATTACH_PRIMARYWEAPON);
			}

		}
		case 22..24:
		{
			PlayerData[playerid][pSecondaryAmmo]--;
			//format(szString, sizeof(szString), "Weapon: %s Ammo: %d", GetWeaponNameEx(PlayerData[playerid][pSecondaryGun]), PlayerData[playerid][pSecondaryAmmo]);
			//SendClientMessageEx(playerid, COLOR_WHITE, szString);
			if(GetPlayerAmmo(playerid) > PlayerData[playerid][pSecondaryAmmo]+10)
			{
				SetPVarInt(playerid, "AmmoHacking", GetPVarInt(playerid, "AmmoHacking")+1);
				if(GetPVarInt(playerid, "AmmoHacking") > 2)
				{
					ServerSecurityMessage(GetPlayerNameEx(playerid), "Kick", "Ammo Hacking");
					KickEx(playerid);
					return 1;
				}
			}
			if(PlayerData[playerid][pSecondaryAmmo] <= 0) 
			{
				//SendClientMessage(playerid, COLOR_WHITE, "Out of Ammo");
				PlayerData[playerid][pSecondaryGun] = 0;
				//RemovePlayerAttachedObject(playerid, ATTACH_SECONDARYWEAPON);
			}
		}
	}
Reply


Messages In This Thread
Anti ammo hack - by oMa37 - 23.09.2017, 16:43
Re: Anti ammo hack - by Logic_ - 23.09.2017, 17:03
Re: Anti ammo hack - by oMa37 - 23.09.2017, 17:05
Re: Anti ammo hack - by GoldenLion - 23.09.2017, 19:55
Re: Anti ammo hack - by NaS - 24.09.2017, 08:55
Re: Anti ammo hack - by oMa37 - 24.09.2017, 12:19
Re: Anti ammo hack - by Kane - 24.09.2017, 12:51
Re: Anti ammo hack - by oMa37 - 24.09.2017, 13:05
Re: Anti ammo hack - by Paulice - 24.09.2017, 14:28
Re: Anti ammo hack - by AbyssMorgan - 27.09.2017, 17:16
Re: Anti ammo hack - by oMa37 - 27.09.2017, 17:45
Re: Anti ammo hack - by AbyssMorgan - 27.09.2017, 17:48
Re: Anti ammo hack - by oMa37 - 27.09.2017, 17:54
Re: Anti ammo hack - by AbyssMorgan - 27.09.2017, 17:56
Re: Anti ammo hack - by AbyssMorgan - 27.09.2017, 18:21
Re: Anti ammo hack - by oMa37 - 27.09.2017, 18:21
Re: Anti ammo hack - by jlalt - 27.09.2017, 18:26
Re: Anti ammo hack - by oMa37 - 27.09.2017, 18:42
Re: Anti ammo hack - by GaByM - 27.09.2017, 19:09
Re: Anti ammo hack - by oMa37 - 01.10.2017, 16:11
Re: Anti ammo hack - by AbyssMorgan - 01.10.2017, 16:15
Re: Anti ammo hack - by oMa37 - 01.10.2017, 16:21
Re: Anti ammo hack - by oMa37 - 02.10.2017, 11:51
Re: Anti ammo hack - by jlalt - 02.10.2017, 17:32
Re: Anti ammo hack - by xo - 02.10.2017, 19:15
Re: Anti ammo hack - by m4karow - 02.10.2017, 19:16
Re: Anti ammo hack - by xo - 02.10.2017, 19:19
Re: Anti ammo hack - by Evocator - 02.10.2017, 19:33
Re: Anti ammo hack - by m4karow - 02.10.2017, 20:04
Re: Anti ammo hack - by oMa37 - 03.10.2017, 04:39
Re: Anti ammo hack - by ToiletDuck - 03.10.2017, 06:24
Re: Anti ammo hack - by oMa37 - 03.10.2017, 11:49

Forum Jump:


Users browsing this thread: 1 Guest(s)