Automatic Gates

Tired of those pesky swinging gates that always seem to scratch up your beautiful car when all you want to do is get home?

With this script, you can say goodbye to gate frustrations! Now, gates can automatically open for you, and you can even restrict access to specific players based on their Citizen ID. Want it open for everyone? No problem – there’s an option to make it a public gate too.

Example Config:

Config = {}

Config.Framework = "qb-core" -- Options include: qb-core, esx, or standalone
Config.HousingScript = "none" -- Options include: loaf-housing, qb-houses, qs-housing, or none for no housing integration
Config.AdminAcePermission = "gate.admin"  -- e.g., add_principal identifier.license:xxxxxxx gate.admin (This value only works when you have the framework set as "standalone")

Config.Gates = {
    [1] = {
        modelLeft = "prop_lrggate_01c_l",              -- Left gate model
        modelRight = "prop_lrggate_01c_r",             -- Right gate model
        coordsLeft = vector3(-1799.7, 471.7, 133.3),   -- Coordinates for left gate
        coordsRight = vector3(-1801.1, 474.3, 133.5),  -- Coordinates for right gate
        openingDistance = 7.0,                         -- Distance at which the gate will open
        allowedIdentifiers = { 
            "CID1234",                                 -- QBCore CitizenID
            "steam:11000010abcdef12", 
            "license:1234567890abcdef1234567890abcdef1234", 
            "discord:123456789012345678" 
        },
        propertyID = "house1",                         -- Property ID associated with the gate. This can be found in the SQL Database for the respective house. (Value is not used if Housing Script is set to "none")
        restricted = true,                             -- Only opens for authorized users, set to false to allow for public gate access, will open for anyone.
        originalHeadingLeft = 118.92,                  -- Original heading for the left gate
        originalHeadingRight = 119.08,                 -- Original heading for the right gate
        rotationAngleLeft = 75.0,                      -- Rotation amount for the left gate
        rotationAngleRight = 93.0                      -- Rotation amount for the right gate
    },

}

Preview:

Without Open Permissions

without-perms

With Open Permissions

with-perms

Get it here! ($10.00)

Code is accessible No
Subscription-based No
Lines (approximately) 700
Requirements ESX, QBCore or Standalone
Support Yes
6 Likes

Only QBCore? Will you do it for ESX at some point?

1 Like

yikes

1 Like

Possibly, yes.

Are there Planes to get it worked with QS-Housing?

How so? As in the ability to have it locked with the house owner and be public until its owned or? I wouldn’t have an issue with the idea. I just would like to implement it right :slight_smile:

Yes, that’s right, and it also has to work in the event of a break-in/raid (police).
Here is the documentation for you

Update 1.1.0

Changed Files:

  • client/client.lua
  • server/server.lua
  • config.lua

Updated:

  • Added the ability to use it with ESX and also be Standalone
  • Added the ability to use it with Loaf Housing, qs-housing, and lastly qb-houses
  • Admins on the server are now able to open the gates no matter what.
  • Fixed an issue where the gates would open for some when rammed into.
  • Updated the config.lua to be a bit better when it comes to identifying gates on the server side and added them into tables.

If you find any issues, please let me know :slight_smile:

p.s I am not too familiar with ESX or qs-housing. If you find any issues with these, I’ll try to publish a fix asap on it.

I think I’ve got it set properly, I don’t know exactly however if it is as I am unable to test it as I don’t own quasars housing creator script, but if you find any issues with it I can try to get it fixed up and running for you.

Pushed a small little update to it.

Fixed a validation issue where the gate would open for the intial “allowedIdentifier” but for none other.
The gates now should stay open and I removed a “Cooldown” timer, validation is done on the server side and is synced between players appropriately now.

Hey, I’m having some trouble with the gates opening for me. I joined the discord but i dont see any channel for support