Skip to content

Error at line 176 in client file. Attempt to index a nil value (field "?") #1

Description

@Norwedish

When you use a custom gearratio given in de config, it gives this error. You can fix it by replacing the following code on line 173.

Old code:

    if Config.vehicles[hash] ~= nil then
        if selectedgear ~= 0 and selectedgear ~= nil  then
            if numgears ~= nil and selectedgear ~= nil then
                ratio = Config.vehicles[hash][numgears][selectedgear] * (1/0.9)
            else

            end
        end
            else
        if selectedgear ~= 0 and selectedgear ~= nil then
            if numgears ~= nil and selectedgear ~= nil then
                ratio = Config.gears[numgears][selectedgear] * (1/0.9)
            else
            
            end
            
       end
    end

Replacement:

   <!--StartFragment-->        
    if Config.vehicles[hash] ~= nil then
        if selectedgear ~= 0 and selectedgear ~= nil  then
            if numgears ~= nil and selectedgear ~= nil then
                if Config.vehicles[hash][numgears] ~= nil then
                    ratio = Config.vehicles[hash][numgears][selectedgear] * (1/0.9)
                else
                    ratio = Config.gears[numgears][selectedgear] * (1/0.9)
                end
            end
        end
    
    else
        if selectedgear ~= 0 and selectedgear ~= nil then
            if numgears ~= nil and selectedgear ~= nil then
                ratio = Config.gears[numgears][selectedgear] * (1/0.9)
            end
        end
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions