you mean need i add this to client?
vehWeapons = {}
function createM4Weapon()
if getElementModel(source) == 432 then
vehWeapons[source] = {}
local vX, vY, vZ = getElementPosition(source)
-- Wep 1
vehWeapons[source][1] = createWeapon("m4", vX, vY, vZ + 1)
setWeaponClipAmmo(vehWeapons[source][1], 500)
setWeaponState(vehWeapons[source][1], "ready")
attachElements(vehWeapons[source][1],source,0.7,2.4,0.7,0,0,90)
setWeaponFiringRate ( vehWeapons[source][1] , 63 )
end
end
addEventHandler( "onClientVehicleEnter",getRootElement(),createM4Weapon)
addEventHandler("onClientKey", root,
function(button,state)
local veh = getPedOccupiedVehicle(localPlayer)
if veh then
if getElementModel(veh) == 432 then
if vehWeapons[veh][1] then
if button == "lctrl" and state == true then
setWeaponState(vehWeapons[veh][1],"firing")
else
setWeaponState(vehWeapons[veh][1],"ready")
end
end
end
end
end)
function destroyCurrentVehicleWeapons()
destroyElement(vehWeapons[source][1])
vehWeapons[source] = false -- Destroy the Weapons
end
addEventHandler("onClientVehicleExit",root, destroyCurrentVehicleWeapons)
addEventHandler("onClientVehicleExplode",root, destroyCurrentVehicleWeapons)