Hi i was wondering if anyone could edit this files so it shows the time left when u look at the model instead of just highlighting when finished?
[CODE]
include('shared.lua')
/*---------------------------------------------------------
Name: DrawTranslucent
Desc: Draw translucent
---------------------------------------------------------*/
function ENT:Draw()
if (LocalPlayer():GetEyeTrace().Entity == self.Entity and LocalPlayer():GetShootPos():Distance(self.Entity:GetPos()) < 512) and self.SpawnTime + self.GrowthTime < CurTime() then
self:DrawEntityOutline( 1.1 )
end
self:DrawModel();
end
function ENT:Initialize ( )
self.SpawnTime = CurTime();
end
local matOutlineWhite = Material( "white_outline" )
local ScaleNormal = Vector()
local ScaleOutline1 = Vector() * 1
local ScaleOutline2 = Vector() * 1.1
local matOutlineBlack = Material( "black_outline" )
function ENT:DrawEntityOutline( size )
size = size or 1.0
render.SuppressEngineLighting( true )
render.SetAmbientLight( 1, 1, 1 )
render.SetColorModulation( 1, 1, 1 )
// First Outline
self:SetModelScale( ScaleOutline2 * size )
SetMaterialOverride( matOutlineBlack )
self:DrawModel()
// Second Outline
self:SetModelScale( ScaleOutline1 * size )
SetMaterialOverride( matOutlineWhite )
self:DrawModel()
// Revert everything back to how it should be
SetMaterialOverride( nil )
self:SetModelScale( ScaleNormal )
render.SuppressEngineLighting( false )
local r, g, b = self:GetColor()
render.SetColorModulation( r/255, g/255, b/255 )
end
[/CODE]
Thanks!
i swear to god we need a sub forum JUST for perp stuff.
i made this script for someone who wanted the same thing (probably you :D) but its untested and i dont remember if i finished it but its a start if nothing else
[lua]if (!CLIENT) then return; end
// localization
local ents = ents;
local draw = draw;
local pos;
local time;
local minutes, seconds;
local function DrawInfo(ent_class)
for k,v in pairs(ents.FindByClass(ent_class)) do
if (LocalPlayer():GetEyeTrace().Entity == v && LocalPlayer():GetPos():Distance(v:GetPos()) <= 256) then
// Draw the Timer!
time = (v.SpawnTime + v.GrowTime) - CurTime();
pos = v:OBBCenter();
seconds = time % 60;
minutes = math.floor(time / 60) % 60;
if (seconds < 10) then
seconds = "0" .. seconds;
end
draw.SimpleText(minutes .. ":" .. seconds, "default", pos.x, pos.y, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER);
end
end
end
hook.Add("HUDPaint", "DrawDrugTimers", function()
// Find Weed
DrawInfo("ent_pot");
// Find Meth
DrawInfo("ent_item");
// Find Concaine
DrawInfo("ent_coca");
end)
[/lua]
Sorry, you need to Log In to post a reply to this thread.