Any idea why this isnt working? Im getting 0 errors, but when i type selectweapon in console Unknown command: selectweapon
Any help is appreciated.
[PHP]
local function WeaponSelectorDerma()
local WeaponFrame = vgui.Create("DFrame") --create a frame
WeaponFrame:SetSize( 250, 300 ) --set its size
WeaponFrame:Center() --position it at the center of the screen
WeaponFrame:SetTitle(" Choose what weapon to spawn with!") --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 PWeapons = vgui.Create("DCollapsibleCategory", DermaPanel)
PWeapons:SetPos( 25,50 )
PWeapons:SetSize( 200, 50 ) -- Keep the second number at 50
PWeapons:SetExpanded( 0 ) -- Expanded when popped up
PWeapons:SetLabel( "Primary Weapons" )
CategoryList = vgui.Create( "DPanelList" )
CategoryList:SetAutoSize( true )
CategoryList:SetSpacing( 5 )
CategoryList:EnableHorizontal( false )
CategoryList:EnableVerticalScrollbar( true )
SecondaryWeapons:SetContents( CategoryList ) -- Add our list above us as the contents of the collapsible category
local CategoryContentOne = vgui.Create( "DComboBox" )
CategoryContentOne:SetPos( 10, 35 )
CategoryContentOne:SetSize( 100, 185 )
CategoryContentOne:SetMultiple( false ) -- Don't use this unless you know extensive knowledge about tables
CategoryContentOne:AddItem( "M16" ) -- Add our options
CategoryContentOne:AddItem( "MAC10" )
CategoryContentOne:AddItem( "Shotgun" )
CategoryContentOne:AddItem( "Rifle" )
CategoryContentOne:AddItem( "HUGE 249" )
local MainMenuSheet = vgui.Create( "DPanel", WeaponFrame ) -- We create a panel so we can draw shit on; if we use the frame, it comes up transparent for some reason
MainMenuSheet:SetPos( 125, 50 )
MainMenuSheet:SetSize( WeaponFrame:GetWide() - 25, WeaponFrame:GetTall() - 25 )
MainMenuSheet.Paint = function()
if CategoryContentOne:GetSelectedItems() and CategoryContentOne:GetSelectedItems()[1] then -- make sure something is selected if not we get uber spam of errors
local OurStringThing = "Your selection is: "..CategoryContentOne:GetSelectedItems()[1]:GetValue().."!" -- This was a pain in the ass to figure out; this gets the name of the option chosen
surface.SetFont( "default" )
surface.SetTextColor( 255, 255, 255, 255 )
surface.SetTextPos( 50, 50 )
surface.DrawText( OurStringThing ) -- Draws the text
end
local SecondaryWeapons = vgui.Create("DCollapsibleCategory", DermaPanel)
SecondaryWeapons:SetPos( 25,50 )
SecondaryWeapons:SetSize( 200, 50 ) -- Keep the second number at 50
SecondaryWeapons:SetExpanded( 0 ) -- Expanded when popped up
SecondaryWeapons:SetLabel( "Primary Weapons" )
CategoryList = vgui.Create( "DPanelList" )
CategoryList:SetAutoSize( true )
CategoryList:SetSpacing( 5 )
CategoryList:EnableHorizontal( false )
CategoryList:EnableVerticalScrollbar( true )
SecondaryWeapons:SetContents( CategoryList ) -- Add our list above us as the contents of the collapsible category
local CategoryContentOne = vgui.Create( "DComboBox" )
CategoryContentTwo:SetPos( 10, 35 )
CategoryContentTwo:SetSize( 100, 185 )
CategoryContentTwo:SetMultiple( false ) -- Don't use this unless you know extensive knowledge about tables
CategoryContentTwo:AddItem( "Pistol" ) -- Add our options
CategoryContentTwo:AddItem( "Deagle" )
CategoryContentTwo:AddItem( "Glock" )
local MainMenuSheet = vgui.Create( "DPanel1", WeaponFrame ) -- We create a panel so we can draw shit on; if we use the frame, it comes up transparent for some reason
MainMenuSheet:SetPos( 125, 50 )
MainMenuSheet:SetSize( WeaponFrame:GetWide() - 25, WeaponFrame:GetTall() - 25 )
MainMenuSheet.Paint = function()
if CategoryContentTwo:GetSelectedItems() and CategoryContentTwo:GetSelectedItems()[1] then -- make sure something is selected if not we get uber spam of errors
local OurStringThing = "Your selection is: "..CategoryContentTwo:GetSelectedItems()[1]:GetValue().."!" -- This was a pain in the ass to figure out; this gets the name of the option chosen
surface.SetFont( "default" )
surface.SetTextColor( 255, 255, 255, 255 )
surface.SetTextPos( 50, 50 )
surface.DrawText( OurStringThing ) -- Draws the text
end
concommand.Add("selectweapon", WeaponSelectorDerma) --make the console command to make this menu popup
end
end
end[/PHP]
whats the error?
[QUOTE=G4MB!T;38221597]whats the error?[/QUOTE]
[QUOTE=craigy09;38220334]Any idea why this isnt working? Im getting 0 errors, but when i type selectweapon in console Unknown command: selectweapon[/QUOTE]
right got you i thought you said you were getting errors :D
ill check it in a sec
concommand.Add should go at the very bottom
[editline]Edited:[/editline]
like this
[lua]local function WeaponSelectorDerma()
local WeaponFrame = vgui.Create("DFrame") --create a frame
WeaponFrame:SetSize( 250, 300 ) --set its size
WeaponFrame:Center() --position it at the center of the screen
WeaponFrame:SetTitle(" Choose what weapon to spawn with!") --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 PWeapons = vgui.Create("DCollapsibleCategory", DermaPanel)
PWeapons:SetPos( 25,50 )
PWeapons:SetSize( 200, 50 ) -- Keep the second number at 50
PWeapons:SetExpanded( 0 ) -- Expanded when popped up
PWeapons:SetLabel( "Primary Weapons" )
CategoryList = vgui.Create( "DPanelList" )
CategoryList:SetAutoSize( true )
CategoryList:SetSpacing( 5 )
CategoryList:EnableHorizontal( false )
CategoryList:EnableVerticalScrollbar( true )
SecondaryWeapons:SetContents( CategoryList ) -- Add our list above us as the contents of the collapsible category
local CategoryContentOne = vgui.Create( "DComboBox" )
CategoryContentOne:SetPos( 10, 35 )
CategoryContentOne:SetSize( 100, 185 )
CategoryContentOne:SetMultiple( false ) -- Don't use this unless you know extensive knowledge about tables
CategoryContentOne:AddItem( "M16" ) -- Add our options
CategoryContentOne:AddItem( "MAC10" )
CategoryContentOne:AddItem( "Shotgun" )
CategoryContentOne:AddItem( "Rifle" )
CategoryContentOne:AddItem( "HUGE 249" )
local MainMenuSheet = vgui.Create( "DPanel", WeaponFrame ) -- We create a panel so we can draw shit on; if we use the frame, it comes up transparent for some reason
MainMenuSheet:SetPos( 125, 50 )
MainMenuSheet:SetSize( WeaponFrame:GetWide() - 25, WeaponFrame:GetTall() - 25 )
MainMenuSheet.Paint = function()
if CategoryContentOne:GetSelectedItems() and CategoryContentOne:GetSelectedItems()[1] then -- make sure something is selected if not we get uber spam of errors
local OurStringThing = "Your selection is: "..CategoryContentOne:GetSelectedItems()[1]:GetValue().."!" -- This was a pain in the ass to figure out; this gets the name of the option chosen
surface.SetFont( "default" )
surface.SetTextColor( 255, 255, 255, 255 )
surface.SetTextPos( 50, 50 )
surface.DrawText( OurStringThing ) -- Draws the text
end
local SecondaryWeapons = vgui.Create("DCollapsibleCategory", DermaPanel)
SecondaryWeapons:SetPos( 25,50 )
SecondaryWeapons:SetSize( 200, 50 ) -- Keep the second number at 50
SecondaryWeapons:SetExpanded( 0 ) -- Expanded when popped up
SecondaryWeapons:SetLabel( "Primary Weapons" )
CategoryList = vgui.Create( "DPanelList" )
CategoryList:SetAutoSize( true )
CategoryList:SetSpacing( 5 )
CategoryList:EnableHorizontal( false )
CategoryList:EnableVerticalScrollbar( true )
SecondaryWeapons:SetContents( CategoryList ) -- Add our list above us as the contents of the collapsible category
local CategoryContentOne = vgui.Create( "DComboBox" )
CategoryContentTwo:SetPos( 10, 35 )
CategoryContentTwo:SetSize( 100, 185 )
CategoryContentTwo:SetMultiple( false ) -- Don't use this unless you know extensive knowledge about tables
CategoryContentTwo:AddItem( "Pistol" ) -- Add our options
CategoryContentTwo:AddItem( "Deagle" )
CategoryContentTwo:AddItem( "Glock" )
local MainMenuSheet = vgui.Create( "DPanel1", WeaponFrame ) -- We create a panel so we can draw shit on; if we use the frame, it comes up transparent for some reason
MainMenuSheet:SetPos( 125, 50 )
MainMenuSheet:SetSize( WeaponFrame:GetWide() - 25, WeaponFrame:GetTall() - 25 )
MainMenuSheet.Paint = function()
if CategoryContentTwo:GetSelectedItems() and CategoryContentTwo:GetSelectedItems()[1] then -- make sure something is selected if not we get uber spam of errors
local OurStringThing = "Your selection is: "..CategoryContentTwo:GetSelectedItems()[1]:GetValue().."!" -- This was a pain in the ass to figure out; this gets the name of the option chosen
surface.SetFont( "default" )
surface.SetTextColor( 255, 255, 255, 255 )
surface.SetTextPos( 50, 50 )
surface.DrawText( OurStringThing ) -- Draws the text
end
end
end
end
concommand.Add("selectweapon", WeaponSelectorDerma)[/lua]
Hello there, good to see you're posting my code publicly to get fixed by others. I'm curious to know why you're using my code without my permission, please respond.
Sorry, you need to Log In to post a reply to this thread.