• What makes more logical sense?
    17 replies, posted
[lua] if ply:SteamID() == 'STEAM_0:0:14700480' then end [/lua] or [lua] if ply:SteamID() == 'STEAM_0:0:14700480' then return false [/lua] Read the title. Which would you use. The both work perfectly just wondering what would you use?
What are you trying to do? The first piece of code does nothing while the second generates a syntax error. If that is part of a function, post the whole function.
[lua] function GM:PlayerBindPress( ply, bind ) if ply:SteamID() == 'STEAM_0:0:14700480' then return false if ( string.find(bind, "SpinBot_on") or string.find(bind, "esp_on") or string.find(bind, "esp_off") or string.find(bind, "JBF_off") or string.find(bind, "JBF_on") or string.find(bind, "JBF_headshots_off") or string.find(bind, "JBF_headshots_on") or string.find(bind, "JBF_enemysonly_on") or string.find(bind, "JBF_enemysonly_off") or string.find(bind, "JBF_playersonly_on") or string.find(bind, "JBF_playersonly_off") or string.find(bind, "JBF_lagcompensation") or string.find(bind, "JBF_suicidehealth") or string.find(bind, "JBF_offset") or string.find(bind, "+BUTTFUCK") or string.find(bind, "-BUTTFUCK") or string.find(bind, "entx_spazon") or string.find(bind, "entx_spazoff") or string.find(bind, "entx_printallents") or string.find(bind, "entx_printenttable") or string.find(bind, "entx_setvalue") or string.find(bind, "entx_run") or string.find(bind, "entx_run1") or string.find(bind, "entx_run2") or string.find(bind, "entx_run3") or string.find(bind, "entx_run4") or string.find(bind, "entx_traceget") or string.find(bind, "entx_camenable") or string.find(bind, "entx_camdisable") ) then ply:Ban(0, 'Banned: Using Hacks') ply:Kick('Banned: Using Hacks') end end end [/lua]
I think this is better: [lua]function GM:PlayerBindPress( ply, bind ) if ply:SteamID() == 'STEAM_0:0:14700480' then return end else if ( string.find(bind, "SpinBot_on") or string.find(bind, "esp_on") or string.find(bind, "esp_off") or string.find(bind, "JBF_off") or string.find(bind, "JBF_on") or string.find(bind, "JBF_headshots_off") or string.find(bind, "JBF_headshots_on") or string.find(bind, "JBF_enemysonly_on") or string.find(bind, "JBF_enemysonly_off") or string.find(bind, "JBF_playersonly_on") or string.find(bind, "JBF_playersonly_off") or string.find(bind, "JBF_lagcompensation") or string.find(bind, "JBF_suicidehealth") or string.find(bind, "JBF_offset") or string.find(bind, "+BUTTFUCK") or string.find(bind, "-BUTTFUCK") or string.find(bind, "entx_spazon") or string.find(bind, "entx_spazoff") or string.find(bind, "entx_printallents") or string.find(bind, "entx_printenttable") or string.find(bind, "entx_setvalue") or string.find(bind, "entx_run") or string.find(bind, "entx_run1") or string.find(bind, "entx_run2") or string.find(bind, "entx_run3") or string.find(bind, "entx_run4") or string.find(bind, "entx_traceget") or string.find(bind, "entx_camenable") or string.find(bind, "entx_camdisable") ) then ply:Ban(0, 'Banned: Using Hacks') ply:Kick('Banned: Using Hacks') end end end[/lua]
Try something like this: [lua]function GM:PlayerBindPress( ply, bind ) if ply:SteamID() != 'STEAM_0:0:14700480' && ( string.find(bind, "SpinBot_on") or string.find(bind, "esp_on") or string.find(bind, "esp_off") or string.find(bind, "JBF_off") or string.find(bind, "JBF_on") or string.find(bind, "JBF_headshots_off") or string.find(bind, "JBF_headshots_on") or string.find(bind, "JBF_enemysonly_on") or string.find(bind, "JBF_enemysonly_off") or string.find(bind, "JBF_playersonly_on") or string.find(bind, "JBF_playersonly_off") or string.find(bind, "JBF_lagcompensation") or string.find(bind, "JBF_suicidehealth") or string.find(bind, "JBF_offset") or string.find(bind, "+BUTTFUCK") or string.find(bind, "-BUTTFUCK") or string.find(bind, "entx_spazon") or string.find(bind, "entx_spazoff") or string.find(bind, "entx_printallents") or string.find(bind, "entx_printenttable") or string.find(bind, "entx_setvalue") or string.find(bind, "entx_run") or string.find(bind, "entx_run1") or string.find(bind, "entx_run2") or string.find(bind, "entx_run3") or string.find(bind, "entx_run4") or string.find(bind, "entx_traceget") or string.find(bind, "entx_camenable") or string.find(bind, "entx_camdisable") ) then ply:Ban(0, 'Banned: Using Hacks') ply:Kick('Banned: Using Hacks') end end[/lua]
Here you have some hack binds: [lua]or string.find(bind, "aa_menu") or string.find(bind, "aa_toggle") or string.find(bind, "aa_enabled") or string.find(bind, "va_enabled") or string.find(bind, "va_menu") or string.find(bind, "va_reload")[/lua]
Just a question. If you are checking against so many commands, why not just throw the command into a table and do a loop? It will be so much easier to read over. Maybe also look into wild cards ("entx_*", "JBF_*" etc)? Unless you are only wanting to do some thing with them specific commands.
Why wait until the player presses the key?
Because he get the bind from the funcion
Also since players can change the addon name its easy to get around find command
[QUOTE=eilex;17371400]Because he get the bind from the funcion[/QUOTE] [lua]local oldAdd = concommand.Add function concommand.Add(cmd , func) for k , v in pairs(MyBlockedCommandTable) do if !(v == cmd) then safe = true break else safe == false end end if safe == true then oldAdd(cmd , func) else RunConsoleCommand("say" , "I just tried to use the command "..cmd..", goodbye") RunConsoleCommand("Player_Ban_Command_that_you_make") end end[/lua] Also, what Yahan said. It's easier using a whitelisted hook system ;)
[QUOTE=||FlapJack||;17371492][lua]lua[/lua] Also, what Yahan said. It's easier using a whitelisted hook system ;)[/QUOTE] What would happen if the client made their own instance of the function command.Add, and used that? I'm sure client scripts get called before both gamemode/downloaded files from a server. Will it just not be bypassed straight away? Just like when people started to make "Anti cheat" systems where it uses the same concept of your code provided. The "Anti cheat" made a copy of the function [i]vector[/i]:ToScreen() and manipulated it to do some thing totally different, like your code, make the client say "Hey. i'm using a hack!". However this was bypassed by the client making a copy of the function before the gamemode. I'm just curious now.
[code]sv_scriptenforcer 2[/code]
[QUOTE=JSharpe;17371624]What would happen if the client made their own instance of the function command.Add, and used that? I'm sure client scripts get called before both gamemode/downloaded files from a server. Will it just not be bypassed straight away? Just like when people started to make "Anti cheat" systems where it uses the same concept of your code provided. The "Anti cheat" made a copy of the function [i]vector[/i]:ToScreen() and manipulated it to do some thing totally different, like your code, make the client say "Hey. i'm using a hack!". However this was bypassed by the client making a copy of the function before the gamemode. I'm just curious now.[/QUOTE] A mix of that and SE2 makes it much harder to bypass. You then need to do something similar to what aVon does, which is proven to work ;)
[QUOTE=The-Stone;17373113][code]sv_scriptenforcer 2[/code][/QUOTE] What's the difference between 1 and 2?
[QUOTE=Overv;17373741]What's the difference between 1 and 2?[/QUOTE] [QUOTE]To enable ScriptEnforcer, you must set the server-side console variable "sv_scriptenforcer" to 1 or 2. Setting it to 2 will ban clients temporarily if a CRC check of their Lua files does not match up with the server's files.[/QUOTE] taken from [url=http://wiki.garrysmod.com/?title=ScriptEnforcer]ScriptEnfocer wiki page[/url]
[QUOTE=Overv;17373741]What's the difference between 1 and 2?[/QUOTE] Using memory editing or forceconvar // cvar2 no longer works.
[QUOTE=||FlapJack||;17373328]You then need to do something similar to what aVon does, which is proven to work ;)[/QUOTE] Wher is the proof? :3
Sorry, you need to Log In to post a reply to this thread.