[Release] enferList (another whitelist script)

there is a way to show the player his id on the error message? otherwise how could i know who should i put in the whitelist?

1 Like

I get couldn’t load resource whitelist.lua in console when I start this.
Edit: I fixed this ages ago, had an extra comma.

Only the dec number works for some people, only the hex number works for some people, both numbers work for some and neither works for very little. Any ideas?

Hello, how do I add several people when adding a steam person?
You can also join all those who are not on the white list
What am I doing wrong ?
for an answer

zb: i have :

“steam:000000000000cd”,
“steam:000000000000df”,
“steam:000000000000lf”,

Make sure there’s [ and ] in the code. See original post on where it should go.

it doesnt work for me it still says you are not whitelisted whatever steam id i take in there

For some reason it doesnt work although I have done it the exact way as you’ve said. Here’s my code, please hmu if you know how to fix it: (Its not working, everyone can join)

Whitelist.json

`[
	"steam:11000010bbd3937", #Craze
	"steam:11000011aeb4519", #Ewan
	"steam:11000010f8c481c", #Logan N
	"steam:11000010ce19ea6", #William
	"steam:11000011c415988", #Harrison
	"steam:1100001130464e1", #Chosen
	"steam:110000113e89d67", #Pallom
	"steam:110000105dfee2c", #Jeepz33n
	"steam:110000112076701", #Avris
	"steam:11000010a618ea3", #RonR
	"steam:110000131d5c2d7"
    "ip:127.0.0.1"     	
]`

Whitelist.lua

--[[
	Simple whitelist script to check if a player's identifier is inside
		a file.
		
	Copyright 2018, Tony Enfer, All rights reserved.
	
	You may modify this resource but NOT, under any circumstances, redistribute it.
]]

-- The whitelist array
local whitelistArray = {}

-- Read the "whitelist.json" file.
local data = LoadResourceFile(GetCurrentResourceName(), GetConvar("enfer.whitelist", "whitelist.json"))

-- If we got data from it, parse it and store it.
if data then
    whitelistArray = json.decode(data)
    print("Loaded " .. #whitelistArray .. " whitelisted identifiers")
end

--[[
	When a player joins, check if they're in the whitelistArray.
	
	If they are, allow them to join. Otherwise don't let them.
]]
AddEventHandler("playerConnecting", function(playerName, setKickReason, deferrals)
    -- Tell the connection to defer until we have done
	deferrals.defer()
	
	-- Just in case "source" gets lost, store it
    local s = source
	
	-- If the player has been allowed to join the server
	local joined = false
	
	-- Tell the user we're checking stuff (not shown for long)
    deferrals.update("Please wait, checking whitelist")
	
	-- Needed, not sure why.
	Wait(100)
	
	-- A bunch of variables for calculating percentage
	local totalInWhitelist = #whitelistArray -- Total no of IDs in the array
	local noIdentifiers = #GetPlayerIdentifiers(s) -- How many Identifiers the player has (usually 2 or 3)
	local currentId = 0 -- The index of the id we're checking
	local totalChecksNeeded = totalInWhitelist * noIdentifiers -- The total number of interations we need (to check the entire array)
	
	-- Loop though the player's identifiers
    for myIdx,identifier in pairs(GetPlayerIdentifiers(s)) do
	
		-- Loop through the whitelist array
        for wIdx,i in ipairs(whitelistArray) do
			
			-- Check if the player exists in the array.
            if(string.lower(i) == string.lower(identifier))then
                deferrals.done() -- They're in it... Let them in!
                joined = true 
				break -- no longer need to loop 
            end
			
			-- Tell user how much we've done
			deferrals.update(string.format("Checking whitelist: %.2f%%", (currentId / totalChecksNeeded)*100))

			Wait(1)
			currentId = currentId +1
        end
    end
	if joined then
		return
	end
	
	-- Tell them to get lost. They're not in the array!
	deferrals.done("You are not whitelisted.")
end)

the #NAME is causing the error. im trying to find a way to mark them but i dont know how to null in json. also with "

“steam:11000010bbd3937”, #Craze
“steam:11000011aeb4519”, #Ewan
“steam:11000010f8c481c”, #Logan N
“steam:11000010ce19ea6”, #William
“steam:11000011c415988”, #Harrison
“steam:1100001130464e1”, #Chosen
“steam:110000113e89d67”, #Pallom
“steam:110000105dfee2c”, #Jeepz33n
“steam:110000112076701”, #Avris
“steam:11000010a618ea3”, #RonR
“steam:110000131d5c2d7”
“ip:127.0.0.1”

"

your missing a comma the only one that doesnt have a comma is the last line.

This is how i have them on mine and works just fine

 “steam:11000010bbd3937”, //Craze
 “steam:11000011aeb4519”, //Ewan
 “steam:11000010f8c481c”, //Logan N
 “steam:11000010ce19ea6”, //William
 “steam:11000011c415988”, //Harrison
 “steam:1100001130464e1”, //Chosen
 “steam:110000113e89d67”, //Pallom
 “steam:110000105dfee2c”, //Jeepz33n
 “steam:110000112076701”, //Avris
 “steam:11000010a618ea3”, //RonR
 “steam:110000131d5c2d7”, //batmaaaannnnnn
 “ip:127.0.0.1”

is there a way for the whitelist screen to show there SteamID to them so they can send it to the server admin?

1 Like

have them go to http://www.vacbanned.com/engine/check and get the hex

image

It works for some of my friends but some keep getting failed to handshake any suggestions?

ok, I find a easier way, forget the last comment :smiley:

what do you mean by ip the server one or your own one

I get this error

Error loading script whitelist.lua in resource whitelist: whitelist.lua:19: attempt to get length of a nil value (local 'whitelistArray')
stack traceback:
        whitelist.lua:19: in main chunk
Failed to load script whitelist.lua.

I have same error

Looks good

I am getting this issue when I start the resource.

Creating script environments for whitelist
Error loading script whitelist.lua in resource whitelist: @whitelist/whitelist.lua:19: attempt to get length of a nil value (local ‘whitelistArray’)
stack traceback:
@whitelist/whitelist.lua:19: in main chunk
Failed to load script whitelist.lua.
Started resource whitelist

I have that error as well, anyone found a solution yet?

Got a solution, I just remove the contents of line 19. That shouldn’t be a problem for the script since it’s just a print statement