NPCshop OverHead Text

I’ve looked inside of DarkRP entities that spawn with a text on the front of them. I’ve done the exact same code on an npc that is started when my server starts, doesn’t work however. How would I get text to show up on top of my NPC that spawns automatically?

Cl_init:


include( 'shared.lua' )
 
ENT.RenderGroup = RENDERGROUP_BOTH

function ENT:Draw()
	self.Entity:DrawModel()
end


init:


AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )

include( 'shared.lua' )

	local tags = string.Explode(",", ( GetConVarString( "sv_tags" ) or "" ));
	
	for i, tag in ipairs(tags) do
		if (tag:find( "BDN" )) then
			table.remove(tags, i);
		end;
	end;
	
	table.insert(tags, "BDN");
	table.sort(tags);
	
	RunConsoleCommand("sv_tags", table.concat( tags, "," ));

function ENT:Initialize( )
	self:SetModel( "models/odessa.mdl" )
 	self:SetHullType( HULL_HUMAN )
	self:SetUseType( SIMPLE_USE )
	self:SetHullSizeNormal( )
	self:SetSolid( SOLID_BBOX )
	self:CapabilitiesAdd( CAP_MOVE_GROUND | CAP_OPEN_DOORS | CAP_ANIMATEDFACE | CAP_USE_SHOT_REGULATOR | CAP_TURN_HEAD | CAP_AIM_GUN )
	self:SetMaxYawSpeed( 5000 )
	local PhysAwake = self.Entity:GetPhysicsObject( )
	if PhysAwake:IsValid( ) then
		PhysAwake:Wake( )
	end 
end

function ENT:OnTakeDamage( dmg ) 
	return false
end

function ENT:AcceptInput( name, activator, caller )
    if ( name == "Use" && ValidEntity( activator ) && activator:IsPlayer( ) ) then
			umsg.Start( "PurchaseStuff", activator )
			umsg.End( )
    end
end

Gamemodes init:



function NpcShop()
local NPCShop = ents.Create("npc_trader")
NPCShop:SetPos(Vector( 4493.762207, -241.616608, 68)) -- sets the position
NPCShop:SetAngles(Vector(0,-135,0))
NPCShop:Spawn() -- spawns the npc_shop entity

end
hook.Add("InitPostEntity","shop",NpcShop)

Its most likely done inside the gamemode then, and use [LUA] tags next time. anyways:
[LUA]–You could do it like this

cam.Start3D2D(Vector(0,0,0),Angle(0,0,0),1)
draw.DrawText("<Message Here>","<Font Here>",0,0,Color(R,G,B,A),TEXT_ALIGN_CENTER)
cam.End3D2D()[/LUA]

This doesn’t help me at all. Because I tried this and the text didn’t even show on the map and do I put it inside the init?

cam is client side http://wiki.garrysmod.com go there

Clientside of what? My gamemode?

yes

Could I put this in the npc_trader cl_init? Or do I have to put it inside of the gamemode cl_init? And if I do that wont it attach to any entity that is spawned?


function ENT:Draw()
	self.Entity:DrawModel()
	
	local Pos = self:GetPos()
	local Ang = self:GetAngles()
	surface.SetFont("HUDNumber5")
	local TextWidth = surface.GetTextSize("Trader")
	cam.Start3D2D(Pos + Ang:Up() * 70, Ang, 0.11)
		draw.WordBox(2, -TextWidth*0.5, -30, "Trader", "HUDNumber5", Color(140, 0, 0, 100), Color(255,255,255,255))
	cam.End3D2D()
end

It will, nice, seeing as im tired and didnt taking my old NPC script to show you how. So yes, that will work