Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if CLIENT then
- local META = FindMetaTable("Player")
- function META:Team()
- return self._team_id or 0
- end
- function META:SetTeam(id)
- self._team_id = tonumber(id) or 0
- end
- local teams =
- {
- {
- name = "nearby",
- check = function(ply)
- return ply:EyePos():Distance(LocalPlayer():EyePos()) < 1000
- end,
- },
- {
- name = "friends",
- check = function(ply)
- return ply:IsFriend(LocalPlayer())
- end,
- },
- }
- local base_id = 1589
- local h,s,v = ColorToHSV(Color(68, 112, 146))
- team.SetUp(base_id, "players", HSVToColor(h, s, v))
- timer.Create("auto_teams", 1, 0, function()
- for _, ply in pairs(player.GetAll()) do
- if ply == LocalPlayer() then
- ply:SetTeam(base_id)
- continue
- end
- local changed = false
- for id, data in pairs(teams) do
- if data.check(ply) then
- team.SetUp(base_id + id, data.name, HSVToColor(util.CRC(data.name)%360, s, v))
- ply:SetTeam(base_id + id)
- changed = true
- end
- end
- if not changed then
- ply:SetTeam(base_id)
- end
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment