Console command help!

How do i make a console command with parameters?

Example:



init.lua

function Test(ply, num)
ply:SetHealth(num)
end
concommand.Add("test" , Test) 

cl_init.lua

#####WHEN BUTTON IS PRESSED########
RunConsoleCommand("test")


Now… How do i add something to the console command, so i can set the health through a vgui?

For your second question its simply:

[LUA]
button.DoClick = function()
RunConsoleCommand(“test”)
[/LUA]

I’m not very experienced with Lua, so I cannot answer the first question, hope this helps anyway.

[lua]
concommand.Add(“name_of_concmd”,function(ply,cmd,args)
PrintTable(args)
end)
[/lua]

How do i run it client-side?
RunConsoleCommand(“name_of_concmd”, 2) ?