Starting a game mode, confused on one thing

I’m a little confused as to how this “GM” stuff works.

I’ve looked through the tutorials and it tells me i shouldn’t use GM up to a certain point, but I’m wondering what that point is and I’m also wondering how i handle that stuff after.

This is my init.lua
[lua]DeriveGamemode(‘sandbox’)

AddCSLuaFile(‘cl_init.lua’)
AddCSLuaFile(‘shared.lua’)
AddCSLuaFile(‘gm_team.lua’)
AddCSLuaFile(‘gm_hooks.lua’)
AddCSLuaFile(‘gm_advanceddmg.lua’)
AddCSLuaFile(‘gm_resources.lua’)

include(‘shared.lua’)
include(‘gm_team.lua’)
include(‘gm_hooks.lua’)
include(‘gm_advanceddmg.lua’)
include(‘gm_resources.lua’)[/lua]

I have this in a file called “gm_hooks.lua”

[lua]function GM:GetGameDescription()
return GM.Name
end[/lua]

It’s telling me “GM” is nil and spamming me with that. Just wondering what to do here. I think it might be referring to the “GM.Name” in which case that’s also odd, since i see people setting up global variables in that as well for other uses (some script define ownable door related data in GM, money related data, etc.)

[editline]23rd April 2011[/editline]

Figured this out, BTW, GM is removed later and turned into GAMEMODE as the tutorial stated, but when i tried to fix it before i also changed the GM in the function.

GAMEMODE:GetGameDescription

which is wrong

should look like this

[lua]function GM:GetGameDescription()
return GAMEMODE.Name;
end[/lua]

GM is defined only while loading so GM works in declaring functions like GM:GetGameDescription() but inside the function it’s not defined. Just return a string with your gamemode’s name like
[lua]
function GM:GetGameDescription()
return “MyGameMode”
end
[/lua]

or (just tried this)
[lua]

function GM:GetGameDescription()
return GAMEMODE.Name
end
[/lua]

Yeah i ended up just using GAMEMODE within the context of the function as i stated in my [edited] post, thanks though :downs: