Jump to content

Warning Admin-System


maksulr

Recommended Posts

Hello. I apologize in advance for my English. What can be done with this warning:

WARNING: admin-system\Player\s_player_commands.lua:734: Expected number, got non-convertible string. This warning may be an error in future versions.

Here is the warning line:

Quote

function loadWeaponStats()
    for id = 0, 45, 1 do
        if id ~= 19 and id ~= 20 and id ~=21 then
            local tmp = getAmmoPerClip(id)
            if tmp == "disable" then
                setWeaponProperty( id , "std", "maximum_clip_ammo", 0)
            else
                setWeaponProperty( id , "std", "maximum_clip_ammo", tmp)
            end
        end
    end
end
addEventHandler ( "onResourceStart", getRootElement(), loadWeaponStats )

Thankful in advance for the answer and the help.

Link to comment
15 hours ago, maksulr said:

Hello. I apologize in advance for my English. What can be done with this warning:


WARNING: admin-system\Player\s_player_commands.lua:734: Expected number, got non-convertible string. This warning may be an error in future versions.

Here is the warning line:

Thankful in advance for the answer and the help.

Your function 'getAmmoPerClip' is returning a string so the line: setWeaponProperty( id , "std", "maximum_clip_ammo", tmp) will not run because it expects a number at argument 4. Show your definition for the 'getAmmoPerClip' function and it can be fixed.

Link to comment
6 hours ago, Pembo said:

Your function 'getAmmoPerClip' is returning a string so the line: setWeaponProperty( id , "std", "maximum_clip_ammo", tmp) will not run because it expects a number at argument 4. Show your definition for the 'getAmmoPerClip' function and it can be fixed.

 

 

if getAmmoPerClip(weaponID) == "disabled" then --If weapon is not allowed
                    outputChatBox("[MAKEAMMO] Invalid Weapon Name/ID. Type /gunlist or hit F4 to open Weapon Creator.", thePlayer, 255, 0, 0)
                    return
                elseif getAmmoPerClip(weaponID) == tostring(0)  then-- if weapon doesn't need ammo to work
                    outputChatBox("[MAKEAMMO] This weapon doesn't use ammo.", thePlayer, 255, 0, 0)
                    return
                else
                end

                local logged = getElementData(targetPlayer, "loggedin")
                local hiddenAdmin = getElementData(thePlayer, "hiddenadmin")

                if (logged==0) then
                    outputChatBox("Player is not logged in.", thePlayer, 255, 0, 0)
                elseif (logged==1) then
                    if ammo == -1 then -- if full ammopack
                        ammo = getAmmoPerClip(weaponID)
                    end

 

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