Server open only for specific rank

I’m looking for LUA script, which would make server open for only people above for specific rank.
Same kind of script that Highspeedgaming is using.

For example my server would have 3 different ranks/levels, which would be:

  • New member
  • Member
  • Senior Member

If I don’t want to let new members join to server, I can put chat command, that would make server open for members and senior members

you can maybe do this by checking the current rank in your database and matching it with a list when a user is connecting

just a example you can do a simple if then statement to check the ranks like below

if rank == 1 then -- allow new member
    -- connection code here
 elseif rank == 2 then -- allow member
    -- connection code here
 elseif rank == 3 then -- allow senior member
    -- connection code here
 else
   -- dont allow this person to connect no rank
end