Jump to content

[Solved] Gate System


Ayy64

Recommended Posts

Hi, i am using this gate script but i don't know how to allow only a group to open this gate. So can you guys please help me ? Or if you know a gate script that would open on command and it would work only for a group that i would put down could you write it below?

col  = createColTube (-2078.1000976563, 1405, 6.1, 10, 3) -- enter your cooderates here for your colshape please note 10 and 3 is to do with the size of the shape. 
root = getRootElement () 
  
door = createObject ( 972, -2080.3999023438, 1409.25, 5, 0, 0, 270) -- enter the ID of the object followed by the coordinates 
                                                    -- note the rotx y and z may not be required so you just remove these. x y and z is where you would put your cordinates. 
  
addEvent ( "Open", true ) 
function Open ( pla ) 
  
        if getElementType ( pla ) == "player" then 
        if vehicle or not vehicle then 
        aclGroupListACL ( aclgroup, Admin ) if --here you can alter the group from Admin to whatever you require in your server but remember the rest must be the same i.e change everything where it says Admin to your desired group and add the users to that group. 
        isObjectInACLGroup ( "user."..getPlayerName(pla), aclGetGroup ( "Staff" ) ) then 
        moveObject (door, 2200, -2080.3999023438, 1409.25, -1.3) -- here is where you enter the coordinatess of the new location of the object, 2200 = the speed of the movent. 
                else          
                return 0 
             
                end 
            end 
        end 
    end 
     
addEventHandler ( "onColShapeHit", col, Open)  
addEventHandler ( "Open", root, Open) 
  
function Close ( pla ) 
    if getElementType ( pla ) == "player" then 
        if vehicle or not vehicle then 
        aclGroupListACL ( aclgroup, Admin ) if 
          isObjectInACLGroup ( "user."..getPlayerName(pla), aclGetGroup ( "Staff" ) ) then 
             moveObject (door, 2951, -2080.3999023438, 1409.25, 5) -- here is where you copy the coordinates of the orginal location of the object, 2951 = the timer of movent. 
            else  
            return 0 
            end 
        end 
    end 
end 
  
  
addEventHandler ( "onColShapeLeave", col, Close ) 
addEventHandler ( "Close", root, Close) 
  
  
  
  
  

Edited by Guest
Link to comment

You need to make the objects client side.

After you verify that the player who has hit the colshape is indeed allowed to open the gate you need to trigger a client event.

  
triggerClientEvent ( player, "yourOpenTheGateEvent", player ) 
  

A better way to do it would be to make it fully client sided. For that you could store the player's login info when he logs in/ out client side (by using triggerClientEvent upon onPlayerLogin/onPlayerLogout).

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