Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Norwedish opened this issue May 30, 2021 · 1 comment

Comments

@Norwedish
Copy link

Norwedish commented May 30, 2021

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
@HugoSimoes12345
Copy link
Owner

HugoSimoes12345 commented May 30, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants