shaio Posted August 13, 2016 Share Posted August 13, 2016 I have a car lift mod, basically the machine and base are seperate mods, and i just move the base up. But I cant get anything to go with tables.. I need a little help.. addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() createObject(11388, -2048.216796875, 166.73092651367, 34.468391418457, 0.000000, 0.000000, 0.000000) createObject(11389, -2048.1174316406, 166.71966552734, 30.975694656372, 0.000000, 0.000000, 0.000000) createObject(11392, -2047.8289794922, 167.54446411133, 27.835615158081, 0.000000, 0.000000, 0.000000) end) lifts = { {ID = 1, x = -2052.5903320312, y = 178.61114501953, z = 27.834247589111, rx = 0, ry = 0, rz = 90} } for _,w in ipairs(lifts) do object[w.ID] = createObject(2597, w.x, w.y, w.z, w.rx, w.ry, w.rz) lift[w.ID] = createObject(2231, w.x, w.y, w.z - 3.632013320923, w.rx, w.ry, w.rz) marker[w.ID] = createMarker( w.x + 2, w.y, w.z, "cylinder", 1, 250, 20, 100, 170) addEventHandler("onMarkerHit",marker[w.ID],function(element) if (getElementType(element) == "player") and (source == marker[w.ID]) and (isPedInVehicle(element) == false) then if source == marker[w.ID] then setMarkerColor(marker[w.ID],10,195,245,170) bindKey("num_add","down",moveRamp2) bindKey("num_add","up",stopRamp) bindKey("num_sub","down",moveRamp1) bindKey("num_sub","up",stopRamp) end end end) addEventHandler("onMarkerLeave",marker[w.ID],function(element) if (getElementType(element) == "player") and (source == marker[w.ID]) and (isPedInVehicle(element) == false) then if source == marker[w.ID] then unbindKey("num_add","both") unbindKey("num_sub","both") stopRamp() setMarkerColor(marker[w.ID],250,20,100,170) end end end) end --[[ This is all gonna be changed function moveRamp1() timer1 = setTimer(moveUp,50,0) end function moveRamp2() timer2 = setTimer(moveDown,50,0) end function stopRamp() if timer1 then killTimer(timer1) end if timer2 then killTimer(timer2) end end) function moveUp() x,y,z = getElementPosition(liftBase2) if z > 28 then return else x,y,z = getElementPosition(liftBase2) moveObject(liftBase2,1.5,x,y,z + 0.022) end end function moveDown() x,y,z = getElementPosition(liftBase2) if z < 24.2 then return else x,y,z = getElementPosition(liftBase2) moveObject(liftBase2,1.5,x,y,z - 0.022) end end ]] Link to comment
shaio Posted August 13, 2016 Author Share Posted August 13, 2016 Help? addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() createObject(11388, -2048.216796875, 166.73092651367, 34.468391418457, 0.000000, 0.000000, 0.000000) createObject(11389, -2048.1174316406, 166.71966552734, 30.975694656372, 0.000000, 0.000000, 0.000000) createObject(11392, -2047.8289794922, 167.54446411133, 27.835615158081, 0.000000, 0.000000, 0.000000) end) objects = {} lifts = { {ID = 1, x = -2052.5903320312, y = 178.61114501953, z = 27.834247589111, rx = 0, ry = 0, rz = 90}, {ID = 1, x = -2052.5903320312, y = 170.61114501953, z = 27.834247589111, rx = 0, ry = 0, rz = 90} } for _,w in ipairs(lifts) do objects[w.ID] = {} objects[w.ID].someObject = createObject(2597, w.x, w.y, w.z, w.rx, w.ry, w.rz) objects[w.ID].someObject2 = createObject(2231, w.x, w.y, w.z - 3.632013320923, w.rx, w.ry, w.rz) objects[w.ID].marker = createMarker(w.x, w.y - 3.1, w.z - 0.1, "cylinder", 1, 250, 20, 100, 170) addEventHandler("onMarkerHit",getRootElement(),function(element) if (getElementType(element) == "player") and (source == objects[w.ID].marker) and (isPedInVehicle(element) == false) then if source == objects[w.ID].marker then setMarkerColor(objects[w.ID].marker, 10, 195, 245, 170) bindKey("num_add","down",moveDown) bindKey("num_add","up",stopRamp) bindKey("num_sub","down",moveUp) bindKey("num_sub","up",stopRamp) end end end) addEventHandler("onMarkerLeave",getRootElement(),function(element) if (getElementType(element) == "player") and (source == objects[w.ID].marker) and (isPedInVehicle(element) == false) then if source == objects[w.ID].marker then unbindKey("num_add","both") unbindKey("num_sub","both") stopRamp() setMarkerColor(objects[w.ID].marker,250,20,100,170) end end end) end 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