John Smith Posted December 12, 2014 Posted December 12, 2014 is there such event? i need to know how to know when player has stopped aiming thanks If you find my post useful or if it helped you, please like my post Ingame name: ZoeN
DiSaMe Posted December 12, 2014 Posted December 12, 2014 Maybe this function will help: getPedTask But I don't know if it has some 'aiming' task, you should play around with it and see what it returns to find out. If there isn't such task, then the closest thing you can do is probably checking when aiming control state changes: bindKey But it's not that accurate for detecting when player stops aiming. -
joaosilva099 Posted December 13, 2014 Posted December 13, 2014 Try this event, not tested... addEventHandler("onPlayerTarget", getRootElement(), function (target) if(not target) then --DO WHAT YOU WANT TO DO WHEN PLAYER STOPS TARGET HERE! end end) Change getRootElement() for your player if you want http://i.imgur.com/CSE28MJ.png Don't hesitate to contact me for anything! If I can help, I will for sure! Education is the most powerful weapon which you can use to change the world. - Castillo
DiSaMe Posted December 13, 2014 Posted December 13, 2014 Except "onPlayerTarget" doesn't detect when the player starts/stops aiming, but rather when the player starts/stop aiming at particular element. -
joaosilva099 Posted December 13, 2014 Posted December 13, 2014 Except "onPlayerTarget" doesn't detect when the player starts/stops aiming, but rather when the player starts/stop aiming at particular element. Just think a little bit... when a player stops aiming at all, it will stop aiming of the object too... http://i.imgur.com/CSE28MJ.png Don't hesitate to contact me for anything! If I can help, I will for sure! Education is the most powerful weapon which you can use to change the world. - Castillo
DiSaMe Posted December 13, 2014 Posted December 13, 2014 Or, when the player is still aiming, but in another direction, they will stop aiming at the objet too... -
Buffalo Posted December 13, 2014 Posted December 13, 2014 Now there's a great possibility to create an event with getPedTask() Just hook it onClientRender (most accurate) local currTask = false addEventHandler('onClientRender',getRootElement(),function() local thisTask = getPedTask(localPlayer,'secondary',0) if currTask == 'TASK_SIMPLE_USE_GUN' and currTask ~= thisTask then triggerEvent('onClientPlayerStopAiming',localPlayer) end currTask = thisTask end) addEvent('onClientPlayerStopAiming',false) addEventHandler('onClientPlayerStopAiming',getRootElement(),function() outputChatBox(' You have stopped aiming.',255,100,100) end) Powered by Kimsufi© ☢ ZHP on Facebook ☢ ZHP on Youtube ☢ Support us ☢
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