John Smith Posted December 12, 2014 Share Posted December 12, 2014 is there such event? i need to know how to know when player has stopped aiming thanks Link to comment
DiSaMe Posted December 12, 2014 Share 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. Link to comment
joaosilva099 Posted December 13, 2014 Share 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 Link to comment
DiSaMe Posted December 13, 2014 Share 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. Link to comment
joaosilva099 Posted December 13, 2014 Share 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... Link to comment
DiSaMe Posted December 13, 2014 Share Posted December 13, 2014 Or, when the player is still aiming, but in another direction, they will stop aiming at the objet too... Link to comment
Buffalo Posted December 13, 2014 Share 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) 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