Jump to content

Help Attach cuboid and if in cuboid=trigger client


VenomOG

Recommended Posts

Hey so i have a Andromada script, 
i want when player enters andromada it creates cuboid and attach cuboid to the plane 
and if player in cuboid and hit a marker give players money in the marker CODE:
 


function loadAndro()
	a = createVehicle(592, 309.95739746094, 1824.1492919922, 18.640625)
	setElementData(a, "fuel", 100)
	setTimer(fixVehicle, 2000, 1, a)
end

loadAndro()

addEventHandler("onVehicleEnter", root, function (p, s)
	if source == a and s == 0 then
	cuboid = createMarker ( 0, 0,0, "cylinder",50, 255, 255, 255,0 )
	triggerClientEvent(p, "complete",p)
	exports.ISGMessages:sendClientMessage("Andromada: mission has been started deliver it to SF",p,0,255,0)
	attachElements ( cuboid ,source, 0, 0,-2 )
	marker = createMarker(-1243.03, -191.14, 13.14,"cylinder",5,255,0,255,255,getRootElement())
end
end)
setTimer(function ()
	if not isElement(a) then
		loadAndro()
	end
	if isElementInWater(a) then
		destroyElement(a)
	end
end, 5000, 0)
function exit(root)
triggerClientEvent("close",root)
end
addEventHandler("onElementDestroy", a, loadAndro)
addEventHandler("onVehicleExplode", a, loadAndro)
addEventHandler("onVehicleExit", a, exit)

function markerhit(thePlayer)
if (getTeamName(getPlayerTeam(localPlayer)) == "Gangster") then
triggerClientEvent(thePlayer, "complete",thePlayer)
exports.ISGMessages:sendClientMessage("Andromada: protect the mother ship until it reaches SF",root,255,0,255)
end
end
addEventHandler("onMarkerHit",cuboid,markerhit)
function sfmarkerhit(theM)
triggerClientEvent(source,"complete2",source)
exports.ISGMessages:sendClientMessage("Andromada: mission sucess",source,0,255,0)
givePlayerMoney(root,50000)
end
addEventHandler("onMarkerHit",marker,sfmarkerhit)

The bug is it dosnt create cuboid  and when it did it dosnt attach to the ship

Link to comment

put "else" on that "if" statement. so that the lines from 10 to 18 looks like below,

addEventHandler("onVehicleEnter", root, function (p, s)
	if source == a and s == 0 then
	cuboid = createMarker ( 0, 0,0, "cylinder",50, 255, 255, 255,0 )
	triggerClientEvent(p, "complete",p)
	exports.ISGMessages:sendClientMessage("Andromada: mission has been started deliver it to SF",p,0,255,0)
	attachElements ( cuboid ,source, 0, 0,-2 )
	marker = createMarker(-1243.03, -191.14, 13.14,"cylinder",5,255,0,255,255,getRootElement())
        else
        outputChatBox("Error Is Here !",p)
end
end)

 

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