Anticheat for Unlimited Ammo -
ylleron - 11.05.2011
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)
Re: Anticheat for Unlimited Ammo -
olaf137 - 11.05.2011
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
Re: Anticheat for Unlimited Ammo -
Skaizo - 11.05.2011
you must put url download
Re: Anticheat for Unlimited Ammo -
Yagoda - 11.05.2011
oldammo
its shuold be oldammo[playerid]
you need to change the whole script.
Re: Anticheat for Unlimited Ammo -
Sasino97 - 11.05.2011
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
Re: Anticheat for Unlimited Ammo -
ylleron - 11.05.2011
ok i try to fix it. i made it fast and i didn't think about these problems
Re: Anticheat for Unlimited Ammo -
MrDeath537 - 11.05.2011
Nice release, it may help some people. However, isn't it included on anti-cheats?
Re: Anticheat for Unlimited Ammo -
justsomeguy - 11.05.2011
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?
Re: Anticheat for Unlimited Ammo -
ylleron - 11.05.2011
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.
Re: Anticheat for Unlimited Ammo -
ylleron - 11.05.2011
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.