20.08.2013, 23:13
I've recently made an Anti Cheat though it's got some flaws which I can't seem to fix. If you're given weapons sever side, it gives you your weapon. However, after around a minute, you get banned for weapon hacking.
This is under my KeyStateChange:
As you can see if it doesn't correspond to the one given serverside, it bans.
This is something I tried using to get it to work but it doesn't, it still bans you.
This is under my KeyStateChange:
pawn Код:
switch(newkeys)
{
//Anti-Cheat (Weapon Checks)
case KEY_AIM:
{
new WeaponData[2];
for(new i = 0; i < 11; i++)
{
GetPlayerWeaponData(playerid, i, WeaponData[0], WeaponData[1]);
//Anti-Cheat Tazer exception.
if(i == 2 && Tazer[playerid] == true && WeaponData[1] == 0)
{
SendClientMessage(playerid, COLOR_RED, "You have discharged your tazer!");
Tazer[playerid] = false;
return _native_GivePlayerWeapon(playerid, Weapons[playerid][2][0], Weapons[playerid][2][1]);
}
if(WeaponData[0] != Weapons[playerid][i][0]) BanPlayer(playerid, "Anti-Cheat", "Weapon Hacking");
if(WeaponData[1] > Weapons[playerid][i][1]) BanPlayer(playerid, "Anti-Cheat", "Ammo Hacking");
}
}
}
This is something I tried using to get it to work but it doesn't, it still bans you.
pawn Код:
_native_GivePlayerWeapon(playerid, WeaponID, Ammo)
{
return GivePlayerWeapon(playerid, WeaponID, Ammo);
}
SF_GivePlayerWeapon(playerid, WeaponID, Ammo)
{
Weapons[playerid][GetWeaponSlot(WeaponID)][0] = WeaponID;
Weapons[playerid][GetWeaponSlot(WeaponID)][1] = Ammo;
GivePlayerWeapon(playerid, WeaponID, Ammo);
}
#if defined _ALS_GivePlayerWeapon
#undef GivePlayerWeapon
#else
#define _ALS_GivePlayerWeapon
#endif
#define GivePlayerWeapon SF_GivePlayerWeapon