#RooTs Posted January 28, 2016 Share Posted January 28, 2016 What is wrong ? I need to do it that way because of triggerClientEvent function switchEngine ( ) local vehicle = getPedOccupiedVehicle(source) if ( vehicle ) then if getVehicleEngineState ( vehicle ) then setVehicleEngineState ( vehicle, true ) triggerClientEvent ( "motLigado", source ) else setVehicleEngineState ( vehicle, false ) triggerClientEvent ( "motDesligado", source ) end end end addEvent("motor", true) addEventHandler("motor", root, TrancarVeiculo) found other means to make, on / off. evil can not use triggerClientEvent function switchEngine ( ) local vehicle = getPedOccupiedVehicle(source) if not vehicle then return end local state = getVehicleEngineState ( vehicle ) setVehicleEngineState ( vehicle, not state ) end addEvent("motor", true) addEventHandler("motor", root, switchEngine)) Any solution ? Link to comment
Bonsai Posted January 28, 2016 Share Posted January 28, 2016 What is wrong ?I need to do it that way because of triggerClientEvent function switchEngine ( ) local vehicle = getPedOccupiedVehicle(source) if ( vehicle ) then if getVehicleEngineState ( vehicle ) then setVehicleEngineState ( vehicle, true ) triggerClientEvent ( "motLigado", source ) else setVehicleEngineState ( vehicle, false ) triggerClientEvent ( "motDesligado", source ) end end end addEvent("motor", true) addEventHandler("motor", root, TrancarVeiculo) found other means to make, on / off. evil can not use triggerClientEvent function switchEngine ( ) local vehicle = getPedOccupiedVehicle(source) if not vehicle then return end local state = getVehicleEngineState ( vehicle ) setVehicleEngineState ( vehicle, not state ) end addEvent("motor", true) addEventHandler("motor", root, switchEngine)) Any solution ? What do you mean by not being able to use triggerClientEvent? You can trigger client events from clientside using triggerEvent. Same for server. Bonsai Link to comment
#RooTs Posted January 28, 2016 Author Share Posted January 28, 2016 @Bonsai my client function Locked (_,state) local theVehicle = getPedOccupiedVehicle(localPlayer) if theVehicle and getVehicleController(theVehicle) == localPlayer then if painel == true then if state == "down" then if isCursorOnElement (botX+sizeX+735, 240, 42, 16) then -- motor triggerServerEvent ("motor", getLocalPlayer()) end end end end end addEventHandler ("onClientClick", root, Locked) I'm using only 1 button / click. likewise, I can not use 2 Trigger Event Link to comment
#RooTs Posted January 28, 2016 Author Share Posted January 28, 2016 30 visit.. OMG does anyone here know how to solve it? I lost one day of programming because of it Link to comment
#RooTs Posted January 28, 2016 Author Share Posted January 28, 2016 Solved, thanks to all Link to comment
Captain Cody Posted January 28, 2016 Share Posted January 28, 2016 Ignore what I put here, what the hell are you talking about? Link to comment
#RooTs Posted January 28, 2016 Author Share Posted January 28, 2016 Ignore what I put here, what the hell are you talking about? I just added, "not" in my code. and it was resolved if not getVehicleEngineState ( vehicle ) then function VehicleEngineState ( ) local vehicle = getPedOccupiedVehicle(source) if ( vehicle ) then if not getVehicleEngineState ( vehicle ) then setVehicleEngineState ( vehicle, true ) triggerClientEvent ( "motLigado", source ) else setVehicleEngineState ( vehicle, false ) triggerClientEvent ( "motDesligado", source ) end end end addEvent("motor", true) addEventHandler("motor", root, VehicleEngineState) Link to comment
Captain Cody Posted January 29, 2016 Share Posted January 29, 2016 Well I guess what I said was right... Interesting. Link to comment
Tremidinha Posted January 29, 2016 Share Posted January 29, 2016 Cara tu quer fazendo um comando ou um evento? Link to comment
1LoL1 Posted January 29, 2016 Share Posted January 29, 2016 Cara tu quer fazendo um comando ou um evento? This is English section. Link to comment
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