Moderators IIYAMA Posted March 29, 2013 Moderators Share Posted March 29, 2013 I am building something that gives ammo when you are inside a colshape, but the Flamethrower ammo is getting bugged all the time. It jumps from 200 to 23 and back to 153 etc... of course I put a limit on it, but this jumping behaviour is getting very annoying because the clip ammo is also changing a lot. function setPlayerBoxAmmo (player,weaponSlot) local ammoIn = getPedTotalAmmo (player,weaponSlot) local weapon if groupweapon then local weaponset = getElementData(player, "weaponSet") if weaponset then weapon = groupweapon[weaponset][weaponSlot] outputChatBox(weapon .. "weaponslot" .. weaponSlot .. ammoIn) else return end else weapon = getPedWeapon ( player, weaponSlot ) end local ammoLimit = MXammo[weapon] if ammoIn == ammoLimit then return end outputDebugString("ammotrigger") local ammoCont = ammoIn+ammoGiving[weapon] local clip = tonumber(slotForce[weapon]) or 0 if ammoCont > ammoLimit then if ammoIn <= 0 then giveWeapon ( player, weapon, ammoLimit, false ) else --outputChatBox("ammoIn ".. ammoIn) setWeaponAmmo ( player, weapon, ammoLimit, clip) end else if ammoIn <= 0 then giveWeapon ( player, weapon, ammoCont, false ) else if ammoCont > ammoLimit then --giveWeapon ( player, weapon, ammoLimit - ammoIn, false ) setWeaponAmmo ( player, weapon, ammoLimit, clip) else --giveWeapon ( player, weapon, ammoIn+10, false ) setWeaponAmmo ( player, weapon, ammoCont, clip) end end end end Somebody a suggestion, idea's or explanation? Link to comment
Moderators IIYAMA Posted March 29, 2013 Author Moderators Share Posted March 29, 2013 http://bugs.mtasa.com/view.php?id=6639 Give yourself 100 flamethrowerUse getPedTotalAmmo on slot 7 Returns 1000. Caused false positive in my ammo cheat detection script and also if a server saves peoples ammo on quit they can keep quitting and their flame-thrower ammo multiples by ten. exactly..... -_-" Link to comment
DiSaMe Posted March 29, 2013 Share Posted March 29, 2013 When you're firing the weapon, the ammo of the flamethrower decreases slowly and a momentary shot may not decrease the ammo shown in the HUD. But 10 momentary shots will. The point is, the game shows 10 times less of the flamethrower ammo than there truly is - that's how the HUD works. The problem arises from inconsistency between the weapon give/ammo get functions. Weapon giving functions measure the ammo in the same way the HUD does, while ammo get functions use the actual ammo value. Link to comment
Moderators IIYAMA Posted March 30, 2013 Author Moderators Share Posted March 30, 2013 ok Is there any way to fix or prevent it from bugging? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now