Jump to content

Gate


600er

Recommended Posts

Hey guys! Can you help me fix my gate pls? I have done it, and the doors open on radius.

But when they close they stay like that. When I come closer then the gates just teleport to the open position.

I want to make it to open slowly.

This is my first gate using the "setElementRotation". I have used the "moveObjet" till now only.

So please help me!

Here is my code:

Door1 = createObject ( 3050, 1459, -1492.599, 14.8, 0, 0, 74.998 ) 
Door2 = createObject ( 3049, 1456.599, -1501.399, 14.8, 0, 0, 254.745 ) 
Doorscol = createColCircle ( 1457.88, -1497.003, 7, 15 ) 
  
function openDoors(thePlayer) 
if getElementModel( thePlayer ) == 241 or 292 or 305 or 309 or 50 then 
       setElementRotation (Door1, 0, 0, 331.748 ) 
       setElementRotation (Door2, 0, 0, 3.495 ) 
end 
end 
addEventHandler( "onColShapeHit", Doorscol, openDoors ) 
  
function closeDoors(thePlayer) 
if getElementModel( thePlayer ) == 241 or 292 or 305 or 309 or 50 then 
       setElementRotation (Door1, 0, 0, 74.998 ) 
       setElementRotation (Door2, 0, 0, 254.745 ) 
end 
end 
addEventHandler( "onColShapeLeave", Doorscol, closeDoors ) 

Link to comment

He's saying that the gate is not moving to the position, is teleporting to it.

That's because you're using: setElementPosition instead of moveObject.

Door1 = createObject ( 3050, 1459, -1492.599, 14.8, 0, 0, 74.998 ) 
Door2 = createObject ( 3049, 1456.599, -1501.399, 14.8, 0, 0, 254.745 ) 
Doorscol = createColCircle ( 1457.88, -1497.003, 7, 15 ) 
local validSkins = {[241] = true, [292] = true, [305] = true, [309] = true, [50] = true} 
  
function openDoors(thePlayer) 
    if validSkins[getElementModel( thePlayer )] then 
        moveObject(Door1, 3000, 1459, -1489.599, 14.
        moveObject(Door2, 3000, 1456.599, -1504.399, 14.
    end 
end 
addEventHandler( "onColShapeHit", Doorscol, openDoors ) 
  
function closeDoors(thePlayer) 
    if validSkins[getElementModel( thePlayer )] then 
        moveObject(Door1, 3000, 1459, -1492.599, 14.
        moveObject(Door2, 3000, 1456.599, -1501.399, 14.
    end 
end 
addEventHandler( "onColShapeLeave", Doorscol, closeDoors ) 

Btw, you'll have to set the correct position, current one's aren't right.

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