SA-MP Forums Archive
GetPlayerAmmo @ OnPlayerWeaponShot - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: GetPlayerAmmo @ OnPlayerWeaponShot (/showthread.php?tid=562226)



GetPlayerAmmo @ OnPlayerWeaponShot - ikey07 - 07.02.2015

Could someone confirm or dismiss this bug I get.

Strangely it happens only with Mp5, when you shot many times in a row, it gets the same amount of bullets twice.
When you shot like 1 bullet per second its fine.


[ame]http://www.youtube.com/watch?v=kTCvb02nEdE[/ame]


And this is by disabling servers AC, it gets twice the same bullet and then goes lower by 2 bullets.




This is the code I use

pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    new string[128];
    format(string,sizeof(string), "WeaponID: %d   Ammo: %d",weaponid,GetPlayerAmmo(playerid));
    SendClientMessage(playerid,-1,string);
    return 1;

}



Re: GetPlayerAmmo @ OnPlayerWeaponShot - Abagail - 07.02.2015

That's because the bullets / ammunition is fired before the server can update the data. This is the only weapon allowing such a fast shooting issue.


Re: GetPlayerAmmo @ OnPlayerWeaponShot - Hanger - 07.02.2015

Pair the if statement with an animation index and tick count. I found some framework months ago for the full list of tick counts, I think it was on either southclaw's or someone elses github..

#If servervar < GetPlayerAmmo && animationindex == shooting anim && (gettime - lastshot) < patched tick
-- servervar = getplayerammo;


Re: GetPlayerAmmo @ OnPlayerWeaponShot - Kar - 07.02.2015

Confirmed yes.