• AddCSLuaFile/Include help
    4 replies, posted
so I am creating another gamemode, and I am having an error that i have no idea how to fix or what is happening. I have defined all of the lua files with AddCSLuaFile in init.lua and included them where they are supposed to go in both init.lua and cl_init.lua, but for some reason, i am getting errors that it could not be found, Shared.lua and a vgui-dedicated lua file) from client. here is what I have - init.lua - [lua] AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) AddCSLuaFile( "teammenu.lua" ) include( "shared.lua" ) [/lua] cl_init.lua - [lua] include( "shared.lua" ) include( "teammenu.lua" ) [/lua] did i do anything wrong?
Check them for errors.
[QUOTE=Robotboy655;41638985]Check them for errors.[/QUOTE] can't seem to find anything wrong init.lua - [lua] AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) AddCSLuaFile( "teammenu.lua" ) include( "shared.lua" ) util.AddNetworkString( "OpenMenu" ) function GM:PlayerInitialSpawn( ply ) if table.Count( player.GetAll() ) == 0 then ply:Spectate( OBS_MODE_ROAMING ) else ply:Spectate( OBS_MODE_CHASE ) ply:SpectateEntity( table.Random( player.GetAll() ) ) end net.Start( "OpenMenu" ) net.Send( ply ) end concommand.Add( "df_teams", function( ply, cmd, args ) net.Start( "OpenMenu" ) net.Send( ply ) end ) [/lua] cl_init.lua - [lua] include( "shared.lua" ) include( "teammenu.lua" ) local ply = Player local meta = FindMetaTable( "Player" ) function GM:SpawnMenuEnabled() if ply:IsAdmin() then return true else return false end end [/lua]
local ply = Player should be local ply = LocalPlayer() [editline]29th July 2013[/editline] Also, I meant check for errors the files that cannot be found.
oh, well I can't find any in there. (and thanks for the correction) [editline]29th July 2013[/editline] shared.lua - [lua] GM.Name = "gamemode" -- not real name, just want to keep what i am working on a surprise from a friend if he manages to see this thread GM.Author = "jack10685" GM.Email = "N/A" GM.Website = "N/A" team.SetUp( 1, "Red team", Color( 255, 0, 0, 255 ), true ) team.SetSpawnPoint( 1, "info_player_terrorist" ) team.SetUp( 2, "Blue team", Color( 0, 0, 255, 255 ), true ) team.SetSpawnPoint( 2, "info_player_counterterrorist" ) [/lua] teammenu.lua - [lua] net.Receive( "OpenMenu", function( len ) local main = vgui.Create( "DFrame" ) main:SetSize( 200, 200 ) main:SetPos( 100, 100 ) main:SetVisible( true ) main:SetTitle( "Teams" ) main:MakePopup() end ) [/lua] [editline]29th July 2013[/editline] nvm, problem solved.
Sorry, you need to Log In to post a reply to this thread.