From 79857393ddb42f52ee05cf5758d5fdc8c2ff845c Mon Sep 17 00:00:00 2001 From: rad3sh <30727293+rad3sh@users.noreply.github.com> Date: Sun, 26 May 2024 21:14:23 -0300 Subject: [PATCH] Fixed nil index error and removed invalid characters causing syntax errors (#494) --- [admin]/admin/server/admin_server.lua | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/[admin]/admin/server/admin_server.lua b/[admin]/admin/server/admin_server.lua index a6ef0a967..ea60300b7 100644 --- a/[admin]/admin/server/admin_server.lua +++ b/[admin]/admin/server/admin_server.lua @@ -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 @@ -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 ()