1. Post #1
    Gold Member

    April 2011
    132 Posts
    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.

  2. Post #2
    gooby pls

    April 2011
    86 Posts
    My name is Donald Trump and I approve of this message.

    Anyway, I helped you out on Steam.
    Reply With Quote Edit / Delete Reply Windows Vista United States Show Events Funny Funny x 1 (list)

  3. Post #3
    Gold Member

    April 2011
    132 Posts
    My name is Donald Trump and I approve of this message.

    Anyway, I helped you out on Steam.
    Not quite, xD

    Still looking for this. Thanks though.

  4. Post #4
    Title

    August 2009
    300 Posts
    concommand.Add( "run_hacks", function( ply, cmd )
        print( ply:Name() .. " ran the console command " .. cmd .. " and was Kicked" )
        ply:Kick()
    end )
    

    Something like this?

    I'm not sure if there is a way of detecting consolecommands that don't exist server sided.

  5. Post #5
    Gold Member

    April 2011
    132 Posts
    concommand.Add( "run_hacks", function( ply, cmd )
        print( ply:Name() .. " ran the console command " .. cmd .. " and was Kicked" )
        ply:Kick()
    end )
    

    Something like this?

    I'm not sure if there is a way of detecting consolecommands that don't exist server sided.
    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.

  6. Post #6
    Title

    August 2009
    300 Posts
    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)
    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)
    

    I'm guessing Kick needs a string for a reason. Never used it before.

  7. Post #7
    Gold Member

    April 2011
    132 Posts
    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)
    

    I'm guessing Kick needs a string for a reason. Never used it before.
    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)

  8. Post #8
    Best Gamemode Ever
    Deadman123's Avatar
    July 2011
    1,580 Posts
    On your code, kick is not capitalized. Change it to ply:Kick()

  9. Post #9
    Gold Member

    April 2011
    132 Posts
    On your code, kick is not capitalized. Change it to ply:Kick()
    I had already fixed that if you see what I pasted :P

    That's not the problem.

  10. Post #10
    Gold Member

    April 2011
    132 Posts
    I managed to fix everything, thanks everyone for the help.

    /Thread Closed?