我不熟悉盖瑞模组,但如果你只是需要检查,如果玩家的缺口是在表中,你可以这样做:如果你使用一个稍微不同的表来保存
local Table = { "Player1", "Player2", "Player3" }
hook.Add("PlayerConect", "Connect", function(ply)
local notfound = true
-- iterate through all elements in the table
for index, nick in ipairs(Table) do
if ply:Nick() == nick then
notfound = false
break
end
end
if notfound then ply:Kick("Reason here") end
end)
球员的缺口,那么检查将变得更简单(Table
现在用作hash table):
local Table = { Player1 = true, Player2 = true, Player3 = true }
hook.Add("PlayerConect", "Connect", function(ply)
-- check if the nick is present in the table
if not Table[ply:Nick()] then ply:Kick("Reason here") end
end)
注:昵称可以改变。如果未经授权的用户发现服务器上允许的人的昵称,他们可以将其名称更改为该名称。你应该根据SteamIDs进行白名单。 – 2015-02-24 14:12:07