Jump to content

Script help needed!


dutchops

Recommended Posts

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

Link to comment

that script doesnt work this is my meta :

this is the script

local root = getRootElement()

function callbackPlayerJoin()

if (spawnPlayer(source, 0, 0, 5)) then

fadeCamera(source, true)

end

end

function callbackResourceStart(startedResource)

if (getResourceName(startedResource) == "bomber") then

createMarker(0, 0, 2.0, "cylinder", 5, 117, 193, 36, 255)

createMarker(64, 220, 0, "cylinder", 5, 44, 124, 214, 255)

call(getResourceFromName("bomber"), "regBombMarkers", getElementsByType("marker", root))

end

end

addEventHandler("onPlayerJoin", root, callbackPlayerJoin)

addEventHandler("onResourceStart", root, callbackResourceStart)

and it doesnt make any bombs or wtf it doesnt even make the marker

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