Monty Posted December 19, 2012 Share Posted December 19, 2012 how do i remove the key bind when i die inside the helicopter??? addEventHandler("onClientVehicleEnter", root, function(thePlayer, seat) local theVehicle = source if seat == 0 and thePlayer == localPlayer and getElementModel(theVehicle) == 487 then local x, y, z = getElementPosition ( theVehicle ) local rx, ry, rz = getElementRotation ( theVehicle ) minigunOne = createWeapon ( "minigun", x, y, z ) minigunTwo = createWeapon ("minigun", x, y, z ) minigunOneF = createWeapon ( "minigun", x, y, z ) minigunTwoF = createWeapon ("minigun", x, y, z ) setElementAlpha ( minigunOne,0) setElementAlpha ( minigunTwo,0) attachElements ( minigunOne, theVehicle, 1.15, 2, -1.3, 0, 0, 93) attachElements ( minigunTwo, theVehicle, -1.15, 2, -1.3, 0, 0, 93 ) attachElements ( minigunOneF, theVehicle, 1.15, 2, -0.62, 0, 30, 93) attachElements ( minigunTwoF, theVehicle, -1.15, 2, -0.62, 0, 30, 93 ) bindKey ( "mouse1", "down", enableFire ) bindKey ( "mouse1", "up", disableFire ) end end ) addEventHandler("onClientVehicleExit", root, function(thePlayer, seat) local theVehicle = source if seat == 0 and thePlayer == localPlayer and getElementModel(theVehicle) == 487 then if minigunOne and minigunTwo then destroyElement (minigunOne) destroyElement (minigunTwo) destroyElement (minigunOneF) destroyElement (minigunTwoF) unbindKey ( "mouse1", "down", enableFire ) unbindKey ( "mouse1", "up", disableFire ) end end end ) function enableFire() if isTimer(MGtimer) and isTimer(MG2timer) and minigunOne and minigunTwo then killTimer(MGimer) killTimer(MG2imer) else MGimer = setTimer(function() setWeaponState ( minigunOne, "firing" ) end, 50, 1) MG2imer = setTimer(function() setWeaponState ( minigunTwo, "firing" ) end, 50, 1) MiniSound = playSound ( "Pro_Minigun.wav",true) setSoundVolume(MiniSound, 0.4) setSoundEffectEnabled(MiniSound,"gargle",true) setSoundSpeed ( MiniSound, 0.9 ) end end function disableFire() if isTimer(MGtimer) and isTimer(MG2timer) and minigunOne and minigunTwo then killTimer(MGimer) killTimer(MG2imer) else MGimer = setTimer(function() setWeaponState ( minigunOne, "ready" ) end, 50, 1) MG2imer = setTimer(function() setWeaponState ( minigunTwo, "ready" ) end, 50, 1) stopSound ( MiniSound ) end end fileDelete("Pro_C.lua") Link to comment
Castillo Posted December 19, 2012 Share Posted December 19, 2012 Just unbind it when you die. Link to comment
Monty Posted December 19, 2012 Author Share Posted December 19, 2012 that's what i want to do but how? how i say wasted in the helicopter? Link to comment
Castillo Posted December 19, 2012 Share Posted December 19, 2012 onPlayerWasted > unbindKey Link to comment
Monty Posted December 19, 2012 Author Share Posted December 19, 2012 all the resource is client side... how do i trigger to server? Link to comment
Castillo Posted December 19, 2012 Share Posted December 19, 2012 Then use: onClientPlayerWasted Link to comment
Monty Posted December 19, 2012 Author Share Posted December 19, 2012 thanks! it works!! 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