• Text that follows an entity with actual code!
    0 replies, posted
Hey guys so I asked before how I would achieve text over an ent that follows the user's eyes for my printers. I now wrote code, but it won't run. *There are no errors* However, the code is simply not executing. I am running this clientsided in luapad. Here is the code: [CODE] local printalpha = 0 local ptype local pcolor local owner local amt local isPrinter local function showPrinterInfo() local tr = LocalPlayer():GetEyeTrace() local ent = tr.Entity if not ent:IsValid() then if printalpha > 0 then printalpha = printalpha - 0.02 else return end end local dist = ent:GetPos():Distance( LocalPlayer():GetPos() ) if dist > 200 then if printalpha > 0 then printalpha = printalpha - 0.02 else return end end if ent:GetClass() == "vrondakis_printer" then ptype = ent:GetNWString('PrinterName', 'Unknown') pcolor = Color(0, 255, 0, 255) isPrinter = true isPrinter = false if printalpha > 0 then printalpha = printalpha - 0.02 elseif printalpha == 0 then return end end local owner = ent:Getowning_ent() if ent:IsValid() and isPrinter and dist < 200 then owner = (IsValid(owner) and owner:Nick()) or DarkRP.getPhrase("unknown") amt = ent:GetNWInt('MoneyAmount') if printalpha < 1 then printalpha = printalpha + 0.02 end end local x, y = ScrW()/2 , ScrH()/2 pcolor = Color( pcolor.r, pcolor.g, pcolor.b, pcolor.a*printalpha ) draw.RoundedBox( 8, x-100, y-50, 200, 100, Color( 120, 120, 120, 200*printalpha ) ) draw.SimpleTextOutlined(ptype, "HUDNumber5", x,y-40,pcolor,TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM, 2, Color(0,0,0,155*printalpha)) draw.SimpleTextOutlined(owner, "HUDNumber5", x,y-15,pcolor,TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM, 2, Color(0,0,0,155*printalpha)) draw.SimpleTextOutlined("$" .. amt, "HUDNumber5", x,y+10,pcolor,TEXT_ALIGN_CENTER, TEXT_ALIGN_BOTTOM, 2, Color(0,0,0,155*printalpha)) end hook.Add( "HUDDrawTargetID", "showPrinterInfo", showPrinterInfo ) [/CODE] -Thanks in advanced for all help!
Sorry, you need to Log In to post a reply to this thread.