hello i had a idea to make a script that a plane has a Barrel Attached to the bottem of it and when they push B the airplane drops 1 barrel and the barrel will explode on the floor but what i got now is this :
function mount_barrel (player)
local x, y, z = getElementPosition( player )
local plain = createVehicle( 511, x, y, z )
attachElementToElement( plain, player, 0, 0, -1 )
triggerClientEvent ("bind_key", getRootElement (), object)
else
end
end
addCommandHandler ("mount_barrel", mount_barrel)
addEvent ("bind_key", true)
function drop_barrel ()
local x, y, z = getElementPosition (getPlayerOccupiedVehicle (getLocalPlayer()))
createObject ( getLocalPlayer(), 1225, x, y, z + -1, -1.0 )
end
function bind_key_function ()
bindKey ("b", "down", drop_barrel)
local attachedElements = getAttachedElements ( getPlayerOccupiedVehicle (getLocalPlayer()) )
for ElementKey, ElementValue in ipairs ( attachedElements ) do
setElementCollisionsEnabled (ElementValue, false)
end
end
addEventHandler ("bind_key", getLocalPlayer(), bind_key_function)
what more to add could someone help me? thnx