Could not find cl_init.lua (gamemode)

This is probably a dumb question but I can’t find the solution anywhere.
When loading into my gamemode on both a dedicated server and a singleplayer game I’m given the following error in console:



[P E B S I E|2|STEAM_0:0:40317770] Lua Error:
Couldn't include file 'zombie-city\gamemode\cl_init.lua' (File not found) (<nowhere>)

[P E B S I E|2|STEAM_0:0:40317770] Lua Error:
Couldn't Load Init Script: 'zombie-city/gamemode/cl_init.lua'

I’ve added essentially nothing to this gamemode just yet. Below is the entirety of my code:

init.lua


AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )

include("player.lua")
include( "shared.lua" )

function GM:PlayerConnect( name, ip )
end

function GM:PlayerInitialSpawn( ply )
end

function GM:OnPlayerChat(ply, strText)
	ply:BuyWep("pistol")
end

cl_init.lua


include("shared.lua")

shared.lua


GM.Name = "Zombie City"
GM.Author = "Pebsie"
GM.Email = "email@peb.si"
GM.Website = "peb.si"

function GM:Initialize()
end

player.lua


local ply = FindMetaTable("Player")

function ply:BuyWep(wep)
	local weapons = {}
	weapons["pistol"] = {name="Pistol", swep="weapon_pistol", cost=50}

	self:Give(weapons[wep].swep)
	print(self:Nick().." bought a "..wep)
end

When spawning the player is given a Phys Gun. The GM:OnPlayerChat function doesn’t run at all but the connect and initialspawn functions do. Very odd.

I believe cl_init needs to have actual code.

That isn’t what the wiki nor Goature’s tutorials suggest.


include("shared.lua")

should be enough.

Try adding an empty function.

Pretty sure there only needs to be content in the actual file, so include should be enough. If its not working then its likely you have a naming error, or you files are in the wrong directory.

My file structure is as follows:

gamemodes/zombie-city/
zombie-city/zombie-city.txt
zombie-city/gamemode/init.lua
zombie-city/gamemode/cl_init.lua
zombie-city/gamemode/shared.lua

I’m fairly certain that this is identical to every other gamemode I’ve looked at.

Perhaps try removing the hyphen from your gamemode name?

Edit: Miss read your problem, my bad