DComboBox Text

Hello, another question

[lua]
function rpmenu() --infomenu function
local rpmenu = vgui.Create( “DFrame” ) --creates menu
rpmenu:SetPos( ScrW() / 2 - 300, ScrH() / 2 - 300 ) --position of menu (ScrW and ScrH mean Screen Width and Screen Height.)
rpmenu:SetSize( 600, 600 ) --size of menu
rpmenu:SetTitle( “Gamers4Life RealisticRP gamemode menu.” ) --title of menu (top)
rpmenu:SetVisible( true ) --visable?
rpmenu:SetDraggable( false ) --draggable?
rpmenu:MakePopup() --popup?
rpmenu:ShowCloseButton( true ) --show close button?

local rptabs = vgui.Create( “DPropertySheet” ) --menutabs
rptabs:SetParent( rpmenu )
rptabs:SetPos( 10, 30 )
rptabs:SetSize( 580, 560 )

local teammenuSheet = vgui.Create( “DPanel”, rpmenu) – We create a panel so we can draw shit on; if we use the frame, it comes up transparent for some reason
teammenuSheet:SetPos( 125, 50 )
teammenuSheet:SetSize( rpmenu:GetWide() - 25, rpmenu:GetTall() - 25 )

local teambox = vgui.Create( “DComboBox”, teammenuSheet)
teambox:SetPos( 20, 55 )
teambox:SetSize( 150, 305 )
teambox:SetMultiple( false ) – Don’t use this unless you know extensive knowledge about tables
teambox:AddItem( “Civilian” ) – Add our options
teambox:AddItem( “Bum” )
teambox:AddItem( “Police” )
teambox:AddItem( “Police Chief” )
teambox:AddItem( “Gangster” )
teambox:AddItem( “Gangster Leader” )
teambox:AddItem( “Russian Maffia” )
teambox:AddItem( “Russian Maffia Don” )
teambox:AddItem( “Shop Owner” )
teambox:AddItem( “Bodygaurd” )
teambox:AddItem( “Gunshop Owner” )
teambox:AddItem( “Admin” )
// print teambox.GetSelected()

teammenuSheet.Paint = function()
if teambox:GetSelected( “Civilian” ) then
local civillian = vgui.Create( “DTextEntry” )
civillian:SetParent( teambox )
civillian:SetPos( 10,50 )
civillian:SetTall( 450 )
civillian:SetWide( 545 )
civillian:SetDrawBackground( false )
civillian:SetDrawBorder( false )
civillian:SetEditable( false )
civillian:SetEnterAllowed( false )
civillian:SetMultiline( true )

