Hello all, I've been coding my own printers for DarkRP and have stumbled upon a huge problem, my Getowning_ent() isn't working.
Shared.lua datatables:
function ENT:SetupDataTables()
self:NetworkVar("Entity", 0, "owning_ent")
end
Clientside drawing of the name:
local owner = self:Getowning_ent()
owner = (IsValid(owner) and owner:Nick()) or DarkRP.getPhrase("unknown")
cam.Start3D2D( pos, ang, 0.11 )
draw.SimpleText( "Owner: "..owner, "DermaLarge", 40, 5, self.cfg.textcol )
cam.End3D2D()
I snatched the 'local owner' thing from the base darkrp printer (which works btw, it shows the name as it should) as my one wasn't working. So....... base darkrp printer works and mine doesn't...? Oh, and there's are errors.
"Attempt to call method Nick a nil value"
"Attempt to concatenate global owner"
"Attempt to index NULL entity"
How can this be if Falco's one works, and the code for the owner is no different?
self:Getowning_ent() is returning NULL, where is Getowning_ent() implemented?
Fixed it.
CPPIGetOwner works for Q menu.
Getowning_ent works for F4. Using elseifs, I fixed it:
local Owner = self:CPPIGetOwner()
if IsValid(Owner) and Owner:Nick() then
Owner = Owner:Nick()
if string.len(Owner) > 10 then
Owner = string.Left( Owner, 10 ).."..."
end
elseif IsValid(self:Getowning_ent()) and self:Getowning_ent():Nick() then
Owner = self:Getowning_ent():Nick()
if string.len(Owner) > 10 then
Owner = string.Left( Owner, 10 ).."..."
end
else
Owner = "Unknown"
end
Well you might as well give someone those coins...
someone liek me?
NO!
Listen @Shadowmisti I'll give you a diamond if you give those coins to me! You will lose only HALF of the coins!
Sorry, you need to Log In to post a reply to this thread.