#RooTs Posted May 21, 2015 Share Posted May 21, 2015 (edited) what is the function may I see if the vehicle It is with brake activated. I wanted to do it in an "if" EX if function then dxDrawImage(....red image........ else dxDrawImage(...white image.... end I want to make sure it is activated or not in an "if function" Thanks by help Edited May 24, 2015 by Guest Link to comment
#RooTs Posted May 21, 2015 Author Share Posted May 21, 2015 someone please? 10 VIEWS, help 0 Link to comment
xeon17 Posted May 21, 2015 Share Posted May 21, 2015 I couldn't understand anything what you wrote, could you explain a bit better? Link to comment
#RooTs Posted May 21, 2015 Author Share Posted May 21, 2015 update, sorry my bad english Link to comment
Dealman Posted May 21, 2015 Share Posted May 21, 2015 If I recall correctly what I did for my ABS prototype, whenever a player connected I retrieved all the keys they had bound to the control "brake". Using getBoundKeys. What you then can do is check that whenever a player is in a vehicle, whenever either of these keys are pressed down - draw the red one, otherwise draw the red one. I'd give you my ABS prototype but I can't remember where I stored the uncompiled version. It might have been on my laptop which I formated Link to comment
RenanPG Posted May 22, 2015 Share Posted May 22, 2015 I'm not sure if I understood your question, but you can try one of these control checkers. if(getControlState("handbrake")) then end if(getControlState("brake_reverse")) then end Link to comment
tosfera Posted May 22, 2015 Share Posted May 22, 2015 Using the information Hornet gave you, you'll be able to draw the image yourself. To make sure that they are updated at the same time as you press the handbrake/reverse you can put them in your onClientRender just like your other drawn things for your vehicle's GUI ( if you have any ). I'm not sure if I understood your question, but you can try one of these control checkers. if(getControlState("handbrake")) then end if(getControlState("brake_reverse")) then end To give you a small example, you can do something similar to this; addEventHandler ( "onClientRender", root, function () if ( isPedInVehicle ( localPlayer ) ) then if ( getControlState ( "handbrake" ) or getControlState ( "brake_reverse" ) ) then -- draw the red image else -- draw the white image end end end ); Since this will always run in the background, I would strongly advise you to only add the onClientRender when the player actually enters a vehicle and turn it off when he leaves it. function drawVehicleGUI () if ( getControlState ( "handbrake" ) or getControlState ( "brake_reverse" ) ) then -- draw the red image else -- draw the white image end end addEventHandler ( "onClientVehicleEnter", root, function ( thePlayer, seat ) if ( seat == 0 ) then addEventHandler ( "onClientRender", getRootElement(), drawVehicleGUI ); end end ); addEventHandler ( "onClientVehicleExit", root, function ( thePlayer, seat ) if ( seat == 0 ) then removeEventHandler ( "onClientRender", getRootElement(), drawVehicleGUI ); end end ); Link to comment
RenanPG Posted May 22, 2015 Share Posted May 22, 2015 function drawVehicleGUI () if ( getControlState ( "handbrake" ) or getControlState ( "brake_reverse" ) ) then -- draw the red image else -- draw the white image end end addEventHandler ( "onClientVehicleEnter", root, function ( thePlayer, seat ) if ( seat == 0 ) then addEventHandler ( "onClientRender", getRootElement(), drawVehicleGUI ); end end ); addEventHandler ( "onClientVehicleExit", root, function ( thePlayer, seat ) if ( seat == 0 ) then removeEventHandler ( "onClientRender", getRootElement(), drawVehicleGUI ); end end ); Perfect example. Link to comment
#RooTs Posted May 24, 2015 Author Share Posted May 24, 2015 @tosfera and @Hornet, Thanks man. Worked perfect if ( getControlState ( "handbrake" ) or getControlState ( "brake_reverse" ) ) then -- draw the red image else -- draw the white image end 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