unlimited ammo bug - 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: unlimited ammo bug (
/showthread.php?tid=457396)
unlimited ammo bug -
dominik523 - 11.08.2013
Hello! I have little problem. When I played, I gave myself a desert eagle with 99999 bullets, so I have unlimited ammo. After I connected again to the server, I tried to switch from fist to desert eagle by scrolling with my mouse. I could equip my gun, but after a less then a second, my gun is not equipped anymore. Is this a samp bug, or my saving system is not working properly.
I got only this piece of code:
Код:
GiveDodWeapon(playerid, 24,99999);
Re: unlimited ammo bug -
Dokins - 11.08.2013
I'd definitely say your saving system. If you bring up the code I may be able to help you with it.
Re: unlimited ammo bug -
dominik523 - 11.08.2013
thank you Dokins, this is the code for weapons:
Код:
pWeapon[13], // my two weapon enums
pWeaponAmmo[13],
.
.
for(new i = 0; i < 13; i++) // I've put this in OnPlayerSpawn
{
if(PlayerInfo[playerid][pWeapon][i]) GiveDodWeapon(playerid, PlayerInfo[playerid][pWeapon][i], PlayerInfo[playerid][pWeaponAmmo][i]);
}
Re: unlimited ammo bug -
Alternative112 - 11.08.2013
Definitely some kind of script problem. Do you still have the deagle after it switches you back to fists? if not, something in your script is taking the deagle away, so look for code where it sets the ammo to 0 or for ResetPlayerWeapons(). If your inventory still says you have a deagle, I would say something is doing SetPlayerArmedWeapon() in your script and causing it.
Re: unlimited ammo bug - Emmet_ - 11.08.2013
Try giving 60,000 bullets instead of 99,999. AFAIK, the SA-MP ammo values are 16-bit integers, meaning they can only store between 1 and 65,536. 99,999 wraps to -34463, which would explain why you can't equip the gun.
Re: unlimited ammo bug -
dominik523 - 11.08.2013
thank you so much Emmet

that's right, when I tried to see my weapons in game, ammo was -34463.
EDIT: I got a problem again. I got this as ammo and I cant equip it :/

EDIT 2: I've set ammo this time to 10100 and its works. Thank you all from helping me