Hey peoples, im making a gamemode myself and im having a bit of a problem.
When starting the mode on a server, as soon as a player spawns, they should get a VGUI popup with the choices to choose red team or blue team. this VGUI does NOT pop up. players have to type team_menu in their console to get the thing to start up. the weirdest thing is, it works fine in singleplayer! the only thing i could see wrong is that im not telling it that the CLIENT needs to do this on startup since in singleplayer, you are considered the server AND client. so thats why its working in single.
The VGUI popup had two buttons. one for red, one for blue
Blue team is team_blue
red team is team_red
The command to open the VGUI is team_menu
This is my INIT file where im pretty sure this is all going wrong
---------------------------------------------------------
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
AddCSLuaFile( "ephud.lua" )-- HUD file
include( 'shared.lua' )
resource.AddFile("materials/client/quarter256.vmt")
resource.AddFile("materials/client/quarter256c.vmt")
resource.AddFile("materials/client/quarter256h.vmt")
resource.AddFile("materials/client/triangle256.vmt")
resource.AddFile("materials/client/needle256.vmt")
resource.AddFile("materials/client/piemenu.vmt")
function GM:PlayerInitialSpawn( ply )
RunConsoleCommand( "team_menu" )-- works in single, but not multi!
--D:
end
function GM:PlayerLoadout( ply ) -- This works fine.
ply:StripWeapons()
if ply:Team() == 1 then
ply:Give( "weapon_pistol" )
ply:GiveAmmo(999999, "Pistol")
elseif ply:Team() == 2 then
ply:Give( "weapon_pistol" )
ply:GiveAmmo(999999, "Pistol")
end
end
function team_blue( ply )
ply:SetTeam( 1 )
ply:Spawn()
end
function team_red( ply )
ply:SetTeam( 2 )
ply:Spawn()
end
concommand.Add( "team_blue", team_blue )
concommand.Add( "team_red", team_red )
function GAMEMODE:PlayerSelectSpawn( ply )-- Map i made didnt
--see "info_player_blue/red" as a spawnpoint for some dumb reason
if ply:Team() == team_blue then
local spawns = ents.FindByClass( "info_player_blue" )
local randomspawn = math.random(#spawns)
return spawns[randomspawn]
elseif ply:Team() == team_red then
local spawns = ents.FindByClass( "info_player_red" )
local randomspawn = math.random(#spawns)
return spawns[randomspawn]
end
end
)
--------------------------------------------------------------------------
ANY help would be greatly appreciated!
Sorry, you need to Log In to post a reply to this thread.