• Gamemode Not Working At All
    27 replies, posted
Hey, I've recently decided to work on a gamemode, but it appears it doesn't work at all - Any code I type is blatantly ignored by Garry's Mod and so the Gamemode is literally nothing. I think this is caused by an error I have whenever I launch a map with this gamemode, I didn't have this problem when I started working on it but now it prevents anything. Here is the error Couldn't include file 'shared.lua' (File not found) (@gamemodes/gmode/gamemode/cl_init.lua (line 1)) It's clear it believes there is no shared.lua file, as the first line of my cl_init is include( 'shared.lua' ) I'm not sure why it thinks this, as there is a shared.lua file in the correct location. So what am I doing wrong? :L Any help would be greatly appreciated.
The very top of this category says "THIS IS NOT THE PLACE TO ASK FOR HELP"...
Post your gamemode.txt and shared.lua.
This isn't the place to ask for help as said above but since you've already made the post I may aswell give some feedback: Firstly, you haven't provided us with any details whether you are editing someone's work or creating your own gamemode. Secondly, you should take a copy of the small chunk of errors that you get upon starting your server (game) and post it with [code] tags so we can have a look. Finally, most cl_init files start with include('shared.lua') and I'm pretty sure this is a common problem.
Gamemode.txt [CODE]"gmode" { "base" "base" "title" "GMode" "menusystem" "1" } [/CODE] shared.lua [CODE]GM.Name = "GMode" GM.Author = "RedBull" GM.Email = "N/A" GM.Website = "N/A" function GM:Initialize() self.BaseClass.Initialize( self ) end //Teams team.SetUp( 1, "Runners", Color(0, 0, 255)) team.SetUp( 2, "Murderers", Color(255, 0, 0)) team.SetUp( 3, "Spectators", Color(159, 161, 154)) [/CODE] cl_init.lua --> I haven't added anything yet [CODE]include( 'shared.lua' )[/CODE] Sorry about posting in the wrong category :L
Have you added the file to be sent to the client with AddCSLuaFile? (this would be done it in the init.lua file)
init.lua already includes that [CODE]AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) include( 'shared.lua' )[/CODE]
Windows XP, that shouldn't cause any problem though??
Does the cl_init have any actual code yet?
Nope
Have you tried adding some?
I highly doubt it's that, it's that it can't include shared.lua because it doesn't think it exists.
If the file is empty include() will fail.
What CrashLemon said, if there's nothing at all in the file, GMod will just think that the file doesn't exist.
oh I thought the gamemode was named "Not Working At All" and it would be a gamemode where nothing was working at all or something guess i got the last part right though
I put a table into cl_init, but I still get the same error. shared.lua has information too, it just can't include the file.
[QUOTE=RedBull53860;43997660]I put a table into cl_init, but I still get the same error. shared.lua has information too, it just can't include the file.[/QUOTE] You have to put something that actually does something into cl_init.
Like? I thought the issue was that cl_init couldn't include shared because it couldn't find it
-snip-
Can you post your cl_init with the table please?
You could try doing DeriveGamemode("base") then your code, alternatively, you can also try just adding a bunch of junk, for example if(game.SinglePlayer()) then print("WOW") end haven't tested it, still worth a shot.
Not even adding random junk to cl_init works, it just fails to include shared.lua :L Adding DeriveGamemode("base") at the start removes the error, but the gamemode is still useless (No error, same problem.)
Its useless because you didn't code anything, its just the base gamemode....
You need to execute server.cfg had same error
[QUOTE=Zzz_Gamer_zzZ;44094992]You need to execute server.cfg had same error[/QUOTE] Uh, that has nothing to do with lua.
Though this isn't in the right section, I'd say that you should add a hook that prints a message when players connect.. Or is that server sided? Anyways, even if that doesn't work, try to just put this somewhere after the includes: print("...") EDIT: Also you could possibly make a cvar and then force client to do the cvar "say Hello!" when they join.
[QUOTE=TRMayhem;44103584]Though this isn't in the right section, I'd say that you should add a hook that prints a message when players connect.. Or is that server sided? Anyways, even if that doesn't work, try to just put this somewhere after the includes: print("...") EDIT: Also you could possibly make a cvar and then force client to do the cvar "say Hello!" when they join.[/QUOTE] What is the objective of this?
Sorry, you need to Log In to post a reply to this thread.