If SteamID

Hey i´m trying to create a script so if the players steam id is in the table they can enter the server else they will get kicked. This is what I have:
[lua]
local SteamIDS = {
“Steam ID1”,
“Steam ID2”,
“Steam ID3”
}

function SteamIDS()
for _, v in ipairs( SteamIDS ) do
if ply:SteamID == v then
print(“Hello, Server is down for maintain, so expect a restart or two.”)
else
ply:kick(“Server is down for maintain”)
end
end
end
[/lua]

I havent tested it, but i´m pretty sure it´s wrong :confused: Can anybody help me do this? Thanks

  1. Your not defining ply
  2. Its not being called
  3. Its ply:SteamID() and not ply:SteamID
  4. Its ply:Kick(“blah”) and not ply:kick(“blah”)

[lua]local SteamIDS = {“STEAM_0:0:0”}

local function CheckSID(ply, sid)
if (!table.HasValue(SteamIDS, sid)) then
ply:Kick(“Server is down for maintenance, please check back later.”)
end
end
hook.Add(“PlayerAuthed”, “CheckSID”, CheckSID)[/lua]

A bit like that.

Also in the OP the table and the function have exactly the same name. You can’t have that. A function is like any other variable. Technically when you get to line 7 you overwrite the table with the function.