Ban script not working?

Here is my script:

function BanRDMFag( pl, cmd, args )
if pl.AbleToBan and args and args != “” then
if table.HasValue( AbleToBeBanned, args[1] ) then
RunConsoleCommand( “banid”, 5, args[1] )
if timer.IsTimer( “KeepFromBanningLater” ) then timer.Destroy( “KeepFromBanningLater” ) end
for k, v in pairs( AbleToBeBanned ) do
if v == args[1] then
table.remove( AbleToBeBanned, k )
pl:PrintMessage( HUD_PRINTCONSOLE, “Error, the RDM fag will unfortunately not be banned :(” )
concommand.Add( “_banhim”, BanRDMFag )

Everything is defined, as I am testing it on my dedicated server, but for some reason it just WILL NOT ban the RDMing player.

If you need to know, this is how this function is called on the client:

RunConsoleCommand( “_banhim”, RDMer:UniqueID() )

Like I said, everything is defined and it all works until it gets to the first code I posted, and I get no LUA errors on client OR server side. Is it my RunConsoleCommand Syntax?


The first script is server-side, I forgot to mention.

RunConsoleCommand is not a valid serverside command. What you’re looking for is

Well, was apparently.

Oh? I thought it was shared… Oh well, I’ll try that out.


game.ConsoleCommand did not work either. It does nothing :confused:


Or wait, can I specify args such as game.ConsoleCommand( “banid”, 5, args[1] ) ?

OR should it be game.ConsoleCommand( "banid 5 " … args[1] ) ?

Nothing’s working, and it’s pissing me off. I always have problems with Console Command >:(

UniqueID ~= User ID. You’ll have to use, eg.

[lua]RunConsoleCommand("_banhim", ply:UserID())[/lua]

Oh, and:

lua_run RunConsoleCommand("say", "Hello!")
> RunConsoleCommand("say", "Hello!")...
Console: "Hello!"

game.ConsoleCommand( "banid 5 " … ply:SteamID() … "
" )

God dammit this is pissing me off, it’s still not working; I changed it to this:

Server: (Changed line 4 in first code)
RunConsoleCommand( “banid”, tostring( 5 ), tostring( args[1] ) )

RunConsoleCommand( “_banhim”, RDMer:UserID() )

RunConsoleCommand( “banid”, “5”, args[1] )
RunConsoleCommand( “kickid”, args[1] )

Use game.ConsoleCommand…

Any specific reasons to use that instead of RunConsoleCommand?

I tried game.ConsoleCommand, I tried RunConsoleCommand, NOTHING IS WORKING.

@iRzilla Doesn’t banid also kick the player as well? If so, then the second thing wouldn’t be needed…

Just wondering, what’s wrong with Player:Ban( Integer minutes, String reason ) ?


And I think RunConsoleCommand should work serverside. It’s being used to run kickid and banid from the scoreboard serverside:

:Ban hasn’t worked for me in forever.

What you have to do from what I last remember was.


Because from what I recall it won’t kick them. I sure this is correct.

That is correct. I tried banning myself and it didn’t kick me, but it added me to the banned_user.cfg file.

Okay so it still is that way.

EDIT: I remember looking at ass mod in june and saw ban and kick in a function. So if what I’m thinking is true it should help you with your problem CT.

Use what I wrote it works fine.

Add some prints in.

For what reason? Nowhere in his code is he using “return” or “break” and there are no lua errors. So it’s executing the full code.

The only problem was that he wasn’t kicking the players upon banning them.


> if _G.RunConsoleCommand then Msg ( "Entoros was wrong
" ) else Msg ( "Entoros was right
" ) end...
Entoros was wrong