[FilterScript] Anticheat for Unlimited Ammo
#1

Anticheat for Unlimited Ammo
Welcome. I want to try create something special. And that it is this script! Unlimited function for Ammo by Timer. It works something like this:

1. Check player ammo -> save to var
2. Start timer about 500 ms
3. Check new palyer ammo and match with old
4. REASON: if they are match -> Send message to admin about potentionaly hacker/cheater but isn't any admin on server, script automatically kick cheater!

I tested this on my server and ever found my cheat!

If player have unlimited ammo -> Freezed!


Код:
new oldammo, newammo;

#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) // If player is on foot (you can make your own anticheat for player in veh)
	{
		if(PRESSED(KEY_FIRE))
		{
			if (HavePlayerWeapon(playerid)) // If player have weapon
			{
				oldammo = GetPlayerAmmo(playerid); // Save variable
				SetTimerEx("CheckAmmo", 500, false, "i", playerid);
			}
			return false;
		}
	}
	return true;
}
Код:
public CheckAmmo(playerid)
{
	newammo = GetPlayerAmmo(playerid);
	if (oldammo == newammo){
	    SendWarningMessage(playerid, "Unlimited Ammo");
	}
	return true;
}
Код:
stock SendWarningMessage(playerid, thread[])
{
	if (AdminsOnline() > 0)
	{
        new str[200];
		for (new i;i<=MAX_PLAYERS_EX;i++)
		{
		    if (IsPlayerConnected(i) && IsPlayerAdmin(i))
		    {
				format(str, sizeof(str),"[ Anticheat] Potentionaly cheater [Nick: %s [ID: %d]] [%s]", GetName(playerid), playerid, thread);
				SendClientMessage(i, 0xFF0000AA, str);
			}
		}
	}
	else
	{
		format(str, sizeof(str),"[ Anticheat] %s has been automatically kicked for %s", GetName(playerid), thread);
		SendClientMessageToAll(0xFF0000AA, str);
		Kick(playerid);
	}
	return true;
}
Код:
stock HavePlayerWeapon(playerid)
{
   switch(GetPlayerWeapon(playerid))
   {
      case 16..18,22..39,41,42: return true;
      default: return false;
   }
}
Код:
AdminsOnline()
{
	new p;
	for(new i=0;i<=MAX_PLAYERS_EX;i++) if(IsPlayerConnected(i)) if(IsPlayerAdmin(i)) p++;
	return p;
}
Thank for comments, (Y)
Reply
#2

Nice but in case you have a deagle and a mp5, both of them with 10 bullets, and you start shooting with deagle and than switching the weapon to mp5 you still have 10 bullets left and you will get wrongly detected as cheater.
Hope you understand what i mean, because i'm from germany
Reply
#3

you must put url download
Reply
#4

oldammo
its shuold be oldammo[playerid]
you need to change the whole script.
Reply
#5

Quote:
Originally Posted by Yagoda
Посмотреть сообщение
oldammo
its shuold be oldammo[playerid]
you need to change the whole script.
Yes, but it should be oldammo[playerid][weaponid] as olaf137 said
Reply
#6

ok i try to fix it. i made it fast and i didn't think about these problems
Reply
#7

Nice release, it may help some people. However, isn't it included on anti-cheats?
Reply
#8

Ehm this might have bugs, like i got a gun with 100 bullets i run around a lil bit but dont shoot will it report me?
Reply
#9

No i have only this function, however i want to make other high protection for samp servers. Include a i haven't but if I release something new I merge it with this UA.
Reply
#10

Quote:
Originally Posted by justsomeguy
Посмотреть сообщение
Ehm this might have bugs, like i got a gun with 100 bullets i run around a lil bit but dont shoot will it report me?
No because it check if player press Shoot Button, if hold/press it means decrease ammo.

People, this isn't 100% protection!! Because 100% protection doesn't exists. But is very high chance to find cheater.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)