• Make A Team Select Menu (Huge Noob)
    2 replies, posted
I'm working on a gamemode, I'm very new to lua, and I was wondering how I could make a menu to choose a team. Also, I would like to make it so the gamemode auto-assigns you when you join, but you can change. I made two teams and made them spawn with a weapon but when you start, you have no weapons so I'm guessing you don't have a team. Here are the files: [B]shared.lua[/B] [CODE] GM.Name = "OilDrum Wars Gamemode" GM.Author = "Swirlyman" GM.Email = "stevenflannigan@gmail.com" GM.Website = "http://plabworld.com/" --Bases gamemode off sandbox DeriveGamemode( "sandbox" ) -- Teams team.SetUp( 1, "Team A", Color( 0, 0, 255, 255 ) ) team.SetUp( 2, "Team B", Color( 178, 34, 34, 255 ) ) function GM:Initialize() self.BaseClass.Initialize( self ) end [/CODE][B] cl_init.lua[/B] [CODE]include( 'shared.lua' ) // Clientside only stuff goes here[/CODE][B]init.lua[/B] [CODE] AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) include( 'shared.lua' ) function GM:PlayerSpawn( ply ) self.BaseClass:PlayerSpawn( ply ) --Fixes some bugs ply:SetGravity( 0.3 ) ply:SetMaxHealth( 125, true ) ply:SetWalkSpeed( 375 ) ply:SetRunSpeed( 575 ) end function GM:PlayerLoadout( ply ) if ply:Team() == 1 then ply:Give( "oildrum_launcher" ) -- OilDrum Launcher ply:Give( "weapon_physcannon" ) -- Gravity Gun elseif ply:Team() == 2 then ply:Give( "oildrum_launcher" ) -- OilDrim Launcher ply:Give( "weapon_physcannon" ) -- Gravity Gun end end function GM:PlayerInitialSpawn( ply ) self.BaseClass:PlayerInitialSpawn( ply ) --Fixes some bugs if ply:IsAdmin() then ply:PrintMessage( HUD_PRINTTALK, "ODWars: Welcome, admin!" ) end end function plymodels( ply ) if ply:Team() == 1 then ply:SetModel( "models/player/combine_soldier.mdl" ) elseif ply:Team() == 2 then ply:SetModel( "models/player/combine_super_soldier.mdl" ) end end function GM:PlayerNoclip( ply ) if ply:IsSuperAdmin() then return true -- Noclip on for SuperAdmin else return false -- Noclip off for players. end end function GM:CanPlayerSuicide( ply ) return false end function GM:PlayerSpray( ply ) return false end [/CODE]Any help is appreciated, thanks!
on the server make a console command that sets players team [b][url=http://wiki.garrysmod.com/?title=Player.SetTeam]Player.SetTeam [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] example on link Then for derma just make a button that runs the console command on click [url]http://wiki.garrysmod.com/?title=Guide_to_Derma[/url]
Great, thanks!
Sorry, you need to Log In to post a reply to this thread.