Jump to content

Does any one knows how the Flamethrower gta ammo works?


IIYAMA

Recommended Posts

  • Moderators

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...