Skip to content

Commit

Permalink
fix(server/player): prevent login while already logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
solareon committed Dec 1, 2024
1 parent 8e06398 commit f5d6f05
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion server/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ function Login(source, citizenid, newData)
return false
end

if QBX.Players[source] then
DropPlayer(tostring(source), locale('info.exploit_dropped'))
logger.log({
source = GetInvokingResource() or cache.resource,
webhook = config.logging.webhook.anticheat,
event = 'Anti-Cheat',
color = 'white',
tags = config.logging.role,
message = ('%s [%s] Dropped for attempting to login twice'):format(GetPlayerName(tostring(source)), tostring(source))
})
return false
end

local license = GetPlayerIdentifierByType(source --[[@as string]], 'license2') or GetPlayerIdentifierByType(source --[[@as string]], 'license')
local userId = storage.fetchUserByIdentifier(license)

Expand All @@ -35,7 +48,7 @@ function Login(source, citizenid, newData)
else
DropPlayer(tostring(source), locale('info.exploit_dropped'))
logger.log({
source = 'qbx_core',
source = GetInvokingResource() or cache.resource,
webhook = config.logging.webhook.anticheat,
event = 'Anti-Cheat',
color = 'white',
Expand Down

0 comments on commit f5d6f05

Please sign in to comment.