23.09.2017, 16:43
Howdy,
I have made an anti spawn ammo hack in my server, which basically kicks the player who spawn AMMO not weapon.
Like you already have the weapon but you spawn ammo for it.
So yeah, It's not working fine in the host at all, I'm using OnPlayerWeaponShot and it keeps kicking the players whenever they shot.
Here's my custom GivePlayerWeapon function:
Here's my OnPlayerWeaponShot:
Any help would be appreciated.
Thanks in advance.
I have made an anti spawn ammo hack in my server, which basically kicks the player who spawn AMMO not weapon.
Like you already have the weapon but you spawn ammo for it.
So yeah, It's not working fine in the host at all, I'm using OnPlayerWeaponShot and it keeps kicking the players whenever they shot.
Here's my custom GivePlayerWeapon function:
PHP код:
new gPlayerAmmo[MAX_PLAYERS][12];
GivePlayerWeaponEx(playerid, weaponid, ammo) {
if(!weaponid) return 0;
gPlayerAmmo[playerid][GetWeaponSlot(weaponid)] = ammo;
return GivePlayerWeapon(playerid, weaponid, ammo);
}
PHP код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(weaponid != 0 && weaponid != 46)
{
if(GetPlayerAmmo(playerid) < gPlayerAmmo[playerid][GetWeaponSlot(weaponid)]) {
gPlayerAmmo[playerid][GetWeaponSlot(weaponid)] = GetPlayerAmmo(playerid);
}
if(!InEvent[playerid] && !InDerby[playerid] && !InTDM[playerid] && !InParkour[playerid] && !InSkydive[playerid] && !InDuel[playerid] && !Info[playerid][InDM] && !InShooter[playerid]) {
if(GetPlayerAmmo(playerid) > 1 && GetPlayerAmmo(playerid) > gPlayerAmmo[playerid][GetWeaponSlot(weaponid)] && GetPlayerVirtualWorld(playerid) == 0) {
RemovePlayerWeapon(playerid, weaponid);
gPlayerWeapon[playerid][GetWeaponSlot(weaponid)] = false;
gPlayerAmmo[playerid][GetWeaponSlot(weaponid)] = 0;
format(string, sizeof string, "{FF0000}<!> {CC6699}%s has been kicked for ammo hack", GetName(playerid));
SendClientMessageToAll(red, string);
return DelayKick(playerid);
}
}
}
return 1;
}
Thanks in advance.