local civil1 = {}
 civil1[1] = ( "Donators get ALOT of extra features.

" )
civil1[2] = ( "A few of them are listed below:
" )
civil1[3] = ( "
" )
civil1[4] = ( "1. A reserved slot, yay, no wait time anymore for you!
" )
civil1[5] = ( "2. Colored chat, everybody will notice you!
" )
civil1[6] = ( "3. Make sure those minges die in a hole, you get kick and ban commands!
" )
civil1[7] = ( "4. Immunity to all ranks below you, nobody shall harm you!
" )
civil1[8] = ( "5. Access to our ban portal, don’t feel like going ingame to ban a minge? Just do it trough the website!
" )
civil1[9] = ( "6. Extra props in Garry’s Mod, own teh small bases!
" )
civil1[10] = ( "7. Extra health, see your teammates fail when you march towards victory!
" )
civil1[11] = ( "8. Be seen, everybody will know you, everybody will recognize you!
" )
civil1[12] = ( "9. Get popular, everybody loves the Donators, and who doesn’t, doesn’t deserve to be here
" )
civil1[13] = ( "10. Get access to a ton of Sourcemod and Extso commands to cheat your way in and out of situations, yay for cheating!
" )
civil1[14] = ( "11. 12,000 Thullars! Bribe teh bitches!
" )
civil1[15] = ( "
" )
civil1[16] = ( "To donate, please visit our website at: www.gamers4life.org
" )
civil1[17] = ( "And click on ‘Shop’
" )
civil1[18] = ( “Donate now and enjoy your extra features, make everybody jalous!” )

civillian:SetText(table.concat(civil1))

    surface.SetFont( "default" )
    surface.SetTextColor( 255, 255, 255, 255 )
    surface.SetTextPos( teambox:GetWide() + 25, 55 )
    surface.DrawText( civillian ) -- Draws the text
    
else

end

end

rptabs:AddSheet( “Occupation”, teammenuSheet, “gui/silkicons/user”, false, false, “Choose your Occupation.” )

end
concommand.Add( “rpmenu”, rpmenu )
usermessage.Hook( “rpmenu”, rpmenu )[/lua]

I want it, when I select ‘Civilian’ it shows that text on the side, and a button (which I haven’t added yet). And when I select something else, it shows something else.

I know this is wrong, but It’s just for example. When I try this I get the following thing spammed if I click on ANY of the options:

[lua]
[@RealisticRP\gamemode\cl_init.lua:289] bad argument #1 to ‘DrawText’ (string expected, got nil)[/lua]

line 289 is
[lua]surface.DrawText( civillian )[/lua]

Could anybody please tell me how to do this correctly?

Thanks in advance.

Replace [lua]civillian:SetText(table.concat(civil1))[/lua] with [lua]civillian:SetText(table.concat(civil1, "
"))[/lua]

That did not work, same thing

Bump

[lua]
local n = 0;
function rpmenu() --infomenu function
local rpmenu = vgui.Create( “DFrame” ) --creates menu
rpmenu:SetPos( ScrW() / 2 - 300, ScrH() / 2 - 300 ) --position of menu (ScrW and ScrH mean Screen Width and Screen Height.)
rpmenu:SetSize( 600, 600 ) --size of menu
rpmenu:SetTitle( “Gamers4Life RealisticRP gamemode menu.” ) --title of menu (top)
rpmenu:SetVisible( true ) --visable?
rpmenu:SetDraggable( false ) --draggable?
rpmenu:MakePopup() --popup?
rpmenu:ShowCloseButton( true ) --show close button?

local rptabs = vgui.Create( “DPropertySheet” ) --menutabs
rptabs:SetParent( rpmenu )
rptabs:SetPos( 10, 30 )
rptabs:SetSize( 580, 560 )

local teammenuSheet = vgui.Create( “DPanel”, rpmenu) – We create a panel so we can draw shit on; if we use the frame, it comes up transparent for some reason
teammenuSheet:SetPos( 125, 50 )
teammenuSheet:SetSize( rpmenu:GetWide() - 25, rpmenu:GetTall() - 25 )

local teambox = vgui.Create( “DComboBox”, teammenuSheet)
teambox:SetPos( 20, 55 )
teambox:SetSize( 150, 305 )
teambox:SetMultiple( false ) – Don’t use this unless you know extensive knowledge about tables
teambox:AddItem( “Civilian” ) – Add our options
teambox:AddItem( “Bum” )
teambox:AddItem( “Police” )
teambox:AddItem( “Police Chief” )
teambox:AddItem( “Gangster” )
teambox:AddItem( “Gangster Leader” )
teambox:AddItem( “Russian Maffia” )
teambox:AddItem( “Russian Maffia Don” )
teambox:AddItem( “Shop Owner” )
teambox:AddItem( “Bodygaurd” )
teambox:AddItem( “Gunshop Owner” )
teambox:AddItem( “Admin” )
// print teambox.GetSelected()

teammenuSheet.Paint = function()
if teambox:GetSelected( “Civilian” ) then
local civillian = vgui.Create( “DTextEntry” )
civillian:SetParent( teambox )
civillian:SetPos( 10,50 )
civillian:SetTall( 450 )
civillian:SetWide( 545 )
civillian:SetDrawBackground( false )
civillian:SetDrawBorder( false )
civillian:SetEditable( false )
civillian:SetEnterAllowed( false )
civillian:SetMultiline( true )
end
local civil1 = {}
civil1[1] = ( "Donators get ALOT of extra features.
" )
civil1[2] = ( "A few of them are listed below:
" )
civil1[3] = ( "
" )
civil1[4] = ( "1. A reserved slot, yay, no wait time anymore for you!
" )
civil1[5] = ( "2. Colored chat, everybody will notice you!
" )
civil1[6] = ( "3. Make sure those minges die in a hole, you get kick and ban commands!
" )
civil1[7] = ( "4. Immunity to all ranks below you, nobody shall harm you!
" )
civil1[8] = ( "5. Access to our ban portal, don’t feel like going ingame to ban a minge? Just do it trough the website!
" )
civil1[9] = ( "6. Extra props in Garry’s Mod, own teh small bases!
" )
civil1[10] = ( "7. Extra health, see your teammates fail when you march towards victory!
" )
civil1[11] = ( "8. Be seen, everybody will know you, everybody will recognize you!
" )
civil1[12] = ( "9. Get popular, everybody loves the Donators, and who doesn’t, doesn’t deserve to be here
" )
civil1[13] = ( "10. Get access to a ton of Sourcemod and Extso commands to cheat your way in and out of situations, yay for cheating!
" )
civil1[14] = ( "11. 12,000 Thullars! Bribe teh bitches!
" )
civil1[15] = ( "
" )
civil1[16] = ( "To donate, please visit our website at: www.gamers4life.org
" )
civil1[17] = ( "And click on ‘Shop’
" )
civil1[18] = ( “Donate now and enjoy your extra features, make everybody jalous!” )

surface.SetFont( "default" )
surface.SetTextColor( 255, 255, 255, 255 )
surface.SetTextPos( teambox:GetWide() + 20, 55 )
surface.DrawText( civil1[1] ) 
surface.SetTextPos( teambox:GetWide() + 20, 75 )
surface.DrawText( civil1[2] ) 
surface.SetTextPos( teambox:GetWide() + 20, 95 )
surface.DrawText( civil1[3] ) 
surface.SetTextPos( teambox:GetWide() + 20, 115 )
surface.DrawText( civil1[4] ) 
surface.SetTextPos( teambox:GetWide() + 20, 135 )
surface.DrawText( civil1[5] ) 
surface.SetTextPos( teambox:GetWide() + 20, 155 )
surface.DrawText( civil1[6] ) 
surface.SetTextPos( teambox:GetWide() + 20, 175 )
surface.DrawText( civil1[7] ) 
surface.SetTextPos( teambox:GetWide() + 20, 195 )
surface.DrawText( civil1[8] ) 
surface.SetTextPos( teambox:GetWide() + 20, 215 )
surface.DrawText( civil1[9] ) 
surface.SetTextPos( teambox:GetWide() + 20, 235 )
surface.DrawText( civil1[10] ) 
surface.SetTextPos( teambox:GetWide() + 20, 255 )
surface.DrawText( civil1[11] ) 
surface.SetTextPos( teambox:GetWide() + 20, 275 )
surface.DrawText( civil1[12] ) 
surface.SetTextPos( teambox:GetWide() + 20, 295 )
surface.DrawText( civil1[13] ) 
surface.SetTextPos( teambox:GetWide() + 20, 325 )
surface.DrawText( civil1[14] ) 
surface.SetTextPos( teambox:GetWide() + 20, 345 )
surface.DrawText( civil1[15] ) 
surface.SetTextPos( teambox:GetWide() + 20, 365 )
surface.DrawText( civil1[16] ) 
surface.SetTextPos( teambox:GetWide() + 20, 385 )
surface.DrawText( civil1[17] ) 
surface.SetTextPos( teambox:GetWide() + 20, 405 )
surface.DrawText( civil1[18] ) 

end

rptabs:AddSheet( “Occupation”, teammenuSheet, “gui/silkicons/user”, false, false, “Choose your Occupation.” )

end
concommand.Add( “rpmenu”, rpmenu )
usermessage.Hook( “rpmenu”, rpmenu )
[/lua]

Just an off topic thing, after reading your donator benefits, I’m going to confidently say that you aren’t going to get many players (or donors) for that matter.

It’s just some testing text that I typed sometime ago, but if you got any suggestions, I need the for my new donator features list!