SA-MP Forums Archive
OnPlayerWeaponShoot problem. [Solved] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerWeaponShoot problem. [Solved] (/showthread.php?tid=570670)



OnPlayerWeaponShoot problem. [Solved] - TheCoopster - 12.04.2015

I've been having a problem with the OnPlayerWeaponShoot callback, and I was just wondering if what I've actually coded is going to work, it's basically an anti-ammo hack I thought could work.

Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) {
	if(PlayerInfo[playerid][pLogged]) {
		new wepsl = GetWeaponSlot(weaponid);
		PlayerInfo[playerid][pAmmo][wepsl] -= 1;
		
		if(PlayerInfo[playerid][pAmmo] != GetPlayerAmmo(playerid)) {
		    SendAdminMessage(COLOR_LIGHTRED,"AdmWarn: %s may possibly be ammo hacking (%s)(Current Ammo: %d)(Actual Ammo: %d)", PlayerName(playerid, false), GetWeaponNameEx(weaponid), PlayerInfo[playerid][pAmmo], GetPlayerAmmo(playerid));
		    Log("Files/Logs/weaponhacks.log","%s may possibly be ammo hacking (%s)(Current Ammo: %d)(Actual Ammo: %d)", PlayerName(playerid, false), GetWeaponNameEx(weaponid), PlayerInfo[playerid][pAmmo], GetPlayerAmmo(playerid));
		}
	}
	return 1;
}
I'm not 100% if this will actually work, it's not actually calling the function I don't think but either way I'd like to know how to fix it and if possible if this code will actually work once the callback is called.


Re: OnPlayerWeaponShoot problem. - TheCoopster - 12.04.2015

Nevermind, I solved it. I never enabled Lagcomp. Thanks anyway!