Door Help

[LUA]function DrawDisplay()
local trace = LocalPlayer():GetEyeTrace()
if (ValidEntity(trace.Entity)) and (trace.Entity:GetPos():Distance(LocalPlayer():GetPos()) < 200) then
local ent = trace.Entity
if ent:IsDoor() then
if ent:IsOwned() == true then
local pos = ent:LocalToWorld(ent:OBBCenter()):ToScreen()
draw.DrawText(“Owned”, “TargetID”, pos.x, pos.y, Color( 255, 255, 255, 255), 1)
end
if not ent:IsOwned() == true then
local pos = ent:LocalToWorld(ent:OBBCenter()):ToScreen()
draw.DrawText(“Un-owned”, “TargetID”, pos.x, pos.y, Color( 65, 74, 199, 255), 1)
end
end
end
end
hook.Add(“HUDPaint”, “DrawBox”, DrawDisplay);

[/LUA]

The code all works its just that I have no clue how I would make it say
Owned by players name instead of just Owned.
If someone could help me out that would be be great.

Also, Can you add a concommand to this?
[LUA]
function meta:Own( ply )

if( CLIENT ) then return; end

if( self:AllowedToOwn( ply ) ) then
	self:AddOwner( ply );
	return;
end

if( not self:IsOwned() and not self:OwnedBy( ply ) ) then

	self:SetNWInt( "Owner", ply:EntIndex() );
	self:SetNWInt( "OwnerNum", 0 );
	self:SetNWString( "title", "" );
	
end

end
[/LUA]

I tried concommand.Add(“own”, meta:Own)

but that didn’t work.

You could do this for getting the players name

[lua]
draw.DrawText(“Owned by”…GetNick()…"", “TargetID”, pos.x, pos.y, Color( 255, 255, 255, 255), 1)[/lua]

Nope. Something like this:
[lua]
draw.DrawText(“Owned by “…ent:GetNWInt(“Owner”):Nick()…””, “TargetID”, pos.x, pos.y, Color( 255, 255, 255, 255), 1)[/lua]

I got this Error when I tried to use yours Jamie

Hook ‘DrawBox’ Failed: RandomRp\gamemode\cl_init.lua:218: attempt to index a number value

Ah, I see where I went wrong.

Its because I am doing it on the entity index.

Hmm. Try this

[lua]
local EntityIndexing = Entity(ent:GetNWInt(“Owner”)):Nick()
draw.DrawText(“Owned by “…EntityIndexing…””, “TargetID”, pos.x, pos.y, Color( 255, 255, 255, 255), 1)[/lua]

Ah, That worked. Thanks for the help!

Your welcome.