Ok, so I made a VERY simple gamemode based off one of the lua tutorials. It works fine in single player with the choose team menu popping up on spawn. However in multiplayer on my server it just wont run that one console command to bring up the menu and I have to run the command manually in the console which works fine. Theres no lua errors so whats the problem?
Heres the init.lua:
[lua]
AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )
AddCSLuaFile( “cl_run.lua” )
include( ‘shared.lua’ )
include( ‘shared.lua’ )
function GM:PlayerSpawn( ply )
self.BaseClass:PlayerSpawn( ply ) change
ply:SetGravity( 1 )
ply:SetMaxHealth( 100, true )
ply:SetWalkSpeed( 500 )
ply:SetRunSpeed( 600 )
ply:SetJumpPower( 400 )
end
function GM:PlayerInitialSpawn( ply )
joining( ply )
RunConsoleCommand( “set_team” )
end
function GM:PlayerLoadout( ply )
if ply:Team() == 1 then
ply:Give( "weapon_physcannon" )
elseif ply:Team() == 2 then
ply:Give( "weapon_physcannon" )
end
end
function sb_team1( ply )
ply:UnSpectate()
ply:SetTeam( 1 )
ply:Spawn()
end
function sb_team2( ply )
ply:SetTeam( 2 )
ply:Spawn()
end
concommand.Add( “sb_team1”, sb_team1 )
concommand.Add( “sb_team2”, sb_team2 )
function joining( ply )
ply:Spectate( 5 )
ply:SetTeam( 3 )
end
[/lua]
and heres the cl_init.lua
[lua]
include( ‘shared.lua’ )
function set_team()
local ChooseFrame = vgui.Create( “DFrame” )
ChooseFrame:SetPos( 50,50 )
ChooseFrame:SetSize( 420, 440 )
ChooseFrame:SetTitle( “Choose Team” )
ChooseFrame:SetVisible( true )
ChooseFrame:SetDraggable( true )
ChooseFrame:ShowCloseButton( true )
ChooseFrame:MakePopup()
local BlueButton = vgui.Create( “DButton”, ChooseFrame )
BlueButton:SetText( “Team Blue” )
BlueButton:SetPos( 10, 40 )
BlueButton:SetSize( 85, 20 )
BlueButton.DoClick = function ()
RunConsoleCommand( “sb_team2” )
end
local RedButton = vgui.Create( “DButton”, ChooseFrame )
RedButton:SetText( “Team Red” )
RedButton:SetPos( 10, 70 )
RedButton:SetSize( 85, 20 )
RedButton.DoClick = function ()
RunConsoleCommand( “sb_team1” )
end
end
concommand.Add( “set_team”, set_team )
[/lua]
any ideas? and for the record, it happens to other players on my server and ive tried removing all my addons and gamemodes so the chances of it being a conflict are very low. I have tried a lot of things, so dont flame me.