Dealman Posted May 25, 2015 Share Posted May 25, 2015 sorry, more I did not understand local hb_Image = "files/2/hb.png" where's dxDrawImage? Storing the path in a variable instead. dxDrawImage(x*960+x2, y*470+y2, 306, 232, hb_Image, 0,0,0, tocolor(255, 255, 255 , 255)) would be the same as dxDrawImage(x*960+x2, y*470+y2, 306, 232, "files/2/hb2.png", 0,0,0, tocolor(255, 255, 255 , 255)) Link to comment
#RooTs Posted May 25, 2015 Author Share Posted May 25, 2015 @ALw7sH, I tested your code that is simpler, and when he gets precionado he repeats the sound. the same with the function to lock the car doors if ( enablelock ) and ( isVehicleLocked( theVehicle ) ) when the car is with the door locked he repeats the sound I did not know is that complicated Link to comment
#RooTs Posted May 25, 2015 Author Share Posted May 25, 2015 @Dealman, Your example is very complicated. I know how to work with variables, more, where add, the dxDrawImage(....... which line? Link to comment
SpoC^ Posted May 26, 2015 Share Posted May 26, 2015 (edited) local sx,sy = guiGetScreenSize() local px,py = 1280,720 local x,y = (sx/px), (sy/py) local handbrake = false local x2, y2, x3, y3 = 0, 0, 0, 0 local playing = false -- set to false function speed() local theVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( theVehicle ) then if ( getControlState ( "handbrake" ) ) then dxDrawImage(x*960+x2, y*470+y2, 306, 232, "files/2/hb2.png", 0,0,0, tocolor(255, 255, 255 , 255)) if ( handbrake == false ) then handbrake = playSound("files/handbrake.wav") handbrake = true end else dxDrawImage(x*960+x2, y*470+y2, 306, 232, "files/2/hb.png", 0,0,0, tocolor(255, 255, 255 , 255)) end end end addEventHandler ( "onClientRender", root, speed ) addEventHandler("onClientSoundStopped",root, function() if source == handbrake then handbrake = false end end ) Edited May 26, 2015 by Guest Link to comment
ALw7sH Posted May 26, 2015 Share Posted May 26, 2015 Do you mean that you want the sound start every time he press break? If yes then why you are using onClientRender Link to comment
#RooTs Posted May 26, 2015 Author Share Posted May 26, 2015 Do you mean that you want the sound start every time he press break?If yes then why you are using onClientRender I do not know another way to do this Link to comment
SpoC^ Posted May 26, 2015 Share Posted May 26, 2015 You tried this? function checkHand( key, keyState) local theVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( theVehicle ) then --outputChatBox("you press space brake") playSound("files/handbrake.wav") end end bindKey ( "handbrake", "down", checkHand ) Link to comment
#RooTs Posted May 26, 2015 Author Share Posted May 26, 2015 You tried this? function checkHand( key, keyState) local theVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( theVehicle ) then --outputChatBox("you press space brake") playSound("files/handbrake.wav") end end bindKey ( "handbrake", "down", checkHand ) Worked, thanks. more passenger pressure, and makes the sound. how to check if I'm passenger and not make the sound?, what is the function? Link to comment
#RooTs Posted May 26, 2015 Author Share Posted May 26, 2015 is this? getVehicleOccupant Link to comment
ALw7sH Posted May 26, 2015 Share Posted May 26, 2015 if ( theVehicle and theVehicle == 0 ) then Link to comment
TAPL Posted May 26, 2015 Share Posted May 26, 2015 bindKey("handbrake", "down", function() local theVehicle = getPedOccupiedVehicle(localPlayer) if theVehicle and getVehicleController(theVehicle) == localPlayer then --outputChatBox("you press space brake") playSound("files/handbrake.wav") end end) Link to comment
#RooTs Posted May 26, 2015 Author Share Posted May 26, 2015 @TAPL, perfect. my problem now is no longer the case bindkey. because when I turn on the light he has to make a sound if ( enablelight ) and ( getVehicleOverrideLights ( theVehicle ) ~= 2 ) then dxDrawImage.. playSound("files/lightswitch.mp3") else dxDrawImage end OBS: the lighthouse is connected by freeroam panel. what function to use for this type of bindkey? 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