i hate these nil values, can someone help? this is the line its happening on:
local TestingComboBox = vgui.Create( "DComboBox", DermaFrame )
any ideas?
i hate these nil values, can someone help? this is the line its happening on:
local TestingComboBox = vgui.Create( "DComboBox", DermaFrame )
any ideas?
You are running that code on the server, it is meant to be on the client.
thanks, i just found the post related to this just before you posted
but now i have anougher problem . i want to change a certain cvar using a derma tool or something, i think its DComboBox and for some reason i get this:
attempt to concatenate field '?' (a userdata value)
it happens on this line :
RunConCommand("trailmod_mat " ..TestingComboBox:GetSelectedItems()[1])
i have alreay made the cvar trailmod_mat and tetingcombobox is the well DcomboBox and i want to change the cvar to what is selected. can some one help?
[editline]02:07PM[/editline]
PS: this is client side so RunConCommand shouldnt need a ply thing should it?
RunConsoleCommand("trailmod_mat", TestingComboBox:GetSelectedItems()[1]:GetValue())
er… i dont see any text in your post nullpoint?
Try now.
ok, sorry, i didnt know what was happening there ?!?! but i am testing it know. thanks in advance
[editline]03:25PM[/editline]
hmm… i thourght i got it all rught, but i can change the value of the cvar, and i got the cvar hooked up to the materials of the trails, but for osme reason, the material of the trail dpesnt change, here is the code:
CreateConVar("trailmod_mat", "trails/electric.vmt", false, false)
function trailme( ply )
local trailmat = GetConVarString("trailmod_mat")
util.SpriteTrail(ply, 0, Color(255,0,0), false, 15, 1, 4, 1/(15+1)*0.5, trailmat)
end
concommand.Add( "trailmod_enable", trailme )
and this is the code for the menu system:
function trailmod_open()
local DermaPanel = vgui.Create( "DFrame" ) -- Creates the frame itself
DermaPanel:SetPos( 50,50 ) -- Position on the players screen
DermaPanel:SetSize( 150, 225 ) -- Size of the frame
DermaPanel:SetTitle( "TrailMod Made by Ningaglio" ) -- Title of the frame
DermaPanel:SetVisible( true )
DermaPanel:SetSizable( true )
DermaPanel:SetDraggable( true ) -- Draggable by mouse?
DermaPanel:ShowCloseButton( true ) -- Show the close button?
DermaPanel:MakePopup() -- Show the frame
local TestingComboBox = vgui.Create( "DComboBox", DermaPanel )
TestingComboBox:SetPos( 10, 35 )
TestingComboBox:SetSize( 100, 185 )
TestingComboBox:SetMultiple( false ) -- Don't use this unless you know extensive knowledge about tables
TestingComboBox:AddItem( "trails/plasma.vmt" ) -- Add our options
TestingComboBox:AddItem( "trails/electric.vmt" )
TestingComboBox:AddItem( "trails/love.vmt" )
TestingComboBox:AddItem( "trails/physbeam.vmt" )
TestingComboBox:AddItem( "trails/smoke.vmt" )
TestingComboBox:AddItem( "trails/tube.vmt" )
local MainMenuSheet = vgui.Create( "DPanel", DermaPanel ) -- 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( DermaPanel:GetWide() - 25, DermaPanel:GetTall() - 25 )
MainMenuSheet.Paint = function()
if TestingComboBox:GetSelectedItems() and TestingComboBox:GetSelectedItems()[1] then -- make sure something is selected if not we get uber spam of errors
local OurStringThing = "Your selection is: "..TestingComboBox: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
RunConsoleCommand("trailmod_mat", TestingComboBox:GetSelectedItems()[1]:GetValue())
end
end
end
concommand.Add("trailme_menu", trailmod_open)
any other ideas?