PlayerSpawn Help

Hello! I need someone to help me with this one. So the code is


function GM:PlayerSpawn( ply )
	if ply:Team() == 1 then
	    ply:Give("weapon_crowbar")
		ply:SetModel("models/player/alyx.mdl")
	end
	if ply:Team() == 2 then
	    ply:Give("weapon_crowbar")
		ply:SetModel("models/player/gman_high.mdl")
	end
	if ply:Team() == 3 then
	    ply:Give("weapon_crowbar")
		ply:SetModel("models/player/monk.mdl")
	end
end


local maps = {
    gm_flatgrass = "TDM",
    gm_construct = "FFA"
}

Team 1 and 2 has to spawn on maps TDM, and team 3 just on FFA.

shared.lua


function GM:CreateTeams()
    if maps[game.GetMap()] == "TDM" then
        -- Team Deathmatch teams
    elseif maps[game.GetMap()] == "FFA" then
        -- Free For All teams
    end
end

What exactly do you want? Are you getting any errors? You haven’t explained anything, all you did was provide code?

Well as i said. I have gamemode set up as TDM maps and FFA maps. So when there is a map pick, and plyers pick the map which is configured as a TDM there will be team 1 team 2 on that map(TDM team1 and team2) and (FFA team3). So basiclly now is set up so every team spawns, but i want like i said team 1 and team 2 for TDM and team 3 for FFA. I hope you understand.

[editline]15th October 2014[/editline]

Not getting any errors

PlayerSpawn should only handle spawning. PlayerSetModel should only handle setting the player model. PlayerLoadout should be used for giving weapons to players. The last 2 should be hook.Call’ed from within PlayerSpawn. Refer to the base gamemode to see how PlayerSpawn should be set up.

When you create a team, just create a global reference…

TEAM_BLAH = teams.SetUp… Those should be in the GM Hook CreateTeams, as you’ve correctly identified.

Although, I’m not quite sure what you were asking, so I hope this is sufficient.