Jump to content

Script Error..Help


Recommended Posts

What's the wrong with this script?

local gate = createObject (  980, 2287,603.20001220703,12.60000038147,0,0,0) 
  
function moveObject (thePlayer) 
  
  
        local x, y, z = getElementPosition(thePlayer) 
        local distance = getDistanceBetweenPoints3D(2287,603.20001220703,12.60000038147, x, y, z) 
  
        if (distance<=17) then 
  
    moveObject (gate, 3000, 2200, 2287,603.20001220703,7) 
    setTimer (moveBack, 4500, 1) 
else 
outputChatBox("You are too far away from the gate", thePlayer, 255, 0, 0) 
  
end 
  
addCommandHandler ("open", moveObject) 
  
function moveBack (thePlayer) 
  
moveObject (gate, 3000, 2287,603.20001220703,12.60000038147) 
  
end 

when i start it i get ERROR:

Warning: Loading script failed: Gate1\gates.lua:24: 'end' expected (to close 'function at line 3) near '(eof)'  

Please help me guys :)....Thanks :)

Link to comment

local gate = createObject (  980, 2287,603.20001220703,12.60000038147,0,0,0) 
function MoveObject (thePlayer) 
    local x, y, z = getElementPosition(thePlayer) 
        local distance = getDistanceBetweenPoints3D(2287,603.20001220703,12.60000038147, x, y, z) 
            if (distance <= 17) then 
                moveObject (gate, 3000, 2200, 2287,603.20001220703,7) 
                    setTimer (moveBack, 4500, 1) 
              else 
                    outputChatBox("You are too far away from the gate", thePlayer, 255, 0, 0) 
    end 
end 
addCommandHandler ("open",  MoveObject) 
  
function moveBack () 
    moveObject (gate, 3000, 2287,603.20001220703,12.60000038147) 
end 
Link to comment
local gate = createObject (  980, 2287,603.20001220703,12.60000038147,0,0,0) 
function MoveObject (thePlayer) 
    local x, y, z = getElementPosition(thePlayer) 
        local distance = getDistanceBetweenPoints3D(2287,603.20001220703,12.60000038147, x, y, z) 
            if (distance <= 17) then 
                moveObject (gate, 3000, 2200, 2287,603.20001220703,7) 
                    setTimer (moveBack, 4500, 1) 
              else 
                    outputChatBox("You are too far away from the gate", thePlayer, 255, 0, 0) 
    end 
end 
addCommandHandler ("open",  MoveObject) 
  
function moveBack () 
    moveObject (gate, 3000, 2287,603.20001220703,12.60000038147) 
end 

and what the problem was with the script?

Link to comment
local gate = createObject (  980, 2287,603.20001220703,12.60000038147,0,0,0) 
function MoveObject (thePlayer) 
    local x, y, z = getElementPosition(thePlayer) 
        local distance = getDistanceBetweenPoints3D(2287,603.20001220703,12.60000038147, x, y, z) 
            if (distance <= 17) then 
                moveObject (gate, 3000, 2200, 2287,603.20001220703,7) 
                    setTimer (moveBack, 4500, 1) 
              else 
                    outputChatBox("You are too far away from the gate", thePlayer, 255, 0, 0) 
    end 
end 
addCommandHandler ("open",  MoveObject) 
  
function moveBack () 
    moveObject (gate, 3000, 2287,603.20001220703,12.60000038147) 
end 

and what the problem was with the script?

Problem is : " You Need end at line 17

Link to comment
local gate = createObject (  980, 2287,603.20001220703,12.60000038147,0,0,0) 
function MoveObject (thePlayer) 
    local x, y, z = getElementPosition(thePlayer) 
        local distance = getDistanceBetweenPoints3D(2287,603.20001220703,12.60000038147, x, y, z) 
            if (distance <= 17) then 
                moveObject (gate, 3000, 2200, 2287,603.20001220703,7) 
                    setTimer (moveBack, 4500, 1) 
              else 
                    outputChatBox("You are too far away from the gate", thePlayer, 255, 0, 0) 
    end 
end 
addCommandHandler ("open",  MoveObject) 
  
function moveBack () 
    moveObject (gate, 3000, 2287,603.20001220703,12.60000038147) 
end 

and what the problem was with the script?

lol... now when i just write /open...the gate hide really fast speed! then come back after 4 seconds...wtf? it's not open good..just hide and back..and type /open the gate change position....:/

Link to comment
local gate = createObject (  980, 2287,603.20001220703,12.60000038147,0,0,0) 
function MoveObject (thePlayer) 
    local x, y, z = getElementPosition(thePlayer) 
        local distance = getDistanceBetweenPoints3D(2287,603.20001220703,12.60000038147, x, y, z) 
            if (distance <= 17) then 
                moveObject (gate, 3000, 2200, 2287,603.20001220703,7) 
                    setTimer (moveBack, 4500, 1) 
              else 
                    outputChatBox("You are too far away from the gate", thePlayer, 255, 0, 0) 
    end 
end 
addCommandHandler ("open",  MoveObject) 
  
function moveBack () 
    moveObject (gate, 3000, 2287,603.20001220703,12.60000038147) 
end 

and what the problem was with the script?

lol... now when i just write /open...the gate hide really fast speed! then come back after 4 seconds...wtf? it's not open good..just hide and back..and type /open the gate change position....:/

# I did not understand what the problem is exactly, but then increase Timer

Link to comment
and what the problem was with the script?

The problem in your code , in the line 17 you need 'end'

and can you tell me what do you want to do ?

when i write /open..the gate just hides and after the timer back the gate just be shown in another position..it's the problem..may you test the gate and see? if you can

Link to comment
if you want the gate ' Down' and 'Up' why you make timer with another position ?

move the gate 'Down' and make timer for 'Up'

Okay Thanks i will try and tell you

Thanks A lot...The Problem was from the Position of Function moveObject... :) Thanks for helping

You're welcome.

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