kikos500 Posted August 8, 2015 Share Posted August 8, 2015 soo i made a command adds to u ramp on car but i won't it to be destroyed when map ends so there is the code function ramp ( thePlayer, commandName ) if ( thePlayer ) then local ramp = createObject ( 1634, 0, 0, 0, 0, 0, 0 ) attachElements ( ramp, getPedOccupiedVehicle(thePlayer), 0, 1, 0, 0, 0, 180 ) setObjectScale ( ramp, 0.7) if ( ramp ) then outputChatBox ( "Ramp Added", thePlayer ) end end end addCommandHandler ( "ramp", ramp ) Link to comment
GTX Posted August 8, 2015 Share Posted August 8, 2015 What do you mean when map ends? Link to comment
Moderators IIYAMA Posted August 8, 2015 Moderators Share Posted August 8, 2015 try something like this: local mapRoot = resourceRoot -- temporary adding to resourceRoot addEventHandler("onResourceStart",resourceRoot, function () local resourceOfMap = export.mapmanager:getRunningGamemodeMap ( ) if resourceOfMap then mapRoot = getResourceRootElement(resourceOfMap) end end) addEventHandler( "onGamemodeMapStart", root, function (startedMap) mapRoot = getResourceRootElement(startedMap) end) function ramp ( thePlayer, commandName ) if ( thePlayer ) then local ramp = createObject ( 1634, 0, 0, 0, 0, 0, 0 ) if ramp then attachElements ( ramp, getPedOccupiedVehicle(thePlayer), 0, 1, 0, 0, 0, 180 ) setObjectScale ( ramp, 0.7) outputChatBox ( "Ramp Added", thePlayer ) if isElement(mapRoot) then local setToParent = setElementParent(ramp, mapRoot) if setToParent then -- debug -- outputDebugString("Set ramp parent successfully!") end end end end end addCommandHandler ( "ramp", ramp ) Link to comment
kikos500 Posted August 8, 2015 Author Share Posted August 8, 2015 What do you mean when map ends? To destroy the ramp when map ends Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now