Jump to content

[ Help ] Script


dsmatias

Recommended Posts

8c4d9618b7314325b769c81e89b4b989.png

Error,  Help?

Line: 

   if curGear > lastGear then
                            playBlowoffSound(vehicle)
                        end
                        if downgrading then
                            if ( lastRPM < rpm and ( lastGear <= curGear ) ) or lastGear < curGear then
                                if isTimer ( downgradingTimers[1] ) then killTimer ( downgradingTimers[1] ) end
                                if isTimer ( downgradingTimers[2] ) then killTimer ( downgradingTimers[2] ) end
                                downgrading = false
                            end
                            local temprpm = interpolateBetween ( downgradingRPM[1], 0, 0, downgradingRPM[2], 0, 0, downgradingProgress, "Linear" )
                            setSoundSpeed ( sound, temprpm/vehiclesSounds[model].coeff )
                        else
                            setSoundSpeed ( sound, rpm/vehiclesSounds[model].coeff )
                        end
                    end
                    setElementData ( vehicle, "carsound:lastGear", curGear, false )
                    setElementData ( vehicle, "carsound:lastRPM", rpm, false )
                end
            end
        end
    end
end
function playGearSound(vehicle)
    if isElement ( vehicle ) then
        local x,y,z = getElementPosition ( vehicle )
        local px,py,pz = getElementPosition ( localPlayer )
        if getDistanceBetweenPoints3D ( x,y,z, px,py,pz ) < 10 then
            local model = getElementModel ( vehicle )
            local gearSound = playSound3D ( vehiclesSounds[model].gear, x, y, z, false )
            setSoundVolume(gearSound, 2)
            attachElements ( gearSound, vehicle )
        end
    end
end

 

Link to comment

You could at least mark those lines for us (n. 214 and 248).

I think that the issue is that in the first code 'model' is not defined and in the second one 'gear' is not defined. They're simply nil and you are trying to index a table with them resulting in that error.

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