Jump to content

toggleControl problem


Karoleq

Recommended Posts

Hello, i am trying to make a script that makes shooting not possible in MTA, but when if isPedAiming it makes it possible again. If you guys know what i mean. Lets just say that i am trying to make weapon shooting system just like on Grafuroam or SAAF server, something like you need to aim first then you can start shooting, and if you are not aiming first you cant. The problem is: i dont know so much about scripting and my script doesnt work, heres the code: please help me

function toggleControl(weapon) 
        toggleControl(thePlayer,"fire",false) 
    if isPedAiming then
        toggleControl(thePlayer,"fire",true) 
    end 
end 
addEventHandler ( "onClientResourceStart", getLocalPlayer(), toggleControl ) 

Edited by Karoleq
Link to comment
local localPlayer = getLocalPlayer()
function togglePlayerControl(weapon) 
	toggleControl("fire", false) 
	if isPedAiming(localPlayer) then
		toggleControl("fire", true) 
	end 
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(), togglePlayerControl)

 

Edited by idarrr
  • Like 1
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...