Jump to content

More help needed!


maky55

Recommended Posts

Hey again!

Last year, I had a script that could make gates that open and close.

This is the code:

gate = createObject( 975, 2585.6999511719, -2125.1000976563, 4.1999998092651, 0, 0, 0 ) --Object ID (Airport Gate=978) & Co-Ordinates of your gates start of position. 
gatecol = createColCircle ( 2581.1999511719, -2125.3999023438, 15 ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. 
  
function openagates ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" ) then 
        if ( isPlayerInGroup ( thePlayer ) ) then 
            moveObject ( gate, 2000, 2593.8000488281, -2124.8000488281, 4.1999998092651 ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. 
        else 
            outputChatBox ( "Sorry, you can not open this gate as you are not in the specified groups", thePlayer ) 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", gatecol, openagates ) --Event Handler to trigger the function 
  
function closeagates ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" ) then 
        if ( isPlayerInGroup ( thePlayer ) ) then 
            moveObject ( gate, 2000, 2585.6999511719, -2125.1000976563, 4.1999998092651 ) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. 
        end 
    end 
end 
addEventHandler ( "onColShapeLeave", gatecol, closeagates ) --Event Handler to trigger the function 
  
function isPlayerInGroup ( thePlayer ) 
    local accountName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Super Moderator" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) ) then 
        return true 
    else 
        return false 
    end 
end 

That's okay, and if you're making one gate, it does it's job. But I wanted to make more then one gate. I tried to do it like this:

-- 1 
gate = createObject( 975, 2585.6999511719, -2125.1000976563, 4.1999998092651, 0, 0, 0 ) --Object ID (Airport Gate=978) & Co-Ordinates of your gates start of position. 
gatecol = createColCircle ( 2581.1999511719, -2125.3999023438, 15 ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. 
  
function openagates ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" ) then 
        if ( isPlayerInGroup ( thePlayer ) ) then 
            moveObject ( gate, 2000, 2593.8000488281, -2124.8000488281, 4.1999998092651 ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. 
        else 
            outputChatBox ( "Sorry, you can not open this gate as you are not in the specified groups", thePlayer ) 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", gatecol, openagates ) --Event Handler to trigger the function 
  
function closeagates ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" ) then 
        if ( isPlayerInGroup ( thePlayer ) ) then 
            moveObject ( gate, 2000, 2585.6999511719, -2125.1000976563, 4.1999998092651 ) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. 
        end 
    end 
end 
addEventHandler ( "onColShapeLeave", gatecol, closeagates ) --Event Handler to trigger the function 
  
function isPlayerInGroup ( thePlayer ) 
    local accountName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Super Moderator" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) ) then 
        return true 
    else 
        return false 
    end 
end 
  
-- 2 
gate = createObject( 975, 2585.6999511719, -2125.1000976563, 1.2000000476837, 0, 0, 0 ) --Object ID (Airport Gate=978) & Co-Ordinates of your gates start of position. 
gatecol = createColCircle ( 2581.1999511719, -2125.3999023438, 15 ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. 
  
function openagates ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" ) then 
        if ( isPlayerInGroup ( thePlayer ) ) then 
            moveObject ( gate, 2000, 2594.5, -2125.1000976563, 1.2000000476837 ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. 
        else 
            outputChatBox ( "Sorry, you can not open this gate as you are not in the specified groups", thePlayer ) 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", gatecol, openagates ) --Event Handler to trigger the function 
  
function closeagates ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" ) then 
        if ( isPlayerInGroup ( thePlayer ) ) then 
            moveObject ( gate, 2000, 2585.6999511719, -2125.1000976563, 1.2000000476837 ) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. 
        end 
    end 
end 
addEventHandler ( "onColShapeLeave", gatecol, closeagates ) --Event Handler to trigger the function 
  
function isPlayerInGroup ( thePlayer ) 
    local accountName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Super Moderator" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) ) then 
        return true 
    else 
        return false 
    end 
end 
  
-- 3 
gate = createObject( 975, 2576.900390625, -2125.099609375, 4.1999998092651, 0, 0, 0 ) --Object ID (Airport Gate=978) & Co-Ordinates of your gates start of position. 
gatecol = createColCircle ( 2581.1999511719, -2125.3999023438, 15 ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. 
  
function openagates ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" ) then 
        if ( isPlayerInGroup ( thePlayer ) ) then 
            moveObject ( gate, 2000, 2570.1000976563, -2125.1000976563, 4.1999998092651 ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. 
        else 
            outputChatBox ( "Sorry, you can not open this gate as you are not in the specified groups", thePlayer ) 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", gatecol, openagates ) --Event Handler to trigger the function 
  
function closeagates ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" ) then 
        if ( isPlayerInGroup ( thePlayer ) ) then 
            moveObject ( gate, 2000, 2576.900390625, -2125.099609375, 4.1999998092651 ) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. 
        end 
    end 
end 
addEventHandler ( "onColShapeLeave", gatecol, closeagates ) --Event Handler to trigger the function 
  
function isPlayerInGroup ( thePlayer ) 
    local accountName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Super Moderator" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) ) then 
        return true 
    else 
        return false 
    end 
end 
  
-- 4 
gate = createObject( 975, 2576.900390625, -2125.099609375, 1.2000000476837, 0, 0, 0 ) --Object ID (Airport Gate=978) & Co-Ordinates of your gates start of position. 
gatecol = createColCircle ( 2581.1999511719, -2125.3999023438, 15 ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. 
  
function openagates ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" ) then 
        if ( isPlayerInGroup ( thePlayer ) ) then 
            moveObject ( gate, 2000, 2570, -2124.6999511719, 1.2000000476837 ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. 
        else 
            outputChatBox ( "Sorry, you can not open this gate as you are not in the specified groups", thePlayer ) 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", gatecol, openagates ) --Event Handler to trigger the function 
  
function closeagates ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" ) then 
        if ( isPlayerInGroup ( thePlayer ) ) then 
            moveObject ( gate, 2000, 2576.900390625, -2125.099609375, 1.2000000476837 ) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. 
        end 
    end 
end 
addEventHandler ( "onColShapeLeave", gatecol, closeagates ) --Event Handler to trigger the function 
  
function isPlayerInGroup ( thePlayer ) 
    local accountName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Super Moderator" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) ) then 
        return true 
    else 
        return false 
    end 
end 

But it doesn't work. Every gate has the same code as gate one, except the co-ordinates are different. What happens is, only the last gate actually opens and none others, they are there but stay still. But I've found that if you do each gate separately (EX, removing all the code except what's needed for one gate), then one gate works at a time, but not all together.

I've also tried multiple files and putting them into folders. The debugger doesn't give me any errors, and i'm stuck.

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