Skip to content

Commit

Permalink
Merge pull request #2 from Itz-Hyperz/main
Browse files Browse the repository at this point in the history
I guess just push it and see what happens, I really was just bored lmao
  • Loading branch information
Jordan2139 authored Feb 10, 2021
2 parents c553592 + b252bbf commit 7a2c6e0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
11 changes: 6 additions & 5 deletions config.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-----------------------------------------------------------
-- Guardian- A Simple FiveM Script, Made By Jordan.#2139 --
-----------------------------------------------------------
--------------------------------------------------------------------------------------------
-- Guardian- A Far More Advanced FiveM Script Than DiscordWhitelist, Made By Jordan.#2139 --
--------------------------------------------------------------------------------------------

-------------------------------------------------------
-- CONFIG YOUR PERIPHERALS HERE! --
Expand All @@ -9,12 +9,13 @@ Config = {
DiscordYeet = 'Sorry but this server reqiures you to have Discord (Desktop Edition) to play. Please restart FiveM and Discord if it is already open!', -- Message to client if their discord cannot be found by the script
WhitelistYeet = 'Sorry but this is a whitelisted community if you would like to join please see our website- WEBSITE to apply!', -- Message to client if they are not whitelisted
RoleIdsYeet = 'Sorry but I could not find your role ID\'s please reconnect and if this persists please contact the server developer!',
WhitelistRoles = { -- Roles that you assigned in Badgers API that should pass the whitelist
ServerName = 'New Orleans Roleplay',
WhitelistRoles = { -- Roles that you assigned in Badgers API that should pass the whitelist, ALSO Make sure that **each** role ends with a comma!
"Whitelisted",
"MaybeWhitelisted",
"ScrewItMakeThis",
},
}
--------------------------
-- ^^^ DO THAT HERE ^^^ --
--------------------------
--------------------------
11 changes: 7 additions & 4 deletions server.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-----------------------------------------------------------
-- Guardian- A Simple FiveM Script, Made By Jordan.#2139 --
-----------------------------------------------------------
--------------------------------------------------------------------------------------------
-- Guardian- A Far More Advanced FiveM Script Than DiscordWhitelist, Made By Jordan.#2139 --
--------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------
-- !WARNING! !WARNING! !WARNING! !WARNING! !WARNING! --
Expand Down Expand Up @@ -31,7 +31,7 @@ AddEventHandler("playerConnecting", function(name, setCallback, deferrals)
deferrals.defer()
local src = source
local identifierDiscord = "";
deferrals.update("Checking Whitelist Permissions")
deferrals.update("Checking Whitelist Permissions For " Config.ServerName)

Citizen.Wait(0); -- Necessary Citizen.Wait() before deferrals.done()

Expand All @@ -48,6 +48,7 @@ AddEventHandler("playerConnecting", function(name, setCallback, deferrals)
for j = 1, #roleIDs do
if exports.Badger_Discord_API:CheckEqual(roleList[i], roleIDs[j]) then
print("[Guardian] (playerConnecting) Allowing " .. GetPlayerName(src) .. " to join with the role " .. roleList[i])
print("[Guardian] (playerConnecting) Player " .. GetPlayerName(src) .. " Attempted to connect with Guardian, They were allowed entry")
isWhitelisted = true;
else
if isWhitelisted == false then
Expand All @@ -58,12 +59,14 @@ AddEventHandler("playerConnecting", function(name, setCallback, deferrals)
end
else
print("[Guardian] (playerConnecting) Player " .. GetPlayerName(src) .. " Could not connect because role id\'s were not present")
print("[Guardian] (playerConnecting) Player " .. GetPlayerName(src) .. " Attempted to connect with Guardian, however they failed")
deferrals.done(Config.RoleIdsYeet)
CancelEvent()
return;
end
else
print("[Guardian] (playerConnecting) Declined connection from " .. GetPlayerName(src) .. " because they did not have Discord open")
print("[Guardian] (playerConnecting) Player " .. GetPlayerName(src) .. " Attempted to connect with Guardian, however they failed")
deferrals.done(Config.DiscordYeet)
CancelEvent()
return;
Expand Down
6 changes: 3 additions & 3 deletions version_check.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-----------------------------------------------------------
-- Guardian- A Simple FiveM Script, Made By Jordan.#2139 --
-----------------------------------------------------------
--------------------------------------------------------------------------------------------
-- Guardian- A Far More Advanced FiveM Script Than DiscordWhitelist, Made By Jordan.#2139 --
--------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
-- !WARNING! !WARNING! !WARNING! !WARNING! !WARNING! --
-- DO NOT TOUCH THIS FILE OR YOU /WILL/ FUCK SHIT UP! EDIT THE CONFIG.LUA --
Expand Down

0 comments on commit 7a2c6e0

Please sign in to comment.