Hey I am creating a new Gamemode with me and a friend. Well I tried the tutorial on the wiki site. [url]http://wiki.garrysmod.com/?title=LUA:Gamemode_from_scratch[/url]
But when I go to Garry's mod the gamemode does not pop up or anything. Not even in the override. Anyone have any idea why? Also all my folders have no capitals and stuff. Plus I have a info.txt.
Shared
[code]
GM.Name = "Para Ball"
GM.Author = "Paragraf"
GM.Email = "N/A"
GM.Website = "www.k-guare.com"
DeriveGamemode( "base" )
team.SetUp( 1, "Team Blue", Color( 0, 0, 255, 255 ) )
team.SetUp( 2, "Team Orange", Color( 255, 125, 0, 255) )
[/code]
cl_init
[code]
function set_team()
local frame = vgui.Create( "DFrame")
frame.SetPos( ScrW() / 2, ScrH() /2 )
frame.SetSize( 200, 210 )
frame.SetTitle( "Change Team" )
frame:SetVisible( true )
frame:SetDraggable( false )
frame:ShowCloseButton( true )
frame:MakePopup()
team_1 = vgui.Create( "DButton", frame )
team_1:SetPos( frame:GetTall() / 2, 5 ) --Place it half way on the tall and 5 units in horizontal
team_1:SetSize( 50, 100 )
team_1:SetText( "Team 1" )
team_1.DoClick = function() --Make the player join team 1
RunConsoleCommand( "team_1" )
end
team_2 = vgui.Create( "DButton", frame )
team_2:SetPos( frame:GetTall() / 2, 105 ) --Place it next to our previous one
team_2:SetSize( 50, 100 )
team_2:SetText( "Team 2" )
team_2.DoClick = function() --Make the player join team 2
RunConsoleCommand( "team_2" )
end
end
concommand.Add( "team_menu", set_team )
[/code]
init
[code]
AddCSLuaFile( "cl_init.lua" ) --Tell the server to DL this file to the client
AddCSLuaFile( "Shared.lua" )
include( 'shared.lua' )
function GM:PlayerInitialSpawn( ply )
RunConsoleCommand( "team_menu" )
end
function GM:PlayerLoadout( ply ) --Weapon/ammo/item function
if ply:Team() == 1 then --If the player is in team 1
ply:Give( "weapon_physcannon" ) --Give them the Gravity Gun
ply:Spawn() -- Make the player respawn
elseif ply:Team() == 2 then --If the player is in team 2
ply:Give( "weapon_physcannon" ) --Give the player the Physics Gun
ply:Spawn() -- Make the player respawn
end --Here we end the if condition
end --Here we end the Loadout function
function team_1( ply )
ply:SetTeam( 1 )
end
function team_2( ply )
ply:SetTeam( 2 )
end
concommand.Add( "team_1", team_1 )
concommand.Add( "team_2", team_2 )
[/code]
info
[code]
"Gamemode"
{
"name" "para ball"
"version" "0.1"
"up_date" "11/05/2009" // The date this version was published. Set before release!
"author_name" "paragraf"
"author_email" "n/a"
"author_url" "www.paragraf.com"
"info" "Try and get the ball in the other teams goal post."
"hide" ""
"mappattern" // This sets all maps with gt_ before the name to default the map gamemode to "GM_test"
{
"1" "^mr_"
}
}
[/code]
[QUOTE=nerdygamer;18215971]
[code]frame.SetPos( ScrW() / 2, ScrH() /2 )
frame.SetSize( 200, 210 )
frame.SetTitle( "Change Team" )[/code][/QUOTE]
That bit should be :
[code]frame:SetPos( ScrW() / 2, ScrH() /2 )
frame:SetSize( 200, 210 )
frame:SetTitle( "Change Team" )[/code]
Since you're using methods.
But even that doesn't stop the gamemode from loading, are you sure you've placed it in the right folder, and restarted Garry's Mod after? :smile:
Edit : Oh and remove the player:Spawn() stuff inside PlayerLoadout! Actually do like in the tutorial, move it back to the console commands to change team.
[editline]12:50AM[/editline]
You might want to make them spectate when they join too. :ninja:
Sometimes the gamemode won't register unless you manually type the gamemode name into the gamemode selection box.
[editline]12:11AM[/editline]
Wait, why is my avatar david hasselhoff. So confused....
[QUOTE=Gbps;18217325]Sometimes the gamemode won't register unless you manually type the gamemode name into the gamemode selection box.
[editline]12:11AM[/editline]
Wait, why is my avatar david hasselhoff. So confused....[/QUOTE]
You think you're confused? When I saw mine I pulled the plug and ran a full spyware scan before changing my password to then see everyone's avatar had changed too. :ninja:
Apparently it's only for your posts.
[QUOTE=Gbps;18218046]Apparently it's only for your posts.[/QUOTE]
We got that avatar for having animated PNG's in our avatars, I think. If not, then who cares :V
Nope, didn't have a signature >_<
[QUOTE=Gbps;18218076]Nope, didn't have a signature >_<[/QUOTE]
I meant Avatars. Sorry :3
Sorry, you need to Log In to post a reply to this thread.