Jump to content

event when player stops aiming


John Smith

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...