Jump to content

can 1 elevator has three points


DYNAMO

Recommended Posts

function createTheElevator () 
  
  
   Elevator = createObject ( 3885, 1525.546875, -1352.9073486328, 328.25183105469, 0 , 0 , 0 ) 
  
  
end 
  
  
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheElevator ) 
  
  
  
  
  
  
  
  
function moveElevator ( ) 
  
  
   moveObject ( Elevator, 6000, -3252.2414550781, 699.95812988281, 118.09313201904, 0 , 0 , 0 ) 
  
  
       setTimer ( movingElevatorBack, 20000, 1 ) 
  
  
end 
  
  
addCommandHandler("swat3",moveElevator) 
  
  
  
  
  
  
  

Link to comment

@ abxf : I don't think that element data is the best way to do it .

@ iMr.3a[Z]eF : Why use "setElementPosition" while you have "moveObject" ?

@ DYNAMO : Not tested, But Try this :

local Elevator = createObject( 3885, 1525.546875, -1352.9073486328, 328.25183105469, 0 , 0 , 0 ) 
local level = 0 
local levels = { 
    [ 0 ] = { x, y, z }, 
    [ 1 ] = { x, y, z }, 
    [ 2 ] = { x, y, z } 
} 
  
function checkTheLevel( ) 
    if level and tonumber( level ) then 
        if level >= #levels - 1 then 
            level = 0 
        else 
            level = level + 1 
        end 
        return level 
    end 
    return false 
end 
  
function moveElevator( ) 
    local nextLevel = checkTheLevel( ) 
    if nextLevel then 
        local x, y, z = unpack( levels[ nextLevel ] ) 
        moveObject( Elevator, 6000, x, y, z ) 
    end 
end 
addCommandHandler( "swat3", moveElevator ) 

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