Hi! I'm a new fag on this, I barely could build this script to make that the car have weapons mounted (like Twisted Metal cars):
local weapon = createWeapon("ak47", 0, 0, 1 )
local weapon2 = createWeapon("ak47", 0, 0, 1 )
setElementAlpha ( weapon, 0)
setElementAlpha ( weapon2, 0)
local weaponINV = createWeapon("ak47", 0, 0, 1 )
local weapon2INV = createWeapon("ak47", 0, 0, 1 )
function createAndFire()
local theVehicle = getPedOccupiedVehicle ( localPlayer )
if theVehicle then
local x,y,z = getElementPosition ( theVehicle )
local rX,rY,rZ = getElementRotation(theVehicle)
attachElements ( weapon, theVehicle, 1, 2, 0, 0, 0, 90 )
attachElements ( weapon2, theVehicle, -1, 2, 0, 0, 0, 90 )
attachElements ( weaponINV, theVehicle, 1, 2, 0, 0, 0, 95 )
attachElements ( weapon2INV, theVehicle, -1, 2, 0, 0, 0, 95 )
fireWeapon(weapon)
fireWeapon(weapon2)
end
end
bindKey("mouse2", "down", createAndFire)
addEventHandler("onClientResourceStart", resourceRoot, createAndFire)
This works good. But now I wanted to know how to make it works with other players. I mean, I tested it with my friend and when I shoot him he don't get damage, and he can't see my weapons on the car too, and I either.