• Team seat up on each different map
    8 replies, posted
Hey guys. So i really need help with setting up the teams for my gamemode. So for some maps i want to be just one team like free for all(just 1 team), and for other maps 2 teams like team deathmatch. If anybody could help me with this. It would be great. Best regards, Žiga
[lua] local maps = { gm_flatgrass = "TDM", gm_construct = "FFA" } function GM:CreateTeams() if maps[game.GetMap()] == "TDM" then -- Team Deathmatch teams elseif maps[game.GetMap()] == "FFA" then -- Free For All teams end end[/lua] Allows for infinite map and gametype expansion.
[CODE] if maps[game.GetMap()] == "TDM" then[/CODE] Can you explain the [game.GetMap()] part I do not fully understand. Specifically the "[ and the ]"
game.GetMap() returns the name of the current map, so we're searching the table for the key of the current map and it returns the value. The square brackets contain the key. [lua] local example = { 1 = "One", 2 = "Two" } print(example[1], example[2]) -- Prints "One" and "Two" [/lua]
[QUOTE=Jarva;45833096]game.GetMap() returns the name of the current map, so we're searching the table for the key of the current map and it returns the value. [lua] local example = { 1 = "One", 2 = "Two" } print(example[1], example[2]) -- Prints "One" and "Two" [/lua][/QUOTE] I see!
Tnx jarva one question i have team set up like this how can i set them like you said TDM and FFA. team.SetUp( 1, "Red", Color( 238, 0, 0 ) ) team.SetUp( 2, "Blue", Color( 30, 144, 255 ) ) team.SetUp( 3, "Cookies", Color( 30, 144, 255 ) ) 1 and 2 is TDM and 3 is FFA
[lua] function GM:CreateTeams() if maps[game.GetMap()] == "TDM" then team.SetUp( 1, "Red", Color( 238, 0, 0 ) ) team.SetUp( 2, "Blue", Color( 30, 144, 255 ) ) elseif maps[game.GetMap()] == "FFA" then team.SetUp( 3, "Cookies", Color( 30, 144, 255 ) ) end end [/lua]
Tnx man. Do you have skype i have a question for you if you dont mind adding you.
You can add me on steam by clicking the icon under my name if you want and I'll answer any questions I can.
Sorry, you need to Log In to post a reply to this thread.