Ulysses Stuff > Ulysses Release Archives

Player Title II - Name and Title Display

<< < (8/9) > >>

LuaTenshi:

--- Quote from: lavacano201014 on September 08, 2012, 01:47:49 AM ---I'm not sure what you're after here, are you wanting the title to appear in the chatbox? Because that's not the intent of this addon. It's supposed to hover over your head when another player looks at you.

--- End quote ---

I think you should add that as an option and allow it to be custom, set by an admin, or just the persons rank. In addition this should also have some settings like changing if people can see the name through a wall or the ability to change at what distance the names fade away. You know server side vars and may be more client side vars?

nexbr:
Can you create two cvars?

1. Server Side like sv_playertitle_enable 1/0
2. Client Side like cl_playertitle_enable 1/0

Then we can disable the player title to all players or just for me.

Because sometime you want spy some players but the flying title are not stealthy !  ;)

datgregofag:
Hi, how can i change it so that when a person dies it doesn't show the title, i have a ttt server and when someone dies their title still floats around.

krooks:

--- Quote from: datgregofag on February 12, 2013, 03:49:28 PM ---Hi, how can i change it so that when a person dies it doesn't show the title, i have a ttt server and when someone dies their title still floats around.

--- End quote ---

I think when I get some time, I will be adding this to my server. So I'll fix it and give the code when I do (unless someone beats me to it). I would give instructions on how to do it, but I'm not good enough at lua for that, so it will take tinkering :P

MrPresident:
cl_playertitle.lua

Replace the code in this file with this


--- Code: ---//Config

// Names enabled?
local enablenames = true

// Titles enabled?
local enabletitles = true

// How to align the text?
// 0 = left
// 1 = center
// 2 = right
local textalign = 1

// Distance multiplier. The higher this number, the further away you'll see names and titles.
local distancemulti = 2

////////////////////////////////////////////////////////////////////
// Don't edit below this point unless you know what you're doing. //
////////////////////////////////////////////////////////////////////

function DrawNameTitle()

local vStart = LocalPlayer():GetPos()
local vEnd

for k, v in pairs(player.GetAll()) do

if not v:Alive() then continue end

local vStart = LocalPlayer():GetPos()
local vEnd = v:GetPos() + Vector(0,0,40)
local trace = {}

trace.start = vStart
trace.endpos = vEnd
local trace = util.TraceLine( trace )

if trace.HitWorld then
--Do nothing!
else
local mepos = LocalPlayer():GetPos()
local tpos = v:GetPos()
local tdist = mepos:Distance(tpos)

if tdist <= 3000 then
local zadj = 0.03334 * tdist
local pos = v:GetPos() + Vector(0,0,v:OBBMaxs().z + 5 + zadj)
pos = pos:ToScreen()

local alphavalue = (600 * distancemulti) - (tdist/1.5)
alphavalue = math.Clamp(alphavalue, 0, 255)

local outlinealpha = (450 * distancemulti) - (tdist/2)
outlinealpha = math.Clamp(outlinealpha, 0, 255)

local playercolour = team.GetColor(v:Team())
local playertitle = v:GetNetworkedString("title")

if ( (v != LocalPlayer()) and (v:GetNWBool("exclusivestatus") == false) ) then
if (enablenames == true) then
draw.SimpleTextOutlined(v:Name(), "TargetID", pos.x, pos.y - 10, Color(playercolour.r, playercolour.g, playercolour.b, alphavalue),textalign,1,2,Color(0,0,0,outlinealpha))
end
if (not (playertitle == "")) and (enabletitles == true) then
draw.SimpleTextOutlined(playertitle, "Trebuchet18", pos.x, pos.y + 6, Color(255,255,255,alphavalue),textalign,1,1,Color(0,0,0,outlinealpha))
end
end
end
end
end
end

hook.Add("HUDPaint", "DrawNameTitle", DrawNameTitle)

--- End code ---

All I did was add an alive check to the player to decide if the title should be drawn above their head. 1 line of code.


if not v:Alive() the continue end

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version