01.10.2017, 16:11
I still can't find out an effective way to get this done, I tried OnPlayerWeaponShot, OnPlayerUpdate, repeating timer, Abyss's include. I really can't find out anything working effectively, hackers are still able to increase the weapon's ammo.
This is my new code under OnPlayerWeaponShot:
My custom GivePlayerWeapon function:
These codes sometimes works sometimes not, mostly not.
Any idea how to make it effective enough to prevent ammo hack and false kicks?
This is my new code under OnPlayerWeaponShot:
PHP код:
new slot = GetWeaponSlot(weaponid);
gPlayerAmmo[playerid][slot]--;
if(GetPlayerAmmo(playerid) > 0 && GetPlayerAmmo(playerid) > gPlayerAmmo[playerid][slot] + 15) {
RemovePlayerWeapon(playerid, weaponid);
format(string, sizeof string, "{FF0000}<!> {CC6699}%s has been kicked for ammo hack", GetName(playerid));
SendClientMessageToAll(red, string);
return DelayKick(playerid);
}
else gPlayerAmmo[playerid][slot] = GetPlayerAmmo(playerid);
PHP код:
GivePlayerWeaponEx(playerid, weaponid, ammo) {
new slot = GetWeaponSlot(weaponid);
SetPlayerArmedWeapon(playerid, weaponid);
if(GetWeaponSlot(GetPlayerWeapon(playerid)) == slot) {
gPlayerWeapon[playerid][slot] = true;
gPlayerAmmo[playerid][slot] += ammo;
}
else {
gPlayerWeapon[playerid][slot] = true;
gPlayerAmmo[playerid][slot] = ammo;
}
return GivePlayerWeapon(playerid, weaponid, ammo);
}
Any idea how to make it effective enough to prevent ammo hack and false kicks?