I have tried multiple youtube videos and the code that they have provided do not seem to work for me and do not color the player. I would like a way to implement this for the team based gamemode I am creating.
Init
[CODE]AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
include("player.lua")
function GM:PlayerConnect( name, ip )
print("Player: " .. name .. ", has joined the game.")
end
function GM:PlayerInitialSpawn( ply )
print("Player: " .. ply:Nick() .. ", has spawned.")
end
function GM:PlayerAuthed( ply, steamID, uniqueID )
print("Player: " .. ply:Nick() .. ", has gotten authed.")
end
function GM:PlayerSpawn(ply)
ply:SetModel("models/player/leet.mdl")
if ply:Team(1) then
end
local teamID = math.random( 1, 2)
ply:SetTeam(teamID)
RED = team.NumPlayers( 1 )
BLUE = team.NumPlayers( 2 )
if RED > BLUE then
ply:SetTeam(2)
elseif BLUE > RED then
ply:SetTeam(1)
end
end
[/CODE]
[CODE]GM.Name = "Skeleton" // Put Gamemode info here
GM.Author = "N/A"
GM.Email = "N/A"
GM.Website = "N/A"
team.SetUp( 0, "Team Red", Color(0, 0, 255) )
team.SetUp( 1, "Team Blue", Color(255, 0, 0) )
function GM:Initialize()
self.BaseClass.Initialize( self )
end
[/CODE]
I swear this has already been asked this week?
[URL="http://wiki.garrysmod.com/page/Player/SetPlayerColor"]Player/SetPlayerColor[/URL]
Sorry, you need to Log In to post a reply to this thread.