All pastes #720799 Raw Edit

Chrispin's Mod Gamemode Lua

public lua v1 · immutable
#720799 ·published 2007-09-30 18:32 UTC
rendered paste body
cl_init.lua/*-------------------------------------------  Chrispin'sMod   ---------------------------------------------*/include( "shared.lua" )include( "testvgui.lua" )init.lua/*-------------------------------------  Chrispin'sMod  ---------------------------------------*/ AddCSLuaFile( "cl_init.lua" )AddCSLuaFile( "shared.lua" ) include( 'shared.lua' )include( 'teams.lua' )  function GM:PlayerInitialSpawn( ply ) timer.Create("InitialMessageAndSong", 2, 0, MessageAndSong, ply ) //to make sure that the song doesnt sound laggish            end  function MessageAndSong(ply)  //the timer runs once two seconds after the initial spawn of a player ply:ConCommand( "play cm/Hell_March_2" ) end function GM:PlayerLoadout( pl )         pl:GiveAmmo( 9, "grenade", true )         pl:Give( "weapon_stunstick" )        pl:Give( "weapon_frag" )        pl:Give( "weapon_physcannon" )        endshared.lua/*------------------------------------   Chrispin'sMod     by Chrispin-------------------------------------*/ GM.Name         = "Chrispin'sMod"GM.Author       = "Chrispin"GM.Email        = "redfaction@cox.net"GM.Website      = ""teams.lua//This will create the teams. //team:  (number,  name,  Color (r, g, b, a))team.SetUp (1, "Red", Color(255, 0, 0, 255))team.SetUp (2, "Blue", Color(0, 0, 255, 255)) function GM:PlayerSpawn(ply)    if table.Count(team.GetPlayers(1)) < table.Count(team.GetPlayers(2)) then   ply.SetTeam(1)elseif table.Count(team.GetPlayers(2)) < table.Count(team.GetPlayers(1)) then   ply.SetTeam(2)else local i = math.random(0,1)if i == 0 then   ply:SetTeam(1)else   ply:SetTeam(2)end   endend testvgui.luaif (CLIENT) then// end // you do not want to end here... function TestVGUI()        gui.EnableScreenClicker(true); // you want the cursor to be visible http://garrysmod.com/wiki/?title=Gui.EnableScreenClicker        local frame = vgui.Create("Frame");        frame:SetSize(200, 200);        frame:SetPos(100, 100);        frame:SetVisible(true);        frame:SetEnabled(true); // enable the panel http://garrysmod.com/wiki/?title=Panel.SetEnabled        frame:MakePopup();        frame:PostMessage("SetTitle", "text", "garrysmod.com");        local html = vgui.Create("HTML", frame);        html:SetPos(25, 25); // all positions in panels are based on their parent panels. (0,0) would be the top left corner of local variable frame        html:SetSize(150, 150);        html:SetVisible(true);        html:MakePopup();        html:OpenURL("http://www.garrysmod.com");        local closeButton = vgui.Create("Button", frame);        closeButton:SetSize(30, 20);        closeButton:SetPos(75, 90);        closeButton:SetText("Close");        closeButton:SetMouseInputEnabled(true); // make sure it is clickable http://garrysmod.com/wiki/?title=Panel.SetMouseInputEnabled        // making a DoClick function under initialize looks a little neater this way        closeButton.DoClick = (        function(closeButton) // self is now and argument called closeButton                closeButton:SetText("Closing..."); // understand that you'll never see this message and that the self object is not used here, closeButton replaces it                // timer.Simple(3); // the timer isn't linked to anything? timers are NOT like sleep() is c, timers link to functions and call them after a given time                frame:Remove();        end);end// add the concommand to the function TestVGUIconcommand.Add("testvgui", TestVGUI); end // you make the whole script clientside