0

I've got a Server and want to add tabs to the menu I've put in the command

local force = actions:AddOption( "Kick Player from the game" )
force:SetIcon( "icon16/delete.png" )
function force:DoClick()
  RunConsoleCommand("ulx kick","reason", ply:EntIndex())
end

But i Get This Error sign

RunConsoleCommand: Command has invalid characters! (ulx kick (' '))
        The first parameter of this function should contain only the command, the second parameter should contain arguments.

PLEASE Can anyone help me

hjpotter92
  • 78,589
  • 36
  • 144
  • 183
  • Try using `RunConsoleCommand( "kick", ply:EntIndex() )`. According to the [list of commands](http://steamcommunity.com/sharedfiles/filedetails/?id=170589737), ULX kick command doesn't accept reason argument. – hjpotter92 Jul 07 '14 at 18:30
  • `kick` is an argument to the `ulx` command. Separate them into different strings. – Colonel Thirty Two Jul 07 '14 at 19:55

1 Answers1

0

Your command is ulx
Your arguments are: kick, reason and ply:EntIndex()

So instead of

RunConsoleCommand("ulx kick","reason", ply:EntIndex())

the line should be:

RunConsoleCommand("ulx", "kick", ply:EntIndex(), "reason")


'cause the first argument of the function should only contain the command you want to call.

Source: your Error Message ("The first parameter of this function should contain only the command, [...]") and http://wiki.garrysmod.com/page/Global/RunConsoleCommand

Mischa
  • 1,303
  • 12
  • 24