Jump to content

Script Error..Help


Recommended Posts

Posted

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 :)

Posted

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 
Posted
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?

Posted
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

Posted
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....:/

Posted
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

Posted
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

Posted
Sorry i'm cannot test it , but tell me when you write /open what happens ?

'

I will give you the photos

1---------

r1std.jpg

2--------

gu5pw.jpg

3---------

jggkn.jpg

as you see the gate just hide and back after 4500 no more...

Posted
and what the error ?

the error is timer short ? or what ?

The problem is..i want the gate...Down...And Up...and the gate in this script Hide and Back when the timer End...and it's not a short time..idk what the problem with..I think position of the gate?

Posted
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

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

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