Jump to content

question


WASSIm.

Recommended Posts

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

Link to comment

debugscript :

sanstitrecr.png

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) 

Link to comment

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

Link to comment
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 :D

Link to comment

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 

Link to comment
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 ) 

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