SA-MP Forums Archive
OnPlayerWeaponShot - 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: OnPlayerWeaponShot (/showthread.php?tid=507576)



OnPlayerWeaponShot - audriuxxx - 18.04.2014

Hi,

This callback is called then when you shoot with gun. But problem is i do anti no reload system. I know in this forum there is some, but i still need to ask. I have made a test, when you shoot with weapon:

Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
	new WEASTRING[ 128 ];
	format( WEASTRING, 120,"%d", GetPlayerWeaponAmmo(playerid,weaponid) );
	SendClientMessage( playerid, -1, WEASTRING );
	return 1;
}

stock GetPlayerWeaponAmmo(playerid,weaponid)
{
	new wd[2][13];
 	for(new i; i<13; i++) GetPlayerWeaponData(playerid,i,wd[0][i],wd[1][i]);
  	for(new i; i<13; i++)
  	{
  		if(weaponid == wd[0][i]) return wd[1][i];
  	}
  	return 0;
}
And when i shooting for ex: with minigun (i have in first 500 ammo) then i have print that:


Код:
500
499
499
499
488
487
486
486
486
485
484
483
482
481
481
481
480
How you see there is some numbers which is repeating.. I mean that this callback is called, but ammo is same. And then how much with good computer and good server hosting, and if server is empty, how much times the most this callback can get called, when ammo of minigun will be get with other value?