I copied this Lua code from the darkrp wiki, but something seems to be wrong with it. Anyone know the problem:
include("shared.lua")
function ENT:Draw()
self:DrawModel()
local Pos = self:GetPos()
local Ang = self:GetAngles()
local owner = self.dt.owning_ent
owner = (IsValid(owner) and owner:Nick()) or "unknown"
surface.SetFont("HUDNumber6")
local TextWidth = surface.GetTextSize("Deluxe Money printer")
local TextWidth2 = surface.GetTextSize(owner)
Ang:RotateAroundAxis(Ang:Up(), 90)
cam.Start3D2D(Pos + Ang:Up() * 11.5, Ang, 0.11)
draw.WordBox(2, -TextWidth*0.5, -30, "Deluxe Money printer", "HUDNumber6", Color(140, 0, 0, 100), Color(255,255,255,255))
draw.WordBox(2, -TextWidth2*0.5, 18, owner, "HUDNumber6", Color(140, 0, 0, 100), Color(255,255,255,255))
cam.End3D2D()
end
[QUOTE=Xanicon;39499211]I copied this Lua code from the darkrp wiki, but something seems to be wrong with it. Anyone know the problem:
include("shared.lua")
function ENT:Draw()
self:DrawModel()
local Pos = self:GetPos()
local Ang = self:GetAngles()
local owner = self.dt.owning_ent
owner = (IsValid(owner) and owner:Nick()) or "unknown"
surface.SetFont("HUDNumber6")
local TextWidth = surface.GetTextSize("Deluxe Money printer")
local TextWidth2 = surface.GetTextSize(owner)
Ang:RotateAroundAxis(Ang:Up(), 90)
cam.Start3D2D(Pos + Ang:Up() * 11.5, Ang, 0.11)
draw.WordBox(2, -TextWidth*0.5, -30, "Deluxe Money printer", "HUDNumber6", Color(140, 0, 0, 100), Color(255,255,255,255))
draw.WordBox(2, -TextWidth2*0.5, 18, owner, "HUDNumber6", Color(140, 0, 0, 100), Color(255,255,255,255))
cam.End3D2D()
end[/QUOTE]
Next time put your code in tags [-LUA][/LUA], Second I think this is working just for Gmod 12.
You can't get the owner of the entity with: self.dt.owning_ent anymore.
Use: self:Getowning_ent()
next time post the error too please :3
Sorry, you need to Log In to post a reply to this thread.