-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.lua
More file actions
59 lines (49 loc) · 1.78 KB
/
server.lua
File metadata and controls
59 lines (49 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--[[
VineList Discord Whitelist
- Developed by Hebi
]]--
WList = Config.WhitelistRoles -- Declaring whitelist roles
BList = Config.BlacklistRoles -- Declaring banlist roles
AddEventHandler("playerConnecting", function(name, setCallback, deferrals)
deferrals.defer() -- Starting the script when the player presses connect
local src = source
local whitelisted = false
local banned = false
local roleIDs = exports.Badger_Discord_API:GetDiscordRoles(src)
deferrals.update("Checking your status on " .. Config.Name) -- Displaying that the check is running
Wait(2)
-- using for loop check for whitelisted roles
for i=1, #WList do
for j=1, #roleIDs do
if exports.Badger_Discord_API:CheckEqual(WList[i], roleIDs[j]) then
print("[VineList] " .. GetPlayerName(src) .. " Whitelisted with role " .. WList[i]) -- Console Entry
whitelisted = true
end
end
end
-- Whitelist Guard
if not whitelisted then
print("[VineList] " .. GetPlayerName(src) .. " is not whitelisted.")
deferrals.done("You are not whitelisted")
CancelEvent() -- Stopping connection to the server
return
end
-- Ban Role Loop Check
for i=1, #BList do
for j=1, #roleIDs do
if exports.Badger_Discord_API:CheckEqual(BList[i], roleIDs[j]) then
print("[VineList] " .. GetPlayerName(src) .. " Ban check starting.")
banned = true
end
end
end
-- Ban Guard
if banned then
print("[VineList] " .. GetPlayerName(src) .. " Failed Ban Check.")
deferrals.done("You are banned, Check Discord")
CancelEvent()
return
end
-- Allowing Connection to the server
deferrals.done()
end)