• creating an admin-reports counter
    1 replies, posted
I'll be honest, I found this system online. I know some basic lua, but not enough to know what to do in this situation. What I need to create is a "counter" for how many reports that a staff member has completed. For instance, this is a snippet of what happens when the user clicks "finish report": if s == "finish" then local i = net.ReadInt(32) vReports[i] = nil for k,v in pairs(player.GetAll()) do if AdminsR[v:GetUserGroup()] then net.Start("vAUpdate") net.WriteTable(vReports) net.Send(v) end end end (This is server-side) I know that I would have to create a table for the SteamIDs of each staff member in a separate script, and then relay which player is clicking the finish button in the first place (I have the identifier named ply) but how would i force it to store that data in the first place? And yes, I've searched for stuff that would answer my question, but I haven't been around lua enough to know exactly what to look for and I'd rather not spend an hour or two combing through the lua database for gmod.
well fuck me, i think i did exactly what i said i didn't want to do and made a damn file system. for anyone else interested in doing something like this here's the tutorial i followed: File Based Storage and here's the link to the reports system I'm using. its basic, but pretty reliable i think: https://garrysmods.org/download/60238/cg-report-system-v01 The addition I made to make the tutorial work for the reports system is this: First, navigate to lua/autorun/server and make a new .lua file (I named mine report_amount_sv.lua) Then, use the tutorials' code in there. Make sure you customize your variables to do what you want. After that, open up report_sv.lua and at the bottom edit this: if s == "finish" then local i = net.ReadInt(32) vReports[i] = nil for k,v in pairs(player.GetAll()) do if AdminsR[v:GetUserGroup()] then net.Start("vAUpdate") net.WriteTable(vReports) net.Send(v) end end end and make it look like this: if s == "finish" then local i = net.ReadInt(32) vReports[i] = nil for k,v in pairs(player.GetAll()) do if AdminsR[v:GetUserGroup()] then net.Start("vAUpdate") net.WriteTable(vReports) net.Send(v) ply.reports = ply.reports + 1 end end end reports is the variable name I used. Make sure to change that to what you have. Damn, I hate answering myself.
Sorry, you need to Log In to post a reply to this thread.