mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
70
gamemodes/base/gamemode/cl_targetid.lua
Normal file
70
gamemodes/base/gamemode/cl_targetid.lua
Normal file
@@ -0,0 +1,70 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
Name: gamemode:HUDDrawTargetID( )
|
||||
Desc: Draw the target id (the name of the player you're currently looking at)
|
||||
-----------------------------------------------------------]]
|
||||
function GM:HUDDrawTargetID()
|
||||
|
||||
local tr = util.GetPlayerTrace( LocalPlayer() )
|
||||
local trace = util.TraceLine( tr )
|
||||
if ( !trace.Hit ) then return end
|
||||
if ( !trace.HitNonWorld ) then return end
|
||||
|
||||
local text = "ERROR"
|
||||
local font = "TargetID"
|
||||
|
||||
if ( trace.Entity:IsPlayer() ) then
|
||||
text = trace.Entity:Nick()
|
||||
else
|
||||
--text = trace.Entity:GetClass()
|
||||
return
|
||||
end
|
||||
|
||||
surface.SetFont( font )
|
||||
local w, h = surface.GetTextSize( text )
|
||||
|
||||
local MouseX, MouseY = input.GetCursorPos()
|
||||
|
||||
if ( MouseX == 0 && MouseY == 0 || !vgui.CursorVisible() ) then
|
||||
|
||||
MouseX = ScrW() / 2
|
||||
MouseY = ScrH() / 2
|
||||
|
||||
end
|
||||
|
||||
local x = MouseX
|
||||
local y = MouseY
|
||||
|
||||
x = x - w / 2
|
||||
y = y + 30
|
||||
|
||||
-- The fonts internal drop shadow looks lousy with AA on
|
||||
draw.SimpleText( text, font, x + 1, y + 1, Color( 0, 0, 0, 120 ) )
|
||||
draw.SimpleText( text, font, x + 2, y + 2, Color( 0, 0, 0, 50 ) )
|
||||
draw.SimpleText( text, font, x, y, self:GetTeamColor( trace.Entity ) )
|
||||
|
||||
y = y + h + 5
|
||||
|
||||
-- Draw the health
|
||||
text = trace.Entity:Health() .. "%"
|
||||
font = "TargetIDSmall"
|
||||
|
||||
surface.SetFont( font )
|
||||
w, h = surface.GetTextSize( text )
|
||||
x = MouseX - w / 2
|
||||
|
||||
draw.SimpleText( text, font, x + 1, y + 1, Color( 0, 0, 0, 120 ) )
|
||||
draw.SimpleText( text, font, x + 2, y + 2, Color( 0, 0, 0, 50 ) )
|
||||
draw.SimpleText( text, font, x, y, self:GetTeamColor( trace.Entity ) )
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user