i think that i did something wrong
function attach ( )
local theVehicle = getPedOccupiedVehicle ( localPlayer )
if theVehicle then
local x,y,z = getElementPosition ( theVehicle )
local weapon = createWeapon("minigun", x, y, z + 1)
attachElements ( minigun, theVehicle, 0, 0, 5 )
setWeaponClipAmmo(weapon, 99999)
setWeaponState(weapon, "firing")
setWeaponProperty(weapon, "fire_rotation", 0, -30, 0)
end
end
addCommandHandler ( "attach", attach )
local aimSensitivity = 30;
function rotateGun_Handler(cX, cY, aX, aY, wX, wY, wZ)
local oX, oY, oZ, oRX, oRY, oRZ = getElementAttachedOffsets(theWeapon);
if (oRX-((cY-0.5)*aimSensitivity) > 345 or oRX-((cY-0.5)*aimSensitivity) < 30) then -- Pitch Restriction
oRX = oRX-((cY-0.5)*aimSensitivity);
end
if (oRZ-((cX-0.5)*aimSensitivity) > 330 or oRZ-((cX-0.5)*aimSensitivity) < 50) then -- Yaw Restriction
oRZ = oRZ-((cX-0.5)*aimSensitivity);
end
setElementAttachedOffsets(theWeapon, oX, oY, oZ, oRX, oRY, oRZ);
setCursorPosition(screenW/2, screenH/2);
end
function consoleSetPlayerPosition ( source, commandName, posX, posY, posZ )
setElementPosition ( source, posX, posY, posZ )
end
addCommandHandler ( "setpos", consoleSetPlayerPosition )