My vgui problems - Help!

I’m making a simple derma menu but I’m having some problems.

This gives me stagscript/gamemode/cl_init.lua:246: function arguments expected near ‘=’


local button1 = vgui.Create( "DButton", SheetItemTwo )
button1:SetPos( 20, 50 )
button1:SetSize( 180, 20)
button1:SetText( "Shop Owner" )
button1.DoClick = function()
DermaPanel:Close()
RunConsoleCommand("joinjob1")

end

local button1 = vgui.Create( "DButton", SheetItemTwo )
button1:SetPos( 20,  75 )
button1:SetSize( 180, 20)
button1:SetText( "Cook" )
button1.DoClick = function()
DermaPanel:Close()
RunConsoleCommand("joinjob2")
end

local button1 = vgui.Create( "DButton", SheetItemTwo )
button1:SetPos( 20,  100 )
button1:SetSize( 180, 20)
button1:SetText( "Hobo" )
button1.DoClick = function()
DermaPanel:Close()
RunConsoleCommand("joinjob3")
end

local button1 = vgui.Create( "DButton", SheetItemTwo )
button1:SetPos( 20,  125 )
button1:SetSize( 180, 20)
button1:SetText( "Police Officer" )
button1.DoClick = function()
DermaPanel:Close()
RunConsoleCommand("joinjob4")
end

local button1 = vgui.Create( "DButton", SheetItemTwo )
button1:SetPos( 20,  150 )
button1:SetSize( 180, 20)
button1:SetText( "Normal Citizen" )
button1.DoClick = function()
DermaPanel:Close()
RunConsoleCommand("joinjob5")
end

local button01 = vgui.Create( "DButton", SheetItemTwo )
button01:SetPos( 20, 350 )
button01:SetSize( 180, 20)
button01:SetText( "Back" )
button01:Doclick = function()
DermaPanel:Close()

end

I’m trying to make a model menu where players change they’re models
but I cant find out how to, the menu works but the model doesnt change, this is the current code i have


local model = {}
 
model[1] = ("models/player/Group01/male_01.mdl")
model[2] = ("models/player/Group01/male_02.mdl")
model[3] = ("models/player/Group01/male_03.mdl")
model[4] = ("models/player/Group01/male_04.mdl")
model[5] = ("models/player/Group01/male_05.mdl")
model[6] = ("models/player/Group01/male_06.mdl")
model[7] = ("models/player/Group01/male_07.mdl")
model[8] = ("models/player/Group01/male_08.mdl")
model[9] = ("models/player/Group01/male_09.mdl")
model[10] = ("models/player/Group01/female_01.mdl")
model[11] = ("models/player/Group01/female_02.mdl")
model[12] = ("models/player/Group01/female_03.mdl")
model[13] = ("models/player/Group01/female_04.mdl")
model[14] = ("models/player/Group01/female_06.mdl")
model[15] = ("models/player/Group01/female_07.mdl")
model[16] = ("models/player/Group03/male_01.mdl")
model[17] = ("models/player/Group03/male_02.mdl")
model[18] = ("models/player/Group03/male_03.mdl")
model[19] = ("models/player/Group03/male_04.mdl")
model[20] = ("models/player/Group03/male_05.mdl")
model[21] = ("models/player/Group03/male_06.mdl")
model[22] = ("models/player/Group03/male_07.mdl")
model[23] = ("models/player/Group03/male_08.mdl")	
model[24] = ("models/player/Group03/male_09.mdl")
local IconList = vgui.Create( "DPanelList", SheetItemThree ) 
 
IconList:EnableVerticalScrollbar( true ) 
IconList:EnableHorizontal( true ) 
IconList:SetPadding( 4 ) 
IconList:SetPos(245, 10)
IconList:SetSize(215, 405)
 
for k,v in pairs(model) do
local icon = vgui.Create( "SpawnIcon", IconList ) 
icon:SetModel( v )
IconList:AddItem( icon )
icon.DoClick = function( icon ) 
surface.PlaySound( "ui/buttonclickrelease.wav" ) 
("client:SetModel", v)
RunConsoleCommand("modelchanged")
DermaPanel:Close()

end

end

Also i am having problems with GM:AddNotify


function modelchanged ( ply )
    ply:KillSilent()
	GM:AddNotify("Your model has been changed!", NOTIFY_ERROR, 3);
end
concommand.Add( "modelchanged", modelchanged )

and the last one i think its a bug
as you can see it shows me where the model is located

but after i clicked on the model i wanted the thingy is still there

Your last button should be button01.DoClick not button01:DoClick

model change:
[lua]
– SERVERSIDE
local mymodel = function(ply,cmd,args)
if( args[1] ) then
ply:SetModel(tostring(args[1]))
end
end
concommand.Add(“mdlc”, mymodel)
– END SERVERSIDE

icon.DoClick = function( icon )
surface.PlaySound( “ui/buttonclickrelease.wav” )
RunConsoleCommand(“mdlc”, v)
RunConsoleCommand(“modelchanged”)
DermaPanel:Close()
end
[/lua]

The little model path thing seems to be happening alot lately, either have a 1 second wait before closing the menu after clicking a model, or quickly create and then remove and invisible DFrame.

How do i make a simple timer? i tried but it didn’t work


timer.Simple(5, DermaPanel:Close())

EDIT: i fixed it, the model path is case sensitive if it has to change the players model
I get this



Attempting to precache model, but model name is NULL


the mymodel function is in init right?

[lua]local mymodel = function(ply,cmd,args)
if( args[1] ) then
ply:SetModel(args[1])
end
end
concommand.Add(“mdlc”, mymodel)
[/lua]
Although i don’t think tostring should affect it but give that a try.

Also for the timer try this.
[lua]
local function CloseMenu()
DermaPanel:Close()
end
timer.Simple(3, CloseMenu)
[/lua]

Thanks again!
I am still looking for some help on GM:AddNotify

GM:AddNotify() is clientside.

If your code IS clientside, than you can’t Kill() the player clientside.