unlimited ammo bug
#1

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);
Reply
#2

I'd definitely say your saving system. If you bring up the code I may be able to help you with it.
Reply
#3

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]);
		}
Reply
#4

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.
Reply
#5

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.
Reply
#6

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)