move bans to onPlayerAuth

This commit is contained in:
Lion Kortlepel 2024-01-25 11:02:16 +01:00 committed by Starystars67
parent a271438aca
commit 1fc2389ba1

View File

@ -258,35 +258,21 @@ function onChatMessage(id, name, message)
end end
end end
function onPlayerAuth(name, role, isGuest) function onPlayerAuth(name, _, isGuest, identifiers)
if isGuest and not allowGuests then if isGuest and not allowGuests then
return "You must be signed in to join this server!" return "You must be signed in to join this server!"
end end
local id = identifiers.beammp
--local ids = MP.GetPlayerIdentifiers(playerID) for _, player in pairs(bans) do
if id == player then
if not isGuest and role == "STAFF" then print('Connecting Player "'..name..'" is banned from the server.')
return "You are banned from this server."
--table.insert(admins,
end end
if not isGuest and role == "MDEV" then
end end
end end
function onPlayerConnecting(id) function onPlayerConnecting(id)
print('Player '..MP.GetPlayerName(id)..' ('..id..') connecting.') print('Player '..MP.GetPlayerName(id)..' ('..id..') connecting.')
local identifiers = MP.GetPlayerIdentifiers(id)
for TYPE, ID in pairs(identifiers) do
--print(TYPE, ID)
for _, player in pairs(bans) do
if ID == player then
print('Connecting Player "'..MP.GetPlayerName(id)..'" is banned from the server.')
MP.DropPlayer(id, 'You are banned from the server.')
return 1
end
end
end
end end
MP.RegisterEvent("onPlayerAuth","onPlayerAuth") MP.RegisterEvent("onPlayerAuth","onPlayerAuth")