[REQUEST] Gate Opener and Closer in LUA

I need a script that is able to open and close gates. I want to get the closest GetClosestObjectOfType(gates) and be able to open and close the one I am closest to, @TimothyDexter made a script like this but it is written in CS and I need one in LUA also their script requires me to find every gate manually and write information such as coords and heading. I was wondering if it is possible to just find the nearest gate and trigger an event to open or close the gate. Maybe it’s possible with: DoorSystemSetDoorState

TimothyDexter’s Gate Manager [CS] Script on Github

Example of what I want

Thanks, Vatoka!