Jump to content

Need help with gate script!


xScatta

Recommended Posts

Posted

Yeah so there we are here its a problem

function brama() 
lol = createObject ( 987, 316.79, -1191.80, 74.90, 0, 0, 40 ) 
x, y, z = 316.79, -1191.80, 74.90 
x1, y1, z1 = getElementPosition ( lol ) 
if ( x1, y1, z1 == x, y, z ) then  
moveObject ( lol, 2.5, 316.79, -1191.80, 69, 0, 0, 40 ) 
elseif ( x1, y1, z1 == x, y, z ) then  
moveObject ( lol, 2.5, 316.79, -1191.80, 74.90, 0, 0, 40 ) 
end 
end 
  
  
addCommandHandler("brama", brama ) 

problem is in the

if ( x1, y1, z1 == x, y, z ) then debug script says ')' expected near ','

i dont know why because i maked many scripts like this but this dont work why?

any repair

It's fine to celebrate success but it is more important to heed the lessons of failure.

Posted

((Not Tested))

lol = createObject ( 987, 316.79, -1191.80, 74.90, 0, 0, 40 ) 
local isGateOpen = false; 
function brama() 
    if ( not isGateOpen ) then 
        moveObject ( lol, 2.5, 316.79, -1191.80, 69, 0, 0, 40 ) 
        isGateOpen = true 
    else 
        moveObject ( lol, 2.5, 316.79, -1191.80, 74.90, 0, 0, 40 ) 
        isGateOpen = false 
    end 
end 
 addCommandHandler("brama", brama ) 

Posted

Not working because after third use of command gate teleports not in the place it must.

It's fine to celebrate success but it is more important to heed the lessons of failure.

Posted

Omg thats stupid i want to repair my script not edit someone else ;-; and i wanna make it at command... Any good scripter here?

It's fine to celebrate success but it is more important to heed the lessons of failure.

Posted
lol = createObject ( 987, 316.79, -1191.80, 74.90, 0, 0, 40 ) 
function move() 
    if lol then 
        moveObject ( lol, 2.5, 316.79, -1191.80, 69, 0, 0, 40 ) 
    else 
        moveObject ( lol, 2.5, 316.79, -1191.80, 74.90, 0, 0, 40 ) 
    end 
end 
 addCommandHandler("brama", move ) 

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

Posted

Opening gate only works when i say /brama then brama opens but when i say /brama again then nothing happen. :| any scripter here can help?

It's fine to celebrate success but it is more important to heed the lessons of failure.

Posted
local lol = createObject ( 987, 316.79, -1191.80, 74.90, 0, 0, 40 ) 
local state = 0 
function move() 
    if state == 0 then 
        moveObject ( lol, 2.5, 316.79, -1191.80, 69, 0, 0, 40 ) 
        state = state + 1 
    elseif state == 1 then 
        moveObject ( lol, 2.5, 316.79, -1191.80, 74.90, 0, 0, 40 ) 
        state = state - 1 
    end 
end 
 addCommandHandler("brama", move ) 

Try this

Posted

Like before at third use of command the gate teleport not in the place it must.

It's fine to celebrate success but it is more important to heed the lessons of failure.

Posted
local lol = createObject ( 987, 316.79, -1191.80, 74.90, 0, 0, 40 ) 
local state = 0 
function move() 
    if state == 0 then 
        moveObject ( lol, 2.5, 316.79, -1191.80, 69 ) 
        state = state + 1 
    elseif state == 1 then 
        moveObject ( lol, 2.5, 316.79, -1191.80, 74.90) 
        state = state - 1 
    end 
end 
 addCommandHandler("brama", move ) 

It must be work this way now! :)

I tested it.

The problem was that, the rotation is relative when you use moveObject() :)

Posted

Ok it works thanks! :)

But what means "relative"?

It's fine to celebrate success but it is more important to heed the lessons of failure.

Posted
moveObject ( lol, 2.5, 316.79, -1191.80, 69, 0, 0, 40 ) 

It means that every time you use "brama" it'll rotate it's Z axis with +40 and not set it to 40.

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