AlfaMTA Posted April 9, 2014 Share Posted April 9, 2014 Hi everyone I would know how to force the player to aim to fire , like a sniper! Thanks everyone! Link to comment
Jusonex Posted April 9, 2014 Share Posted April 9, 2014 https://wiki.multitheftauto.com/wiki/SetControlState https://wiki.multitheftauto.com/wiki/SetCameraTarget (Don't forget that the aim target is not equal to the camera target, but there's currently no other way to manipulate the aim target) Link to comment
AlfaMTA Posted April 9, 2014 Author Share Posted April 9, 2014 Jusonex , I meant to check if the player is aiming and force to aim like a sniper, rocket launcher and others that you should aim before you shoot! Link to comment
Dzsozi (h03) Posted April 10, 2014 Share Posted April 10, 2014 (sorry for putting this in code, but [lua] is bugged for some reason) Try this: -- client side (not tested) function isPedAiming ( thePedToCheck ) if isElement(thePedToCheck) then if getElementType(thePedToCheck) == "player" or getElementType(thePedToCheck) == "ped" then if getPedTask(thePedToCheck, "secondary", 0) == "TASK_SIMPLE_USE_GUN" then return true end end end return false end function checkAim() if not isPedAiming(localPlayer) then toggleControl( "fire", false) else toggleControl( "fire", true) end end addEventHandler ( "onClientResourceStart", getRootElement(), checkAim ) 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