Skip to content

Commit

Permalink
fix(server/events): prevent player count from going above max players
Browse files Browse the repository at this point in the history
  • Loading branch information
SKITTLE6969 authored Jan 14, 2025
1 parent c4a403a commit 85be28b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ AddEventHandler('playerDropped', function(reason)
local license = GetPlayerIdentifierByType(src, 'license2') or GetPlayerIdentifierByType(src, 'license')
if license then usedLicenses[license] = nil end
if not QBX.Players[src] then return end
GlobalState.PlayerCount -= 1
GlobalState.PlayerCount = GetNumPlayerIndices()
local player = QBX.Players[src]
player.PlayerData.lastLoggedOut = os.time()
logger.log({
Expand Down Expand Up @@ -261,4 +261,4 @@ end)
---@diagnostic disable-next-line: param-type-mismatch
AddStateBagChangeHandler('stress', nil, function(bagName, _, value)
playerStateBagCheck(bagName, 'stress', value)
end)
end)

0 comments on commit 85be28b

Please sign in to comment.