• Lua Script that Kicks on certain commands
    9 replies, posted
  • I am requesting a script that will kick a user if they enter certain commands into the console: For example, if I went into a server running this scrpt and they had blocked a command "run_hacks", If I went to the console and typed in "run_hacks" irt would kick the user saying "'NAME', ran banned command 'command'". Just looking for this because it is a simple basic anti-cheat, I also want to stop from people running certain commands.
  • My name is Donald Trump and I approve of this message. Anyway, I helped you out on Steam.
  • [QUOTE=pixmah;34814140]My name is Donald Trump and I approve of this message. Anyway, I helped you out on Steam.[/QUOTE] Not quite, xD Still looking for this. Thanks though.
  • [lua] concommand.Add( "run_hacks", function( ply, cmd ) print( ply:Name() .. " ran the console command " .. cmd .. " and was Kicked" ) ply:Kick() end ) [/lua] Something like this? I'm not sure if there is a way of detecting consolecommands that don't exist server sided.
  • [QUOTE=Mrkrabz;34816835][lua] concommand.Add( "run_hacks", function( ply, cmd ) print( ply:Name() .. " ran the console command " .. cmd .. " and was Kicked" ) ply:Kick() end ) [/lua] Something like this? I'm not sure if there is a way of detecting consolecommands that don't exist server sided.[/QUOTE] That seems about right. So basically this will create the command for the server too, and if someone tried typing it they would be kicked? Just tested it and, it didn't work very well: ] run_hacks HawkMan ran the console command run_hacks and was Kicked [lua\autorun\client\anticheat.lua:3] attempt to call method 'Kick' (a nil value) Edit: I managed to make a basic logger that uses the "PlayerBindPress" hook to log blacklisted binds. I do not know of a hook that could be used to log console commands. Now I just need to fix that Kick problem and try find a way to log commands entered in console.
  • [QUOTE=kbhawkman;34818931]That seems about right. So basically this will create the command for the server too, and if someone tried typing it they would be kicked? Just tested it and, it didn't work very well: ] run_hacks HawkMan ran the console command run_hacks and was Kicked [lua\autorun\client\anticheat.lua:3] attempt to call method 'Kick' (a nil value)[/QUOTE] [lua] function runhacks(ply,cmd) print( ply:Name() .. " ran the console command " .. cmd .. " and was Kicked" ) ply:kick("Hacks not allowed") end concommand.Add("run_hacks",runhacks) [/lua] I'm guessing Kick needs a string for a reason. Never used it before.
  • [QUOTE=Mrkrabz;34819394][lua] function runhacks(ply,cmd) print( ply:Name() .. " ran the console command " .. cmd .. " and was Kicked" ) ply:kick("Hacks not allowed") end concommand.Add("run_hacks",runhacks) [/lua] I'm guessing Kick needs a string for a reason. Never used it before.[/QUOTE] Same problem: function runhacks(ply,cmd) print( ply:Name() .. " ran the console command " .. cmd .. " and was Kicked" ) ply:Kick("Hacks not allowed") end concommand.Add("run_hacks",runhacks) ] run_hacks HawkMan ran the console command run_hacks and was Kicked [lua\autorun\client\anticheat.lua:10] attempt to call method 'Kick' (a nil value)
  • [QUOTE=Deadman123;34820588]On your code, kick is not capitalized. Change it to ply:Kick()[/QUOTE] I had already fixed that if you see what I pasted :P That's not the problem.