Hi.
I'm creating a gamemode for Gmod but I'm having problems with teams.
If I set the team of a player to 3 in the init.lua file and then I try to print it in any clientside file:
print(LocalPlayer():Team())
It returns back 1001 and other weird numbers.
Here's my shared.lua file:
GM.Name = "Stalkers"
GM.Author = "iKebab897"
GM.TeamBased = true
DeriveGamemode( "base" )
local TEAM_GUEST, TEAM_SPEC, TEAM_SURV, TEAM_STALK = 0, 1, 2, 3
team.SetUp( 0, "Guests", Color( 35, 35, 35 ), true )
team.SetUp( 1, "Spectators", Color( 0, 125, 125 ), true )
team.SetUp( 2, "Survivors", Color( 0, 0, 125 ), true )
team.SetUp( 3, "Stalkers", Color( 125, 0, 0 ), true )
function GM:Initialize()
self.BaseClass.Initialize( self )
PrintMessage( HUD_PRINTTALK, "Welcome to STALKERS!" .. "\n" .. "Gamemode created by iKebab897" )
end
util.PrecacheModel( "models/player/soldier_stripped.mdl" )
util.PrecacheModel( "models/player/zombie_classic.mdl" )
util.PrecacheModel( "models/player/zombie_fast.mdl" )
util.PrecacheModel( "models/player/zombie_soldier.mdl" )
util.PrecacheModel( "models/player/odessa.mdl" )
util.PrecacheModel( "models/player/mossman_arctic.mdl" )
util.PrecacheModel( "models/player/Group03/female_04.mdl" )
util.PrecacheModel( "models/player/Group01/male_01.mdl" )
util.PrecacheModel( "models/player/Group01/male_05.mdl" )
util.PrecacheModel( "models/player/Group01/male_07.mdl" )
util.PrecacheModel( "models/player/Group03/male_09.mdl" )
hook.Add( "PlayerFootstep", "Stalkers", function( ply )
if ply:GetNWBool( "inv", false ) == true then
return true
end
end )
Well i tried recreating this but i successfully get 3 printed in the console.
But i have one question.
Do you have this line in your init.lua?
'AddCSLuaFile("shared.lua")'
btw team 1001 is Unassigned and team 1002 is Spectator so you probably should remove them
Also there are my files:
https://files.facepunch.com/forum/upload/469093/d7a09f3c-8b7d-4cc0-8372-6cd5d57d8f4c/Code_lTO5WLRPro.png
https://files.facepunch.com/forum/upload/469093/5a546f91-866b-4386-a104-cb69afe98a33/Code_k0yO0WXybd.png
https://files.facepunch.com/forum/upload/469093/34e5cae1-f659-4546-a2b2-8c3b68df46d3/Code_5I4mPVEG9H.png
Sorry, you need to Log In to post a reply to this thread.