Hiya!
So i'm making a player console logger(Logs everything a player writes in their console) as a part of my anti-cheat. So far it works great and it sends every command to the staff for review. But there is one issue. It logs basicly everything, From +menu, -menu, +menu_context, -menu_context etc.. You get the idea. I only want to send the commands that the client created with an external script(lua hacks etc).
So upon join i want the player to get all avaible commands that the server already has for the client to whitelist them once.
In this example, cmd = what the player typed in the console.
whitelistedcommands = all the commands that the server/addons provides.
Example:
if cmd ~= whitelistedcommands then
--send the cmd to the staff for review
end
I know that concommand.GetTable() is gonna be used for this but i'm still having a hard time understanding how to read the tables and make it into one variable "whitelistedcommands".
I think "in pairs" and that is gonna be used but it just confuses me so much.
I made a attempt on this but without any success so i gave up.
table.HasValue - example #2 is what you are looking for.
https://pastebin.com/znt3JaWu
Thankies for taking your time to help me.
I'm sorry if i sound stupid or so but i tried the code you provided me with and it outputs this error:
[ERROR] addons/wdac/lua/wdac/client/0002_cmd.lua:9: attempt to index global'whitelistedCommands' (a nil value)
1. unknown - addons/wdac/lua/wdac/client/0002_cmd.lua:9
Do i have to initialize the table variable whitelistedCommands by doing
local whitelistedCommands = {}
or what am i doing wrong?
Also:
whitelistedCommands[command]
The "[command]" is my cmd output right?
I checked the wiki of this but im having a hard time understanding how im supose to put it all together.
whitelistedCommands is a table i assume? If you put a table in a if statement just by giving the table name, it will return nil since you didnt tell it what position in the table to check.
lets say your tabld contains 3 things
if you want it to check for the second thing you eed to put in the if statement
whitelistedcommands [2]
the [2] tells it to check eith the second thing in the table. And if you want to check the WHOLE table, no mattet how many things are inside there, a
for k,v in pairs (whitelistedcommands) do
if v ~= v then
--code
end
end
I cant get this to work no matter what it feels like. The only thing im struggling with is to get the numbers of the table like this:
1
2
3
4 etc.
can you show me the code that makes you trouble?
Okay so i manage to get it to work and i found that the only issue left is that
concommand.GetTable()
Updates when a new concommand is added. Is there a way to stop this and only use the commands avaible when the player spawn in the server?
One solution i have right now is when the player spawns in it will net.send the concommand.GetTable() to the server and make the server reply back with just the raw table so the client can use that. But i have no idea how bypassable this is. Maybe there is another way?
Sorry, you need to Log In to post a reply to this thread.