Weapon command help

I have a leveling system and a command to buy weapons. I want to make it that you need to be > lvl 7 to be able to buy a weapon. I know basic LUA but what I need to know is what to put (if player is > lvl 7 he can use the command) and where to put it. Thanks :smiley:

And how should we be able to help you without you post some code?

Well because i dont know what to put.

function GivePlayerAWeapon( ply, cmd, args ) 
	if args[1] == "pistol" then --if the 1st argument is "pistol" then do:
	        ply:Give("weapon_pistol") --give the player a pistol
		ply:ChatPrint("You got a pistol!") 
	end --close our if loop
	if args[1] == "smg" then --if the 1st argument is "smg" then do:
		ply:Give("weapon_smg") --give the player an SMG
		ply:ChatPrint("You got an SMG!") --print "You got an SMG!" in the chat
        end--close our if loop
end --close our function
concommand.Add("weapon_take", GivePlayerAWeapon) --make the console command "weapon_take" run the GivePlayerAWeapon function

Then the menu I guess

function WeaponSelectorDerma()
local WeaponFrame = vgui.Create("DFrame") --create a frame
WeaponFrame:SetSize(250, 80) --set its size
WeaponFrame:Center() --position it at the center of the screen
WeaponFrame:SetTitle("Take the weapon that you want") --set the title of the menu 
WeaponFrame:SetDraggable(true) --can you move it around
WeaponFrame:SetSizable(false) --can you resize it?
WeaponFrame:ShowCloseButton(true) --can you close it
WeaponFrame:MakePopup() --make it appear
local PistolButton = vgui.Create("DButton", WeaponFrame)
PistolButton:SetSize(100, 30)
PistolButton:SetPos(10, 35)
PistolButton.DoClick = function() RunConsoleCommand("weapon_take", "pistol") WeaponFrame:Close() 
local SMGButton = vgui.Create("DButton", WeaponFrame)
SMGButton:SetSize(100, 30)
SMGButton:SetPos(140, 35)
SMGButton:SetText("SMG") --Set the name of the button
SMGButton.DoClick = function() RunConsoleCommand("weapon_take", "smg") WeaponFrame:Close() end
concommand.Add("selectweapon", WeaponSelectorDerma) 

and then… what do I do how do I block people from using weapon_take until they are lvl 7?

function GivePlayerAWeapon( ply, cmd, args )
if ply.Level and ply.Level < 7 then return end – if player got the argument Level (ply.Level) and if it’s under 7 (ply.Level < 7) the code will stop right here.
if args[1] == “pistol” then --if the 1st argument is “pistol” then do:
ply:Give(“weapon_pistol”) --give the player a pistol
ply:ChatPrint(“You got a pistol!”)
end --close our if loop
if args[1] == “smg” then --if the 1st argument is “smg” then do:
ply:Give(“weapon_smg”) --give the player an SMG
ply:ChatPrint(“You got an SMG!”) --print “You got an SMG!” in the chat
end–close our if loop
end --close our function

concommand.Add(“weapon_take”, GivePlayerAWeapon)

I don’t know how your Level system works, you might have to change ply.Level to whatever is used to get the level of a player.

Thanks a lot!