[GMOD] Learning the GMOD ways.


It’s team.SetUp, not team.setUp

[lua]GM.Name = “Team Deathmatch | Encrypted Network | Testing Version”
GM.Author = “RickyBGamez | Encrypted Network”
GM.Email = “owner@encryptedgamingnetwork.com
GM.Website = “www.encryptedgamingnetwork.com
GM.Version = “1.0.0”

team.SetUp( 0, “Blue Team”, Color(0, 0, 255, 255) )
team.SetUp( 1, “Red Team”, Color(255, 0, 0, 255) )
team.SetUp( 2, “Spectators”, Color(255, 255, 255, 255) )
team.SetUp( 4, “Dev Team”, Color(0, 255, 0, 255) ) --This is just a team we will test about

function GM:Initialize()

self.BaseClass.Initialize( self )

end [/lua]

Yah thanks for the help! Switching to Lua is hard after coding Java for years xD Still use to doing aA from Java, but thanks again!

So the team.SetUp problem has been fixed, but I am still getting the other one. Looked around, and still dont understand whats causing it, can anyone help with that one? The code is still the same, except for the shared.lua “team.setUp” which was changed to “team.SetUp”. Thanks

[ERROR] gamemodes/tdm/gamemode/player.lua:26: attempt to index a nil value

  1. GiveGamemodeWeapons - gamemodes/tdm/gamemode/player.lua:26
  2. unknown - gamemodes/tdm/gamemode/init.lua:23

function ply:GiveGamemodeWeapons()
local n = self:Team()

** for k, wep in pairs(teamselect[n].weapons) do**

The bolded part above is the line I am getting the error from: “[ERROR] gamemodes/tdm/gamemode/player.lua:26: attempt to index a nil value”

“attempt to index a nil value” means teamselect[n] is nil but you’re trying to access it like a table

you misspelled GM:InitialPlayerSpawn() so the player’s team is still TEAM_UNASSIGNED which is 1001 or something, which isn’t in your teamselect table

Ok thank you! Quick question, in my server start command I have the gamemode set to the gamemode Im making, yet it goes to Sandbox. Would you happen to know why?

if you’re talking about srcds, post the console scrollback after you start the server

Never mind I got it fixed, seemed like I had enter a bad argument making the server not start with the gamemode.