Jump to content

Script ERROR..help Please!


Recommended Posts

When i write /gate... and open..the gate don't back to the position after the timer

    local gate1 = createObject (  16773, 2506.5, -2110.5, 16.5, 0, 0, 0) 
    local gate2 = createObject (  16773, 2521.1000976563, -2110.5, 16.5, 0, 0, 0) 
    function MoveObject (thePlayer) 
     
        local team = getPlayerTeam(thePlayer) 
        local x, y, z = getElementPosition(thePlayer) 
        local distance = getDistanceBetweenPoints3D(2513.6999511719, -2110.6000976563, 13.5, x, y, z) 
    if (distance <= 10) then 
    if (team==getTeamFromName("ZombieTeam")) then 
     
        moveObject (gate1, 5000, 2494.5, -2110.3000488281, 16.5) 
        moveObject (gate2, 5000, 2532.6000976563, -2110.1000976563, 16.5) 
        setTimer (moveBack, 6500, 1) 
        outputChatBox ("Welcome", thePlayer, 0, 255, 0) 
            end 
        end 
    end 
     
    addCommandHandler ("gate", MoveObject) 
      
    function moveBack () 
        moveObject (gate1, 2506.5, -2110.5, 16.5) 
        moveObject (gate2, 2521.1000976563, -2110.5, 16.5) 
    end 

ERRORS!:

FactoryGate.lua:22: Bad argument @ 'moveObject' [expected number at argument 5, got none] 

FactoryGate.lua:23: Bad argument @ 'moveObject' [expected number at argument 5, got none] 

Link to comment

Try this:

   local gate1 = createObject (  16773, 2506.5, -2110.5, 16.5, 0, 0, 0) 
    local gate2 = createObject (  16773, 2521.1000976563, -2110.5, 16.5, 0, 0, 0) 
    function MoveObject (thePlayer) 
    
        local team = getPlayerTeam(thePlayer) 
        local x, y, z = getElementPosition(thePlayer) 
        local distance = getDistanceBetweenPoints3D(2513.6999511719, -2110.6000976563, 13.5, x, y, z) 
    if (distance <= 10) then 
    if (team==getTeamFromName("ZombieTeam")) then 
    
        moveObject (gate1, 5000, 2494.5, -2110.3000488281, 16.5) 
        moveObject (gate2, 5000, 2532.6000976563, -2110.1000976563, 16.5) 
        setTimer (moveBack, 6500, 1) 
        outputChatBox ("Welcome", thePlayer, 0, 255, 0) 
            end 
        end 
    end 
    
    addCommandHandler ("gate", MoveObject) 
      
    function moveBack () 
        moveObject (gate1, 5000, 2506.5, -2110.5, 16.5) 
        moveObject (gate2, 5000, 2521.1000976563, -2110.5, 16.5) 
    end 
  

Link to comment
Try this:
   local gate1 = createObject (  16773, 2506.5, -2110.5, 16.5, 0, 0, 0) 
    local gate2 = createObject (  16773, 2521.1000976563, -2110.5, 16.5, 0, 0, 0) 
    function MoveObject (thePlayer) 
    
        local team = getPlayerTeam(thePlayer) 
        local x, y, z = getElementPosition(thePlayer) 
        local distance = getDistanceBetweenPoints3D(2513.6999511719, -2110.6000976563, 13.5, x, y, z) 
    if (distance <= 10) then 
    if (team==getTeamFromName("ZombieTeam")) then 
    
        moveObject (gate1, 5000, 2494.5, -2110.3000488281, 16.5) 
        moveObject (gate2, 5000, 2532.6000976563, -2110.1000976563, 16.5) 
        setTimer (moveBack, 6500, 1) 
        outputChatBox ("Welcome", thePlayer, 0, 255, 0) 
            end 
        end 
    end 
    
    addCommandHandler ("gate", MoveObject) 
      
    function moveBack () 
        moveObject (gate1, 5000, 2506.5, -2110.5, 16.5) 
        moveObject (gate2, 5000, 2521.1000976563, -2110.5, 16.5) 
    end 
  

Wow! Worked Fine 10000% :D And i understanded what was the fucken mistake xD It's Shit! with the time xD

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