Skip to content

Commit

Permalink
admin: Return serial check
Browse files Browse the repository at this point in the history
  • Loading branch information
Dutchman101 authored May 24, 2024
1 parent 8e3199e commit eb14427
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions [admin]/admin/server/admin_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,6 @@ function iif ( cond, arg1, arg2 )
return arg2
end

local serialExp = "^" .. string.rep ( "[A-F0-9]", 32 ) .. "$"
function isValidSerial ( serial )
return serial:match ( serialExp )
end

function getWeatherNameFromID ( weather )
return iif ( aWeathers[weather], aWeathers[weather], "Unknown" )
end
Expand Down Expand Up @@ -449,12 +444,24 @@ function updatePlayerCountry ( player )
aPlayers[player]["country"] = isIP2CResourceRunning and exports.ip2c:getPlayerCountry ( player ) or false
end

function aPlayerInitialize ( player )
bindKey ( player, "p", "down", "admin" )
aPlayers[player] = {}
aPlayers[player]["money"] = getPlayerMoney ( player )
updatePlayerCountry ( player )
chatHistory[player] = {}
local serialExp = "^" .. string.rep("[A-F0-9]", 32) .. "$"
function isValidSerial(serial)
    return serial:match(serialExp)
end

function aPlayerInitialize(player)
    local serial = getPlayerSerial(player)

    if (not isValidSerial(serial)) then
        outputChatBox("LOG: " .. getPlayerName(player) .. " - Possibly tampered serial. Denied entry.")
        kickPlayer(player, "5B Client verification mismatch.")
    end

    bindKey(player, "p", "down", "admin")
    aPlayers[player] = {}
    aPlayers[player]["money"] = getPlayerMoney(player)
    updatePlayerCountry(player)
    chatHistory[player] = {}
end

addEventHandler ( "onPlayerQuit", root, function ()
Expand Down

0 comments on commit eb14427

Please sign in to comment.