I've spent the better part of today researching this with no success. I'm relatively new to LUA, but I've been coding for years, so I understand the concept of stupid-user error.
I'm trying to create a gamemode. Right now- the absolute simplest one that can initiate without errors.
I have created a fresh, vanilla copy of GarrysModDS, and inside, I have carefully followed the Wiki's basic guide to creating a gamemode. My goal is to have the gamemode use as little as possible so I can build off of it. In single-player, everything works fine. When I spawn, I can literally do nothing besides walk/run around and see my HP. That's exactly what I want. But I have essentially the exact same gamemode code on my server, and it doesn't behave the same way.
First, as a little disclaimer, I am a very sentimental person. With that said, my gamemode is named after a fine lady I recently met. To avoid further embarrassment for me, her temporary gamemode name is changed to <gm> for the sake of showing you the code used.
Now, let me give you a tour of the gamemode.
[B]Directory Structure[/B]
[I]These are the only files I am using.[/I]
[CODE]gamemodes\<gm>rp\[/CODE]
[CODE]gamemodes\<gm>rp\<gm>rp.txt[/CODE]
[CODE]gamemodes\<gm>rp\gamemode\[/CODE]
[CODE]gamemodes\<gm>rp\gamemode\cl_init.lua[/CODE]
[CODE]gamemodes\<gm>rp\gamemode\init.lua[/CODE]
[CODE]gamemodes\<gm>rp\gamemode\shared.lua[/CODE]
[B]File Contents[/B]
[U]<gm>rp.txt[/U]
[CODE]
"<gm>rp"
{
"base" ""
"title" "Totally not her name"
}
[/CODE]
[U]cl_init.lua[/U]
[lua]include( "shared.lua" )[/lua]
[U]init.lua[/U]
[lua]
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( "shared.lua" )
[/lua]
[U]shared.lua[/U]
[lua]
GM.Name = "<gm> RP"
GM.Author = "Not Schmal"
GM.Email = "fgt@schmal.me"
GM.Website = "http://www.sentimentalfgts.org/"
function GM:Initialize()
end
[/lua]
[B]Config Files[/B]
[I]Non-LUA assets that might be relevant[/I]
[U]initialize.cmd[/U] [I].bat files are for pussies, like me, but I still use .cmd[/I]
[CODE]
srcds.exe -console -condebug -game garrysmod +maxplayers 12 +hostport 27016 +fps_max 100 +map rp_evocity_v2d +sv_gamemode "<gm>rp" +sv_defaultgamemode "<gm>rp" +ip 123.456.789.101 +r_hunkalloclightmaps 0 -tickrate 33
[/CODE]
[U]server.cfg[/U]
[CODE]
// all commands
gamemode "<gm>rp"
[/CODE]
Now, the error I'm getting when the player spawns is:
[CODE]Couldn't include file '<gm>rp\gamemode\cl_init.lua' (File not found) ((nowhere))[/CODE]
Then, relating to the first error, I get:
[CODE]Couldn't Load Init Script: '<gm>rp\gamemode\cl_init.lua'[/CODE]
I feel like this should be some stupid thing that I'm forgetting, but I honestly cannot find the solution anywhere. Changing the gamemode to sandbox or base works just fine without errors. In-fact, copying the actual base gamemode and renaming the assets to a new name doesn't work either. It's very bizarre. If anyone can figure out the problem, I'll buy you coffee.
Thanks.
You don't need those: +sv_gamemode "<gm>rp" +sv_defaultgamemode "<gm>rp"
just put gamemode <name> in server.cfg OR +gamemode <name> in command line options
On topic, your cl_init.lua most likely have an error.
[editline]25th June 2013[/editline]
You can also try to remove < and > from the folder names
+gamemode "name" in the launch options did the trick. You didn't read the other stuff about the <gm>, but that's okay. I owe you a coffee, good sir.
Sorry, you need to Log In to post a reply to this thread.