MisterInvalid Posted December 31, 2012 Share Posted December 31, 2012 (edited) Hi, I started trying to learn Lua today, and make my own (probably terrible) gamemode. I ran into a problem, and I'm not sure how to fix it. When I try to run my gamemode, I get the following error: Couldn't include file 'shared.lua' (File not found) (@gamemodes/ghostwar/gamemode/cl_init.lua (line 1)) I do have shared.lua, and it is in the folder with my cl_init.lua and init.lua. The contents of my cl_init.lua (If that could help) include( 'shared.lua' ) function set_team() local frame = vgui.Create( "DFrame" ) frame:SetPos( ScrW() / 2, ScrH() / 2 ) frame:SetSize( 200, 210 ) frame:SetTitle( "Change Team" ) frame:SetVisible( true ) frame:SetDraggable( false ) frame:ShowCloseButton( true ) frame:MakePopup() team_1 = vgui.Create( "DButton", frame ) team_1:SetPos( frame:GetTall() / 2, 5 ) team_1:SetSize( 50, 100 ) team_1:SetText( "Be The Ghost" ) team_1.DoClick = function() RunConsoleCommand( "team_1" ) end team_2 = vgui.Create( "DButton", frame ) team_2:SetPos( frame:GetTall() / 2, 105 ) team_2:SetSize( 50, 100 ) team_2:SetText( "Be A Victim" ) team_2.DoClick = function() RunConsoleCommand( "team_2" ) end end concommand.Add( "team_menu", set_team ) My init.lua AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) include( 'shared.lua' ) ghosts = false function GM:PlayerInitialSpawn( ply ) self.BaseClass:PlayerSpawn( ply ) ply:SetTeam( 2 ) end function GM:PlayerLoadout( ply ) if ply:Team() == 1 then ply:Give ( "weapon_crowbar" ) ply:SetGravity ( 0.50 ) ply:SetHealth ( 150 ) ply:SetWalkSpeed ( 150 ) ply:SetRunSpeed ( 200 ) end elseif ply:Team() == 2 then ply:Give ( "weapon_crossbow" ) ply:SetMaxHealth ( 50 ) ply:SetGravity ( 0.90 ) ply:SetWalkSpeed ( 100 ) ply:SetRunSpeed ( 125 ) end end function team_1( ply ) if ghosts == false then ply:SetTeam( 1 ) ply:PrintMessage (HUD_PRINTTALK, "OH NO, " .. ply:name() .. "IS A GHOST!) ghosts == true end elseif ghosts == true then umsg.Start ( "The Ghosts team is full", ply ) umsg.End ply:SetTeam( 2 ) end end function fPlayerDisconnect( ply ) if ply:team() == 1 ghosts == false PrintMessage( HUD_PRINTTALK, ply:GetName() .. " has left the server." ) end else if ply:team() == 2 PrintMessage( HUD_PRINTTALK, ply:GetName() .. " has left the server." ) end hook.Add( "PlayerDisconnected", "playerdisconnected", fPlayerDisconnect ) And my shared.lua GM.Name = "Ghostwar" GM.Author = "MisterInvalid" GM.Email = "" GM.Website = "" team.SetUp( 1, "Ghost", Color( 0, 0, 0, 0 ) ) team.SetUp( 2, "Victims", Color( 50, 50, 50, 255 ) ) I know the code probably won't work, but it's my first time Edited December 31, 2012 by MisterInvalid Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.