Jump to content

Minigun On Vehicle


Recommended Posts

Oh thanks. And can u help how to write it ? Because i don't have any idea how to start

Honestly, if you're a first-time scripter, this script wouldn't be a good one to start with. You would definitely have to know what you're doing to make it.

Link to comment
Oh thanks. And can u help how to write it ? Because i don't have any idea how to start

First choice objects as a minigun and support then create attachs to stay in the car and sequence as createWeapon ...

Continue:

press the 1 button inside the car and you will see a minigun

function upgradeTheCar() 
    local veh = getPedOccupiedVehicle ( localPlayer ) 
    local x,y,z = getElementPosition(veh) 
    local Gunner = createObject ( 362, x, y, z) 
    local pedestal = createObject ( 336, x, y, z) 
    attachElements ( pedestal, veh, x, y, z, 0, 0, 0) 
    attachElements ( Gunner, pedestal, 0, -0.3, 0.9, 0, 30, 60) 
end 
bindKey ( "1", "down", upgradeTheCar ) 

Link to comment

But it isn't will bug if i createWeapon and createObject i think i that pos .And i want to ask how to make a crossfire(dxDraw i know it but how to get a Player targer whic he look and set minigun rotation on that too) and which variable i need to rotate the Minigun ?

Link to comment
  • 8 months later...

Hi everybody! I saw this video too and i decided that i will make that script. Im not a beginner in lua so it was not so difficult to make it. Everythink was good when i stuck with the minigun rotation. I used the camera rotation to rotate the minigun element. The only problem is that its not rotating up and down.. only left and right:/ can someone help me?

this is a part of my script

  
local test = createWeapon("m4", -2388.41,-581.15, 132.3)setWeaponState(test, "ready") 
  
  
  
function rotate () 
setElementRotation(test, 0, 3.2, 96.7 -getPedCameraRotation(localPlayer)) 
end 
addEventHandler ("onClientRender", root, rotate) 
  
  
  
  
  
 function findRotation( x1, y1, x2, y2 )    local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) )    return t < 0 and t            + 360 or tend 
  

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