Hello, i want to make a script where player is able to shoot only when he's aiming, but shooting is disabled when he's not aiming.
Here's my code:
local localPlayer = getLocalPlayer()
function togglePlayerControl(weapon)
toggleControl("fire", false)
if isPedAiming(localPlayer) then
toggleControl("fire", true)
end
end
addEventHandler ( "onClientResourceStart", getResourceRootElement(), togglePlayerControl)
Now, player cannot shoot when he's not aiming, and that's good. But he cannot shoot when he's aiming too. How do i fix it? I'm not really good in scripting.