14.10.2016, 20:24
Hey, my Anti Cheat is kicking innocent players and now I think I understood why
That's the code
That's the anti hack code
Now, I think I got the problem
I debugged it, and I found out that first - It's decreased from the Array
And only after that, its decreased from my GetPlayerAmmo()
Here is the debug
(First line: debug: GetPlayerAmmo() || WeaponAmmo Array)
(Second line (After Array--
: debug: GetPlayerAmmo() || WeaponAmmo Array)
That's the code
PHP Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new string[24];
format(string, sizeof(string), "debug: %d, %d", GetPlayerAmmo(playerid), PlayerInfo[playerid][pWeaponAmmo][GetWeaponSlot(weaponid)]);
print(string);
PlayerInfo[playerid][pWeaponAmmo][GetWeaponSlot(weaponid)]--;
format(string, sizeof(string), "debug: %d, %d", GetPlayerAmmo(playerid), PlayerInfo[playerid][pWeaponAmmo][GetWeaponSlot(weaponid)]);
print(string);
return 1;
}
PHP Code:
forward WeaponHack();
public WeaponHack()
{
new weaponid, ammo, keys, ud, lr;
foreach(new playerid : Player)
{
weaponid = GetPlayerWeapon(playerid); ammo = GetPlayerAmmo(playerid);
if(weaponid != PlayerInfo[playerid][pWeapon][GetWeaponSlot(weaponid)] || ammo != PlayerInfo[playerid][pWeaponAmmo][GetWeaponSlot(weaponid)]) Kick(playerid);
}
return 1;
}
I debugged it, and I found out that first - It's decreased from the Array
PHP Code:
PlayerInfo[playerid][pWeaponAmmo][GetWeaponSlot(weaponid)]--;
Here is the debug
(First line: debug: GetPlayerAmmo() || WeaponAmmo Array)
(Second line (After Array--
: debug: GetPlayerAmmo() || WeaponAmmo Array)Code:
debug: 300, 300 debug: 300, 299

