Yeah i am trying to do the whole thing with the players name above there head when you look at them.
I have been looking around and can't find anything
[lua]
local function PlayerName(ply)
if not ply:Alive() then return end
local spot = ply:Eyespot()
spot.z = spot.z + 15
spot = spot:ToScreen()
draw.DrawText(ply:Nick(), "TargetID", spot.x + 1, spot.y + 1, Color(0, 0, 0, 255), 1)
draw.DrawText(ply:Nick(), "TargetID", spot.x, spot.y, Color(0, 0, 0, 255), 1)
end
[/lua]
Don't see why that shouldn't work.
An addition to his code up there ^
[lua]hook.Add("HUDPaint", "player_info_name_draw", function()
local ent = LocalPlayer():GetEyeTrace().Entity
if ent != nil and ValidEntity(ent) and ent:IsPlayer() then
PlayerName(ent)
end
end)[/lua]
That will draw text above the player you look at using zzaacckk's function.
Alright so in my cl_init.lua file i now have this
[lua]
local function PlayerName(ply)
if not ply:Alive() then return end
local spot = ply:Eyespot()
spot.z = spot.z + 15
spot = spot:ToScreen()
draw.DrawText(ply:Nick(), "TargetID", spot.x + 1, spot.y + 1, Color(0, 0, 0, 255), 1)
draw.DrawText(ply:Nick(), "TargetID", spot.x, spot.y, Color(0, 0, 0, 255), 1)
end
hook.Add("HUDPaint", "player_info_name_draw", PlayerName)
local ent = LocalPlayer():GetEyeTrace().Entity
if ent != nil and ValidEntity(ent) and ent:IsPlayer() then
PlayerName(ent)
end
end
[/lua]
I get a error on this line
[lua]
local ent = LocalPlayer():GetEyeTrace().Entity
[/lua]
cl_init.lua is clientside.
So replace ply with LocalPlayer
It works :) Thank you!
One more question, how do i remove the default one?
Default what? You need to be more explicit when asking questions.
[QUOTE=eNergizer;23894194]Default what? You need to be more explicit when asking questions.[/QUOTE]
When you holder your cross hair over a player where ever you aim it will show there name and health in yellow text. I want to remove that