#RooTs Posted March 26, 2015 Posted March 26, 2015 which event, I can use to identify if I'm crouched or not and give me an example to me, please I want to use this event in my hud [ PointBlank ] viewtopic.php?f=108&t=81259&p=741885#p741885
vx89 Posted March 26, 2015 Posted March 26, 2015 You could use bindKey() -- "useful function", see [url=https://wiki.multitheftauto.com/wiki/BindControlKeys]https://wiki.multitheftauto.com/wiki/BindControlKeys[/url] bindControlKeys("crouch", "down", function() if isPedDucked(localPlayer) then -- ducked else -- unducked end end) Have not tested (maybe isPedDucked does not return true immediately after pressing the button) Alternatives for isPedDucked() though no reason to use these: getPedMoveState(localPlayer) getPedTask(localPlayer, "secondary", 1)
#RooTs Posted March 26, 2015 Author Posted March 26, 2015 thanks man,i will try bindControlKeys("crouch", "down", function() if isPedDucked(localPlayer) then dxDrawImage ( screenWidth/2 - 50, 0, 100, 240, 'crouched.png', angle, 0, -120 ) else dxDrawImage ( screenWidth/2 - 50, 0, 100, 240, 'standing.png', angle, 0, -120 ) end end) that's right?
xeon17 Posted March 26, 2015 Posted March 26, 2015 You don't need to use this bindControlKeys("crouch", "down", function() The rest is correct.
vx89 Posted March 26, 2015 Posted March 26, 2015 If you are using it on screen render event, then you don't need an event for couch-state-change indeed (assuming isPedDucking is not very expensive).
#RooTs Posted March 26, 2015 Author Posted March 26, 2015 If you are using it on screen render event, then you don't need an event for couch-state-change indeed (assuming isPedDucking is not very expensive). if isPedDucked(localPlayer) then dxDrawImage ( screenWidth/2 - 50, 0, 100, 240, 'crouched.png', angle, 0, -120 ) else dxDrawImage ( screenWidth/2 - 50, 0, 100, 240, 'standing.png', angle, 0, -120 ) end just use this function within the render, that already works? okay, I get it. Thanks
#RooTs Posted March 29, 2015 Author Posted March 29, 2015 I managed to do, thanks to all. result in down
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