Axel Posted May 22, 2012 Share Posted May 22, 2012 I'm getting a strange error on this little script: function onClientPlayerWeaponFireFun(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) local x,y,z = getElementPosition(source) if getZoneName(tonumber(x),tonumber(y),tonumber(z),true) == "San Fierro" then cancelEvent() end end addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFun ) No error, but i can still shot with guns in SF.. Link to comment
TAPL Posted May 22, 2012 Share Posted May 22, 2012 This event can't be canceled you need to disable fire toggleControl("fire",false) function onClientPlayerWeaponFireFun(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) local x,y,z = getElementPosition(source) if getZoneName(tonumber(x),tonumber(y),tonumber(z),true) == "San Fierro" then toggleControl("fire",false) else toggleControl("fire",true) end end addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFun ) also use bindKey better function xxx() local x,y,z = getElementPosition(localPlayer) if getZoneName(tonumber(x),tonumber(y),tonumber(z),true) == "San Fierro" then toggleControl("fire",false) else toggleControl("fire",true) end end bindKey("fire", "down", xxx) 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