Jump to content

cancelEvent then fire with weapon


AlexSwamp

Recommended Posts

Hi!

I would like to cancelEvent() the fire when i press the "tab" button.

I tryed with this code, but it doesn't work. 

update:
I think the 'onClientPlayerWeaponFire' can't cancelEvent(), but I do not know how to replace it. :(

function playerPressedKey(button, press)
	if getElementData(localPlayer, "char >> usingWeapon")[1] then
		if (press) and button == "tab" then
			return true				
		end
		return false
	end
end
addEventHandler("onClientKey", getRootElement(), playerPressedKey)

addEventHandler('onClientPlayerWeaponFire',getRootElement(),function()
	if playerPressedKey then
		cancelEvent()
	end 							
end) 

 

Edited by AlexSwamp
Link to comment

there's no need for that type of script, just disable control "action". Not sure if it's being used by other things but i just disable it when weapon is aiming but you can just put it in any client script and it'll work.

toggleControl("action",false);

 

  • 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...