Search the Community
Showing results for tags 'mta elevator'.
-
Hello, I am trying to make an elevator script using an createObject, moveObject and attachElements to attach a vehicle to the object, the problem is, the vehicle goes through the object even if I add an Z offset, this is my code: local elevatorcolshape = createColRectangle ( 1666, 1188, 30.6, 20.0 ) local elevator = createObject(3115, 1676.9, 1197.8, 24.2) local elevatorSTATE = "techo" function elevator1337(source,command,goto ) local playeraccount = getPlayerAccount( source ) local accname = getAccountName( playeraccount ) local playerx,playery,playerz = getElementPosition( source ) local elevatorx,elevatory,elevatorz = getElementPosition(elevator) if (accname == "knight") then if (goto) then if (goto == "piso") then if (elevatorSTATE ~= "piso") then if (isElementWithinColShape(source, elevatorcolshape ) and playerz < 20) then outputChatBox( "[BASE 1337]: NO PUEDES LLAMAR EL ELEVADOR PORQUE TE VA A APLASTAR",source,255,0,0,true ) else local isinveh = isPedInVehicle( source ) if (isinveh) then attachElements(getPedOccupiedVehicle(source),elevator) end elevatorSTATE = "piso" outputChatBox( "[BASE 1337]: ELEVADOR MOVIENDOSE A: "..goto,source,0,255,0,true ) moveObject( elevator, 1000, 1676.9, 1197.8, 18.2) setTimer(moveObject, 1250, 1, elevator, 1000, 1685.9, 1197.8, 18.2) setTimer(moveObject, 2500, 1, elevator, 1000, 1685.9, 1197.8, 9.7) if (isinveh) then setTimer(detachElements,3000, 1,getPedOccupiedVehicle(source),elevator) end end else outputChatBox( "[BASE 1337]: EL ELEVADOR YA ESTA EN: "..goto,source,255,0,0,true ) end end if (goto == "techo") then if (elevatorSTATE ~= goto) then local isinveh = isPedInVehicle( source ) if (isinveh) then attachElements(getPedOccupiedVehicle(source),elevator,0,0,3) end elevatorSTATE = goto outputChatBox( "[BASE 1337]: ELEVADOR MOVIENDOSE A: "..goto,source,0,255,0,true ) moveObject( elevator, 500, 1685.9, 1197.8, 18.2) setTimer(moveObject, 750, 1, elevator, 500, 1676.9, 1197.8, 18.2) setTimer(moveObject, 1500, 1, elevator, 500, 1676.9, 1197.8, 24.2) if (isinveh) then setTimer(detachElements,3000, 1,getPedOccupiedVehicle(source),elevator) end else outputChatBox( "[BASE 1337]: EL ELEVADOR YA ESTA EN: "..goto,source,255,0,0,true ) end end end end end addCommandHandler("elev", elevator1337 ) I would like to know if there is a way to avoid the car going through the item and fall, thanks