Skip to content

Commit

Permalink
fixed an issue that caused EasyAdmin to cease working?
Browse files Browse the repository at this point in the history
  • Loading branch information
Blumlaut committed Sep 14, 2017
1 parent 9cff9ed commit 6df61d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions reserved-slots.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ whitelisted = {
useReservedSlots = true -- do we even want reserved slots?
reservedSlots = 2 -- how many do we want?
maxSlots = GetConvarInt("sv_maxclients") -- no touchy
maxSlots = tonumber(maxSlots)
SetConvar("sv_maxclients", maxSlots-reservedSlots) -- no touchy either

------- SETTINGS STOP -------
Expand All @@ -23,7 +24,7 @@ AddEventHandler('playerConnecting', function(playerName, setKickReason)

for i,user in ipairs(whitelisted) do
for i,theId in ipairs(numIds) do
if user == theId and #GetPlayers() < maxSlots then
if user == theId and tonumber(#GetPlayers()) < maxSlots then
kickme = false
SetConvar("sv_maxclients", GetConvar("sv_maxclients")+1)
end
Expand All @@ -32,14 +33,14 @@ AddEventHandler('playerConnecting', function(playerName, setKickReason)

for i,admin in ipairs(admins) do
for i,theId in ipairs(numIds) do
if admin == theId and #GetPlayers() < maxSlots then -- is the player an admin and do we have free slots?
if admin == theId and tonumber(#GetPlayers()) < maxSlots then -- is the player an admin and do we have free slots?
kickme = false
SetConvar("sv_maxclients", GetConvar("sv_maxclients")+1)
end
end
end

if kickme and #GetPlayers() >= 30 then
if kickme and tonumber(#GetPlayers()) >= 30 then
setKickReason('This server is full (past ' .. tostring(GetConvar("sv_maxclients")) .. ' players).')
print("Connection Refused, Slot Reserved/Server Full!\n")
CancelEvent()
Expand All @@ -49,7 +50,7 @@ end)


AddEventHandler('playerDropped', function()
if #GetPlayers() > 30 and GetConvarInt("sv_maxclients") >= 31 then
if tonumber(#GetPlayers()) > 30 and GetConvarInt("sv_maxclients") >= 31 then
SetConvar("sv_maxclients", GetConvar("sv_maxclients")-1)
end
end)
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2
3.3

0 comments on commit 6df61d8

Please sign in to comment.