stock GiveNexWeapon(playerid, weaponid, ammo)
{
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
PlayerInfo[playerid][pWeapon][GetWeaponSlot(weaponid)] = weaponid;
PlayerInfo[playerid][pWeaponAmmo][GetWeaponSlot(weaponid)] = ammo;
GivePlayerWeapon(playerid, weaponid, ammo);
return 1;
}
forward WeaponHack();
public WeaponHack()
{
new weaponid, ammo;
foreach(new playerid : Player)
{
weaponid = GetPlayerWeapon(playerid), ammo = GetPlayerAmmo(playerid);
if(weaponid != PlayerInfo[playerid][pWeapon][GetWeaponSlot(weaponid)] || ammo != PlayerInfo[playerid][pWeaponAmmo][GetWeaponSlot(playerid)]) Kick(playerid);
}
}
forward WeaponHack();
public WeaponHack()
{
new weaponid, ammo;
foreach(new playerid : Player)
{
weaponid = GetPlayerWeapon(playerid), ammo = GetPlayerAmmo(playerid);
if(weaponid != PlayerInfo[playerid][pWeapon][GetWeaponSlot(weaponid)]) Kick(playerid);
}
}
I will suggest u to use server sided anti ammo hack system it will be helpful. no one can even hack ammo in game if u add it
|
//Top of your script
new bool:Weapon[MAX_PLAYERS][47];
//OnPlayerDisconnect/Connect
for(new i; i < 46; i++) Weapon[playerid][i] = false;
//Somewhere in your script
GivePlayerWeaponEx(playerid, weaponid, ammo)
{
Weapon[playerid][weaponid] = true;
return GivePlayerWeapon(playerid,weaponid,ammo);
}
ResetPlayerWeaponsEx(playerid)
{
for(new i; i < 46; i++) Weapon[playerid][i] = false;
return ResetPlayerWeapons(playerid);
}
//Make timer to check whether the player is hacking or not
new weaponid, ammo;
for (new x = 0; x <= 12; x++)
{
GetPlayerWeaponData(playerid, x, weaponid, ammo);
if(weaponid > 0 && weaponid != 46 && Weapon[playerid][weaponid] == false)
{
ResetPlayerWeapons(playerid)
return Kick(playerid);
}
}
Hello.
So that I understood this right: You give your weapon (which you already have) more ammo (maybe you have 25 ammo and give plus 25, so that you have 50) and you will kick from the server, won't you? If that's right can you show us how you try to give the weapon more ammo? |
ammo != PlayerInfo[playerid][pWeaponAmmo][GetWeaponSlot(playerid)] |
Well, to explain your problem:
When INGAME ammo is NOT equal with the SAVED ammo, then Kick(playerid). When you got this line out, you told your gamemode not to check for ammo. Try to find out how the ammo is saved and in what file/path. |