xRGamingx Posted November 14, 2016 Share Posted November 14, 2016 Hello friend how to solve this error? local risk = Account("risk").player ---- Line 61 error debugscript 3 if (risk) then local logs = db:query("SELECT * FROM logging"):poll(-1) local send = {} for i, log in ipairs(logs) do if (i >= #logs - 50) then table.insert(send, log) end end triggerClientEvent(risk, "logsView", resourceRoot, send) end stdLogged = stdLogged + 1 return true end [GTA]\GTlogging\logging.slua:61: attempt to index a boolean value -----debugscript 3 Link to comment
shaio Posted November 14, 2016 Share Posted November 14, 2016 is Account() a defined function? Link to comment
xRGamingx Posted November 14, 2016 Author Share Posted November 14, 2016 33 minutes ago, shaio said: is Account() a defined function? ------------------------------------------------------------------- local stdLogged = 0 local db = exports.UCDsql:getConnection() --[[ function adminLog() end function stdLog(plr, type1, action, type2) if (not plr) or (not type1) or (not action) then return nil end if (plr:getType() ~= "player") or (type(type1) ~= "string") or (type(action) ~= "string") then return false end if (not type2) then type2 = "N/A" end end --]] function adminLog(admin, log_) local t = getRealTime().timestamp db:exec("INSERT INTO `adminlog` (`name`, `log_`, `datum`) VALUES (?, ?, ?)", admin, log_, t ) end function new(plr, type1, action, type2) if (not plr or not type1 or not action) then return nil end if (type(type1) ~= "string" or type(action) ~= "string") then return false end if (not type2) then type2 = "N/A" end local name local accname local serial if (isElement(plr) and plr.type == "player") then name = plr.name accname = plr.account.name serial = plr.serial else name = tostring(plr) accname = "N/A" serial = "N/A" end db:exec("INSERT INTO `logging` SET `name`=?, `acc`=?, `type`=?, `type2`=?, `tick`=?, `action`=?, `serial`=?", name, accname, type1, type2, getRealTime().timestamp, action, serial ) local risk = Account("risk").player ------Line error debugscript 3 if (risk) then local logs = db:query("SELECT * FROM logging"):poll(-1) local send = {} for i, log in ipairs(logs) do if (i >= #logs - 50) then table.insert(send, log) end end triggerClientEvent(risk, "logsView", resourceRoot, send) end stdLogged = stdLogged + 1 return true end function outputTotal(reset) if stdLogged ~= 0 then outputDebugString("[GTAlogging] Total standard logs inserted in the past 5 minutes: "..stdLogged) end if (reset) then stdLogged = 0 end end setTimer(outputTotal, 60000 * 5, 0, true) addCommandHandler("logged", outputTotal) ------------------- -- Some stuff we need to log ------------------- function logConnections() -- The account will be guest, so we don't need to worry about the query not being successful new(source, "join", "Joined server", source.ip) end addEventHandler("onPlayerJoin", root, logConnections) function logDisconnections(quitType) new(source, "quit", "Disconnected from server ["..quitType.."]", source.ip) end addEventHandler("onPlayerQuit", root, logDisconnections) Look script complet broth Link to comment
shaio Posted November 14, 2016 Share Posted November 14, 2016 Account("risk").player doesn't exist. So you cannot call it. You need something like this. function Account() end Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now