WASSIm. Posted February 16, 2013 Posted February 16, 2013 hi guys how make tank SWAT shot minigun or minigun hunter
Baseplate Posted February 16, 2013 Posted February 16, 2013 And there is a community resource allows you to add weapons to vehicles.
Castillo Posted February 16, 2013 Posted February 16, 2013 There's no way to cancel the water fired from the SWAT tank. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
arezu Posted February 17, 2013 Posted February 17, 2013 There's no way to cancel the water fired from the SWAT tank. False, you can use toggleControl to disable water firing and then bindKey for the same key to make it shoot bullets instead.
Castillo Posted February 17, 2013 Posted February 17, 2013 Oh, yeah, dunno why I forgot about that . San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Moderators IIYAMA Posted February 17, 2013 Moderators Posted February 17, 2013 False, you can use toggleControl to disable water firing and then bindKey for the same key to make it shoot bullets instead. https://wiki.multitheftauto.com/wiki/ToggleControl https://wiki.multitheftauto.com/wiki/CreateWeapon Note client side and no syncs: But if you know a little about communication between server and client it is possible to put it a little synchronize.... Good luck, it cost me a few days to attach weapons to a hunter. I am not sure if you can get the exact turret position of a SWAT thank. I get a strange rotation... not position -_-" https://wiki.multitheftauto.com/wiki/Get ... etPosition wrong named.... Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
WASSIm. Posted February 17, 2013 Author Posted February 17, 2013 debugscript : SERVER function weapontankswat ( ) local vehicles = getElementsByType ( "vehicle" ) for vehicleKey, vehicleValue in ipairs(vehicles) do x, y = getVehicleTurretPosition (vehicles) x = math.deg ( x ) y = math.deg ( y ) weapon = triggerClientEvent ("weapontank", root, vehicles) attachElementToElement ( weapon,vehicles, 0, 0, 5 ) end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), weapontankswat ) function destroy ( ) destroyElement( weapon ) end addEventHandler ( "onPlayerVehicleExit", getRootElement(), destroy ) CLIENT function weapontank ( ) weapon = createWeapon ( m4, x, y, 0 ) end addEvent ( "weapontank", true ) addEventHandler ( "weapontank", root, weapontank)
HunT Posted February 17, 2013 Posted February 17, 2013 Can u Edit My Maverick Minigun : 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 ) 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 ) 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) 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(MGtimer) killTimer(MG2timer) else MGtimer = setTimer(function() setWeaponState ( minigunOne, "firing" ) end, 50, 1) MG2timer = 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(MGtimer) killTimer(MG2timer) else MGtimer = setTimer(function() setWeaponState ( minigunOne, "ready" ) end, 50, 1) MG2timer = setTimer(function() setWeaponState ( minigunTwo, "ready" ) end, 50, 1) stopSound ( MiniSound ) end end Need Edit : getElementModel(theVehicle) == 487 (487 is maverick u need edit this for other vehicle) attachElements ( minigunOne, theVehicle, 1.15, 2, -1.3, 0, 0, 93 ) position minigun 1 attachElements ( minigunTwo, theVehicle, -1.15, 2, -1.3, 0, 0, 93 ) position minigun 2 Full Resource : http://www.mediafire.com/?d610bys9l88jvre @Huntone_
WASSIm. Posted February 17, 2013 Author Posted February 17, 2013 Can u Edit My Maverick Minigun : 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 ) 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 ) 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) 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(MGtimer) killTimer(MG2timer) else MGtimer = setTimer(function() setWeaponState ( minigunOne, "firing" ) end, 50, 1) MG2timer = 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(MGtimer) killTimer(MG2timer) else MGtimer = setTimer(function() setWeaponState ( minigunOne, "ready" ) end, 50, 1) MG2timer = setTimer(function() setWeaponState ( minigunTwo, "ready" ) end, 50, 1) stopSound ( MiniSound ) end end Need Edit : getElementModel(theVehicle) == 487 (487 is maverick u need edit this for other vehicle) attachElements ( minigunOne, theVehicle, 1.15, 2, -1.3, 0, 0, 93 ) position minigun 1 attachElements ( minigunTwo, theVehicle, -1.15, 2, -1.3, 0, 0, 93 ) position minigun 2 Full Resource : http://www.mediafire.com/?d610bys9l88jvre thank you very much :D
WASSIm. Posted February 18, 2013 Author Posted February 18, 2013 i want if move Which shot water and move minigun addEventHandler("onClientVehicleEnter", root, function(thePlayer, seat) local theVehicle = source if seat == 0 and thePlayer == localPlayer and getElementModel(theVehicle) == 601 then local x, y, z = getElementPosition ( theVehicle ) local rx, ry, rz = getElementRotation ( theVehicle ) minigunOne = createWeapon ( "minigun", x, y, z ) setElementAlpha ( minigunOne,255) attachElements ( minigunOne, theVehicle, 0.15, 0, 1.3, 0, 0, 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) == 601 then if minigunOne then destroyElement (minigunOne) unbindKey ( "mouse1", "down", enableFire ) unbindKey ( "mouse1", "up", disableFire ) end end end ) function enableFire() if isTimer(MGtimer) and minigunOne then killTimer(MGtimer) else MGtimer = setTimer(function() setWeaponState ( minigunOne, "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 minigunOne then killTimer(MGtimer) else MGtimer = setTimer(function() setWeaponState ( minigunOne, "ready" ) end, 50, 1) stopSound ( MiniSound ) end end
HunT Posted February 18, 2013 Posted February 18, 2013 Get and Set the rotation to minigunOne with onClientRender. @Huntone_
WASSIm. Posted February 18, 2013 Author Posted February 18, 2013 Get and Set the rotation to minigunOne with onClientRender. not work function mgRotate ( ) if minigunOne then rotX,rotY,rotZ = getElementRotation ( getLocalPlayer () ) setElementRotation(minigunOne,rotX,rotY,rotZ) end end addEventHandler ( "onClientRender", root, mgRotate )
HunT Posted February 18, 2013 Posted February 18, 2013 U not need the rotation of player but getCameraMatrix @Huntone_
Moderators IIYAMA Posted February 18, 2013 Moderators Posted February 18, 2013 So it is possible to know the camera position from other players without using server side? Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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