lua script on clients

hi
i got a problem.
i coded a script with menus.

the menus are in cl_supportsystem.lua
the serverside stuff is in sv_supportsystem.lua

both files are located in the lua folder of my addon.

now i want that addon on my server.

so i need a third file what sends the cl_supportsystem.lua to the clients
i created one:




Msg("Loading supportsystem...")
if (CLIENT) then
timer.Simple(5,function()
include("cl_supportsystem.lua")
end)

else
IncludeClientFile("cl_supportsystem.lua")
include("sv_supportsystem.lua")


end

Msg("Done!
")




i placed this in lua/autorun

but it dont work … the server file ( sv_supportsystem.lua ) is running but not the client file. What have i done wrong?

**[G.AddCSLuaFile

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=G.AddCSLuaFile)**

Make sure your sending lua files to the client

isnt that done with IncludeClientFile(“cl_supportsystem.lua”)

[editline]12:53PM[/editline]

ok i tryed it with AddCSLuaFile but it still dont work ?!

AddCSLuaFile(“autorun/yourautorunfile.lua”)

and what if the clientfile is not in autorun ?

Then you put it to where it is that was an example

ok now it got



if (SERVER) then
AddCSLuaFile("cl_supportsystem.lua")
include("sv_supportsystem.lua")



else
include("cl_supportsystem.lua")



end


and the cl_supportsystem.lua is still not runned by the clients

just tell me what is wrong there :confused: ?

GMod only runs the files in /autorun/ by default.

yes. the file i posted is in /autorun

do i have to put cl_supportsystem.lua and sv_supportsystem.lua in autorun too ?

[editline]12:34PM[/editline]

and if i put cl_supportsystem.lua into autorun/client and sv_supportsystem.lua into autorun/server, just one of the files got runned ( sv_supportsystem )

:frowning:

Make a folder called “client” in autorun and put cl_supportsystem in that folder

ok that worked :wink:
thank you

but now i got a new problem :smiley:
in the clientside script…

line 17 to 23



local gpopup=vgui.Create("DFrame")
gpopup:SetSize(230,50)
gpopup:SetPos(5,ScrH()/2-100)
gpopup:SetTitle("Support System:")
gpopup:SetDraggable( false ) -- Draggable by mouse?
gpopup:ShowCloseButton( false )
gpopup:SetVisible(false)


returns the error:

Warning: vgui.Create failed to create the VGUI component (DFrame)
[addons\supportsystembydeathmaker\lua\autorun\client\cl_supportsystem.lua:18] attempt to index local ‘gpopup’ (a nil value)

but the hell, why :smiley: ?

[editline]02:01PM[/editline]

wtf ?

if i run the script with

lua_openscript_cl autorun/client/cl_supportsystem.lua

the error dont appear o.O

[editline]02:16PM[/editline]

i found the mistake… garrysmod cant create vgui’s so early… i added a timer

thanks anyway

It would of helped if you showed us all of your code.

And learn to listen in future the same method was explained 3 times to you before you finally understood.