Trying to recreate Deathrun

Alright so I’m trying to recreate a Deathrun gamemode and I’m stuck already.

The problem is, whenever I try to test the gamemode I get this error:

LuaGetfile: Not Loading Deathrun\gamemode\cl_init.lua
Couldn’t include file ‘Deathrun\gamemode\cl_init.lua’ (File not found) (<nowhere>)
There was a problem opening the gamemode file ‘Deathrun/gamemode/cl_init.lua’

What’s the problem?

EDIT: Added the updated code and the other .lua files.



shared.lua: Also with this I used both “base” and “sandbox” and it didn’t work.

There’s quite a few reasons this can happen, I’m too tired to link to the wiki, do some searching real quick and you’ll see.

I’ve looked through the wiki and I can’t find anything that solves the problem.

Sounds like cl_init.lua isn’t downloading correctly. Verify that AddCSLuaFile is set up correctly server-side for it.

Yeah, everything is set up correctly according to how the wiki shows it.

If it’s deahtrun, why is it deriving from sandbox?

I’m new to coding and I thought that’s what it needed. What would it derive from?

EDIT: I also still can’t figure out this error.

well are you wanting to derive from fretta if so then DeriveGamemode( “fretta” ) however I thought you had to derive GM in the shared.lua, so why is it in the cl_init.lua?

I don’t want a fretta gamemode I want just a plain Deathrun, I put the derive from sandbox in cl_init because that’s where it was in the DarkRP gamemode.

But your not making DarkRP, your making Deathrun, I suggest you take out DeriveGamemode( “sandbox” ) from cl_init.lua and in shared.lua put in DeriveGamemode( “base” )

Tell me if it’s still error’s

Same error.

Why have you not defined any information in shared.lua like

GM.Name = “”
GM.Author = “”
GM.Email = “”
GM.Website = “”
GM.TeamBased = true


If I’m honest all your code looks really messy, it’s hard to sift through it all, no offence.


If your really looking at making a game mode from scratch then take a look into this article on the wiki

Another one to look at is

That’s what I used to create the gamemode and I deleted that code before I posted it on Pastebin. I feel stupid for deleting it now. I didn’t have GM.TeamBased though.

Well DR is a team based game, you will most likely have 3 teams, spectator, Death and the runners, you might want to declare all GM based shizz in shared.lua and set up some basic team info.

I know this doesn’t answer your problem in the OP but it’s a step in the right direction.

Didn’t I already set up the teams inside init.lua and shared.lua?

Well I’ve only really worked with fretta but I would have set the teams up in shared.lua like so

function GM:CreateTeams()

if ( !GAMEMODE.TeamBased ) then return end

team.SetUp( TEAM_RUN, "Runners", Color( 20, 20, 200 ), true )
team.SetSpawnPoint( TEAM_RUN, "info_player_counterterrorist" )
team.SetClass( TEAM_RUN, { "Runner" } )

team.SetUp( TEAM_DEATH, "Death", Color( 200, 20, 20 ), false )
team.SetSpawnPoint( TEAM_DEATH, "info_player_terrorist" ) 
team.SetClass( TEAM_DEATH, { "Death" } )



Yeah sorry you did set them up, Like I said I only really worked with fretta so I’m going to leave the topic now, hope someone can help you out better then I could.

Does anyone know how to fix the problem I had in the OP?

To determine the problem, I tried re-creating the gamemode using your code, using ‘test’ as gamemode name. Got the following errors, which would obviously stop the game from processing the files:

[gamemodes	est\gamemode\init.lua:19] '=' expected near 'end'
There was a problem opening the gamemode file 'test/gamemode/init.lua'

Clientside, I got this error:

[gamemodes	est\gamemode\shared.lua:12] 'end' expected (to close 'function' at line 7) near '<eof>'

I had to fix a buttload of simple errors, like ‘then’ missing after if conditionals, and ‘spawns[random]’ expecting an operator. After fixing those simple errors, I ran the gamemode just fine. No complaints from the engine.
I never encountered the specific error in the OP - LuaGetfile: Not Loading Deathrun\gamemode\cl_init.lua, Couldn’t include file ‘Deathrun\gamemode\cl_init.lua’ (File not found) (<nowhere>)[cpp]

Anyway, there’s three reasons why a file would error out on include.
1: You forgot to AddCSLuaFile it
2: You messed up the file path
3: The file itself has critical errors that prevents it from running.

You’ve got 1 and 2 down, my guess is the third. Just to run this code, I had to fix 6-7 errors. Check your console ingame as you launch it. Don’t stop reading at the OP error, but look for other errors as well. If the file has critical errors, the lua engine will refuse to run the file!

Also, a friendly tip: The code you’ve presented through pastebin reveals you are very new to this. Being new is fine, but you’ll do yourself a favor by starting with something simpler.
An entire gamemode, built from scratch nonetheless, isn’t exactly the first thing you want to dive into.

If you still want to continue, and still can’t fix the problem in the OP after this, feel free to add me to steam, and I’ll do what I can to get you started.

Well, it could be that you forgot an end for your if statement in shared.