DeriveGamemode problem.

I have decided to make a very basic gamemode just to test script’s, When I came across a little problem. I added DeriveGamemode(“sandbox”) inside the server init.lua so I could have the sandbox Q menu, but when I go into the server all I get is a black physgun and no Q menu.

Errors:
No errors.
Script:
[LUA]DeriveGamemode(“sandbox”)
AddCSLuaFile(“shared.lua”)
AddCSLuaFile(“cl_init.lua”)
include(“cl_init.lua”)
include(“shared.lua”)[/LUA]

Try adding this



function GM:SpawnMenuEnabled()

	return true
	
end

function GM:SpawnMenuOpen()

	return true
	
end


In shared.lua, if the problem still continues, try adding DeriveGamemode( “sandbox” ) in shared.lua instead of init. I’ve never had a problem with this, I’m not sure if it’s a client/server problem

Every gamemode I’ve messed around with made, I’ve placed the DeriveGamemode code inside shared.lua, so as the person above me suggests, that might help a bit, too.

I tried adding the DeriveGamemode( “sandbox” ) to my shared.lua no luck then I continued to try the SpawnMenuEnable no luck either. Do you think it might be a server error?

Make sure your text file sets the base to sandbox. I just tested it and it’s working.

This is my lokigamemode.txt
[LUA]“lokigamemode”
{
“base” “sandbox”
“title” “lokigamemode”
“menusystem” “1”
}[/LUA]
this is my shared.lua
[LUA]GM.Name = “LokiGamemode”
GM.Author = “”
GM.Email = “Loki6112@gmail.com
GM.Website = “”
DeriveGamemode( “sandbox” )[/LUA]

Add the functions from Post #2 : http://forum.facepunch.com/showthread.php?t=1291542&p=41532288&viewfull=1#post41532288

below DeriveGamemode. Also, your text file is the same name as the folder-name of the game-mode, correct?

Yes it’s the same, and I added that under DeriveGamemode still get a black phsygun in game and no Q menu.

Are you hooking into PlayerBindPress and returning true on +menu anywhere in your game-mode? Are you calling SetWeaponColor anywhere in your game-mode?

cl_init.lua
[LUA]surface.CreateFont(“LokiHud”, {
font = “default”,
size = 22
})
hook.Add(“HUDPaint”, “paintme”, function()
draw.DrawText("Health: "…math.Clamp(LocalPlayer():Health(), 0, 100), “LokiHud”, ScrW() - 1539, ScrH() - 889, Color(255, 0, 0, 255),TEXT_ALIGN_CENTER)
end)[/LUA]

Init.lua
[LUA]AddCSLuaFile(“shared.lua”)
AddCSLuaFile(“cl_init.lua”)
include(“cl_init.lua”)
include(“shared.lua”)
hook.Add(“PlayerAuthed”, “joined”, function(ply)
ply:SendLua(“chat.AddText(Color(255,0,0,255), ‘COLOR_RED’, Color(0,255,255), ‘diffrent color’)”)
end)[/LUA]

shared.lua
[LUA]GM.Name = “LokiGamemode”
GM.Author = “Loki611”
GM.Email = “Loki6112@gmail.com
GM.Website = “”
DeriveGamemode( “sandbox” )
function GM:SpawnMenuEnabled()

return true

end

function GM:SpawnMenuOpen()

return true

end[/LUA]

cl_init.lua




include("shared.lua")

surface.CreateFont("LokiHud", {    font = "default",    size = 22})hook.Add("HUDPaint", "paintme", function()    draw.DrawText("Health: "..math.Clamp(LocalPlayer():Health(), 0, 100), "LokiHud", ScrW() - 1539, ScrH() - 889, Color(255, 0, 0, 255),TEXT_ALIGN_CENTER)end)

Init.lua




AddCSLuaFile("shared.lua")AddCSLuaFile("cl_init.lua")include("shared.lua")hook.Add("PlayerAuthed", "joined", function(ply)    ply:SendLua("chat.AddText(Color(255,0,0,255), 'COLOR_RED', Color(0,255,255), 'diffrent color')")end)

shared.lua




GM.Name     = "LokiGamemode"GM.Author     = "Loki611"GM.Email     = "Loki6112@gmail.com"GM.Website     = ""DeriveGamemode( "sandbox" )function GM:SpawnMenuEnabled()    return true    end

Untested, should work.

[editline]20th July 2013[/editline]

Aaaand Facepunch fucked up new lines again.

Why is it always only you and new lines? I’ve never seen it happen to anyone else.

I don’t know, am I cursed?

Just an update, I decided to try re downloading the server file’s with SteamCMD just to see if that was the problem and still got a black physgun and no Q menu ingame.

Wow do I feel dumb, I didn’t include my shared file to my client file, this is now solved thank you all for your help.