Pedro Colto Posted April 27, 2015 Posted April 27, 2015 Bem este script é para fazer o carro parar de funcionar em uma certa hp, mais exemplo poderiam me falar oque tenho que colocar ai para quando o motor para não der de forma alguma para ele ligar o motor mesmo com o server contendo sistema de desliga e ligar o motor, podem me ajudar irei agradecer bastante. -- Server-side function pacoca(theVehicle,seat,jacked) if getElementHealth(theVehicle) <= 400 then setVehicleEngineState(theVehicle, false) setElementData(theVehicle,"estanaFAIXA",true) setVehicleDamageProof(theVehicle, true) end end addEventHandler("onPlayerVehicleEnter",getRootElement(),pacoca) function Saindo(theVehicle,seat,jacked) setVehicleDamageProof(theVehicle, false) -- se você quiser que ele continue blindado quando sair do veiculo coloque TRUE end addEventHandler("onPlayerVehicleExit",getRootElement(),Saindo) function deliciadeoco() if getElementHealth(source) <= 400 then setVehicleEngineState(source, false) setElementData(source,"estanaFAIXA",true) setVehicleDamageProof(source, true) --outputChatBox ("//* O motor do veiculo parou de funcionar, ligue para algum mecanico (Para ver os mecanicos online aperte 'TAB')!" , thePlayer,255, 0, 0) cancelEvent() end end addEventHandler("onVehicleDamage",getRootElement(),deliciadeoco)
#RooTs Posted April 28, 2015 Posted April 28, 2015 humm, tente usar o setElementFrozen(theVehicle, true) para fixar o veiculo no lugar, é quase a mesma coisa, ele não vai conseguir sair com o veiculo fixado no lugar, más.... ele vai estar com o motor ligado ainda. exemplo: function exit(theVehicle,seat,jacked) setElementFrozen(theVehicle, true) end addEventHandler("onPlayerVehicleExit",getRootElement(),exit) function enter(theVehicle,seat,jacked) setElementFrozen(theVehicle, false) end addEventHandler("onPlayerVehicleEnter",getRootElement(),enter) ou você pode usar o.. setVehicleEngineState ( theVehicle, false )-- notei que você já está usando ele, então você pode fazer outras if's
Pedro Colto Posted April 28, 2015 Author Posted April 28, 2015 humm, tente usar o setElementFrozen(theVehicle, true) para fixar o veiculo no lugar, é quase a mesma coisa, ele não vai conseguir sair com o veiculo fixado no lugar, más.... ele vai estar com o motor ligado ainda. exemplo: function exit(theVehicle,seat,jacked) setElementFrozen(theVehicle, true) end addEventHandler("onPlayerVehicleExit",getRootElement(),exit) function enter(theVehicle,seat,jacked) setElementFrozen(theVehicle, false) end addEventHandler("onPlayerVehicleEnter",getRootElement(),enter) ou você pode usar o.. setVehicleEngineState ( theVehicle, false )-- notei que você já está usando ele, então você pode fazer outras if's setElementFrozen, acho que não daria muito correto mais acho que vou dar uma estudadinha para ver se consigo com setVehicleEngineState mesmo, vllw pela tentativa de ajuda (y)
DNL291 Posted April 28, 2015 Posted April 28, 2015 Use getElementData no script de desligar/ligar o motor do carro. Acho que vai funcionar, basta definir os dados corretamente quando a HP mudar.
Pedro Colto Posted April 28, 2015 Author Posted April 28, 2015 Use getElementData no script de desligar/ligar o motor do carro. Acho que vai funcionar, basta definir os dados corretamente quando a HP mudar. consegui mais me ajude numa coisa function switchEngine ( playerSource ) local theVehicle = getPedOccupiedVehicle ( playerSource ) -- Check if the player is in any vehicle and if he is the driver if theVehicle and getVehicleController ( theVehicle ) == playerSource then if getElementHealth(theVehicle) <= 500 then local state = getVehicleEngineState ( theVehicle ) setVehicleEngineState ( theVehicle, not state ) end end end addEventHandler("onPlayerVehicleEnter",getRootElement(),switchEngine) addCommandHandler ( "switchengine", switchEngine ) esta funcionando mais só funciona para carro com hp menor que 500, como posso colocar o "getElementHealth(theVehicle) <= 500 then" para só funcionar com carros com hp maior que 500 pq ai só desliga e liga motor de carro com menor de 500 de hp
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now