Jump to content

[HELP]Cars gun error


mucuk6547

Recommended Posts

Hello there

I added a gun to the vehicle but it does not occur where I want.

gun is not sticky to the vehicle

I want it to shoot with the mouse[ Left mouse button ].

gr8rGN.png

CLİENT
function createMinigunWeapon()
    -- Create the weapon 1 meter above the player
    local x, y, z = getElementPosition(getLocalPlayer())
    local weapon = createWeapon("ak-47", -2413.2534179688, -593.76226806641, 134 + 1)
    -- Give it some ammo and fire it
    setWeaponClipAmmo(weapon, 1500)
    setWeaponState(weapon, "firing")
end
addCommandHandler("silah", createMinigunWeapon)
SERVER
weapon createWeapon ( string ak-47, float -2414, float -593, float 134)

pls help

Link to comment
5 hours ago, Zorgman said:

Use attachElements to stick the weapon to your vehicle.

 

still not the same.

Cod-1
function tankHat (commandName)
   local position = Vector3(getElementPosition (localPlayer)) -- Get the players position
   local tank = createWeapon ( ak-47, -1590.0594482422, -182.07429504395, 17.077798843384 + 5 ) -- Create a tank
   attachElements (tank,localPlayer, 2, 2, 5 ) -- Attach the tank to the player.
end
addCommandHandler( "silah", tankHat 
cod-2

bool attachElements ( element ak-47, element vehicle, [ float -1590.0594482422 = +1, float -182.07429504395 = +1, float 17.077798843384 = +1, float -1590.0594482422 = 1, float -182.07429504395 = 1, float 17.077798843384 = 1 ] )

Pls help me

Link to comment

First argument in createWeapon needs to be a string i.e. enclosed in quotation marks. Fixing that means just scratching the surface regarding your code and what you try to accomplish. You'll need to learn some lua basics first, I'm afraid you can't be helped otherwise - unless someone with a kind heart and free time does the job for you. Good luck!

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