Jump to content

Pressionar tecla para ligar motor


Recommended Posts

Qual o script para pressionar uma tecla e o motor ligar/desligar? help!

function ligarveh()
    local theVehicle = getPedOccupiedVehicle(source)
if ( getVehicleEngineState ( theVehicle ) == false ) then
    setVehicleEngineState ( theVehicle, true )
end
if ( getVehicleEngineState ( theVehicle ) == true ) then
    setVehicleEngineState ( theVehicle, false )
end
end
addCommandHandler("motor on agora", ligarveh)
bindKey("m", "down", "mottor on agora")

CONSOLE:

[11:39:08] WARNING: [G]S_PainelVeiculo\server.Lua:445: Bad argument @ 'bindKey' [Expected player at argument 1, got string 'm']
[11:39:08] [G]S_PainelVeiculo restarted successfully

Edited by ODutii
Link to comment
addEventHandler("onResourceStart", resourceRoot,
function()
	for i, player in ipairs(getElementsByType("player")) do
        bindKey(player,"m", "down", "motoronagora")
	end
end)


function ligarveh(source)
    local theVehicle = getPedOccupiedVehicle(source)
if ( getVehicleEngineState ( theVehicle ) == false ) then
    setVehicleEngineState ( theVehicle, true )
else
    setVehicleEngineState ( theVehicle, false )
end
end
addCommandHandler("motoronagora", ligarveh)

Prontinho amigo ! (Testado)

Você tinha esquecido algumas especificações e tirei algumas coisas desnecessárias...

Aproveite seu script :D

Deixa um thanks ae>>>>>>>>>>

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