Skip to content

Commit

Permalink
Fixed nil index error and removed invalid characters causing syntax e…
Browse files Browse the repository at this point in the history
…rrors (#494)
  • Loading branch information
rad3sh authored May 27, 2024
1 parent eb14427 commit 7985739
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions [admin]/admin/server/admin_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,10 @@ addEventHandler ( "onResourceStart", root, function ( resource )
aLogMessages[type] = {}
local groups = 0
while ( xmlFindChild ( subnode, "group", groups ) ) do
aLogMessages[type][action] = {}
local group = xmlFindChild ( subnode, "group", groups )
local action = xmlNodeGetAttribute ( group, "action" )
local r, g, b = tonumber ( xmlNodeGetAttribute ( group, "r" ) ), tonumber ( xmlNodeGetAttribute ( group, "g" ) ), tonumber ( xmlNodeGetAttribute ( group, "b" ) )
aLogMessages[type][action] = {}
aLogMessages[type][action]["r"], aLogMessages[type][action]["g"], aLogMessages[type][action]["b"] = r or 0, g or 255, b or 255
if ( xmlFindChild ( group, "all", 0 ) ) then aLogMessages[type][action]["all"] = xmlNodeGetValue ( xmlFindChild ( group, "all", 0 ) ) end
if ( xmlFindChild ( group, "admin", 0 ) ) then aLogMessages[type][action]["admin"] = xmlNodeGetValue ( xmlFindChild ( group, "admin", 0 ) ) end
Expand Down Expand Up @@ -446,22 +446,22 @@ end

local serialExp = "^" .. string.rep("[A-F0-9]", 32) .. "$"
function isValidSerial(serial)
    return serial:match(serialExp)
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] = {}
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 7985739

Please sign in to comment.