14.10.2016, 10:32
Hey guys, I have tested my AC earlier and I found out something
When I tried to grab a gun which I don't have, I got kicked just like I should have
But, when I still could add more AMMO to my gun, when I added a function to block this aswell, I got kicked even if I got the guns legally, anyone ?
This code was working (I didn't get kicked when I got guns from GiveNexWeapons)
When I tried to grab a gun which I don't have, I got kicked just like I should have
But, when I still could add more AMMO to my gun, when I added a function to block this aswell, I got kicked even if I got the guns legally, anyone ?
PHP код:
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;
}
PHP код:
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);
}
}
PHP код:
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);
}
}