ConCommand Help?

Ok so i have been looking and i cant find out how to do this. What i am trying to do is make something equal to the string of a console command? Kind of like hostname command or the name command.



you see what i meen?

p.s. i know thats probly not even close to how you would do it i am VERY new to lua.

The way commands work is that you enter a string into the console, goes through a table looking for that string, and using the function asociated with it. The string it should look for is the first argument of concommand.Add ( the function adding the function to the table ) . The second argument is a function, this function is called with 3 arguments. Server side it would be the player that called it, the command used, and arguments after the string entered in the console. Client side , it would be called with the arguments LocalPlayer() ( you! ), the command used, and the arguments following. This is how i would use it:

local mah_cmdname = “LolWut”
concommand.Add( mah_cmdname , function( pl , command, arguments )
if command == mah_cmdname then
print( pl:Nick() … " used the command " … mah_cmdname … " with the follow arguments : " … Unpack( arguments ) )


The third arguments used wile calling the function you are adding is under the form of a table, that is why i unpacked it, but i could have also done

//code here
/broux/ arguments[1]
//end mah code


that is using the first thing after the command, so if i did

LolWut lol what

it would give me

meisno used the lulwut command with the follow arguments : lol , what

:slight_smile: hope i helped

Thank you very much this helped a lot.