Jump to content

What does this error mean?


Franky

Recommended Posts

what does this error mean?

attempt to call global (a nil value)

ERROR: ...ver/mods/deathmatch/resources/script/asd.lua:8: attempt to call global 'getVehicleEngineState' (a nil value)

You might have used it in a way of which MTA thought it was a variable? Like you need to do (arguments) behind it. =/

It should work fine, since there are enough resources containing this...

Link to comment

function engineOnOff ( thePlayer ) 
    local playerVehicle = getPlayerOccupiedVehicle ( thePlayer ) 
    if ( playerVehicle ) == false then 
        outputChatBox ( "You need to be in a vehicle!",thePlayer, 225, 1, 1 ) 
    else 
        local playerseat = getPlayerOccupiedVehicleSeat ( thePlayer ) 
        if ( playerseat ) == 0 then 
            local enginestate = getVehicleEngineState ( playerVehicle ) 
            if ( enginestate ) == true then 
                setVehicleEngineState ( playerVehicle, false ) 
            else 
                setVehicleEngineState ( playerVehicle, true ) 
            end 
        else 
            outputChatBox ( "You need to be the driver!", thePlayer, 255, 1, 1 ) 
        end         
  
    end 
end 
addCommandHandler ( "engine", engineOnOff ) 

Can someone fix what i did wrong?

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