Jump to content

[HELP] getSlotFromWeapon problem


Recommended Posts

Hello guys, I got some problems with getSlotFromWeapon, it says that weapon-type was expected at argument 1, but got 47 (which is the weapon id) even in the wiki it says that the argument 1 should be the weapon id, not weapon type...

function checkPlayerWeapons() 
    for i = 1, 47 do 
        if i ~= 40 then 
        local weapSlot = i == 15 and 10 or getSlotFromWeapon(i) 
            if getPedWeapon(localPlayer, weapSlot) == i then 
                local ammo = getElementData(localPlayer, "safeWeapon" .. i) or 0 
                if ammo < 0 then 
                    ammo = 0 
                    setElementData(localPlayer, "safeWeapon" .. i, 0, false) 
                end 

Link to comment

[quote name=..:D&G:..]Hello guys, I got some problems with getSlotFromWeapon, it says that weapon-type was expected at argument 1, but got 47 (which is the weapon id) even in the wiki it says that the argument 1 should be the weapon id, not weapon type...

function checkPlayerWeapons() 
    for i = 1, 47 do 
        if i ~= 40 then 
        local weapSlot = i == 15 and 10 or getSlotFromWeapon(i) 
            if getPedWeapon(localPlayer, weapSlot) == i then 
                local ammo = getElementData(localPlayer, "safeWeapon" .. i) or 0 
                if ammo < 0 then 
                    ammo = 0 
                    setElementData(localPlayer, "safeWeapon" .. i, 0, false) 
                end 

What are you trying to do here?

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...