Jump to content

Vehicle Engine dont be turned off


noOx

Recommended Posts

Posted

Hi, i have scripted a Engine-Toggle. But the Engine will not turned off.

The Source

function vehicleEngineToggle(source)
    playerVehicle = getPedOccupiedVehicle(source)
    playerSeat = getPedOccupiedVehicleSeat(source)
    engineState = getVehicleEngineState(playerVehicle)
    if (playerVehicle) then
        if (playerSeat == 0) then
            if (engineState == true) then
                setVehicleEngineState(playerVehicle, false)
                outputChatBox("Motor ausgeschaltet", source, 0, 200, 0, true)
                return
            else
                setVehicleEngineState(playerVehicle, true)
                outputChatBox("Motor eingeschaltet", source, 0, 200, 0, true)
            end
        else
            outputChatBox("Du bist nicht der Fahrer des Fahrzeugs", source, 200, 0, 0, true)
        end
    else
        outputChatBox("Du sitzt in keinem Fahrzeug", source, 200, 0, 0, true)
    end
end
addCommandHandler("motor", vehicleEngineToggle, false, false)

I dont get a error or something.

Posted

When the Engine is on, and i want to turn off the engine then i see "Motor eingeschaltet = Engine turned on"

Posted

Debug the script by showing some messages, eg. outputChatBox( tostring( engineState ) ) to see what getVehicleEngineState returned.

Posted

I think it gives any problem with getVehicleEngineState, because when the engine turned on i get in the ChatBox a "false"

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