self:DoModelScale

I’m trying to fix this addon but I can’t find code that works for this:


self:DoModelScale

I will post the whole code if needed.

Please do, and mention the specific error you are having

Here’s the code and the error is line 44 (self:DoModelScale) thats why I called this thread that.


include("shared.lua")

function ENT:Initialize()
	self:DrawShadow(false)
	self:SetRenderBounds(Vector(-40, -40, -18), Vector(40, 40, 90))

	self.Emitter = ParticleEmitter(self:GetPos())
	self.Emitter:SetNearClip(40, 50)
	self.NextEmit = 0
end

function ENT:OnRemove()
	self.Emitter:Finish()
end

function ENT:Think()
	local owner = self:GetOwner()
	if owner:IsValid() then self:SetPos(owner:EyePos()) end
	self.Emitter:SetPos(self:GetPos())
end

function ENT:DrawTranslucent()
	if not DISPLAYHATS then return end
	local owner = self:GetOwner()
	if not owner:IsValid() or owner == MySelf and not (NOX_VIEW or GetViewEntity() ~= MySelf) and owner:Alive() then return end

	if owner:GetRagdollEntity() then
		owner = owner:GetRagdollEntity()
	elseif not owner:Alive() then return end

	local boneindex = owner:LookupBone("ValveBiped.Bip01_Head1")
	if boneindex then
		local pos, ang = owner:GetBonePosition(boneindex)
		if pos and pos ~= owner:GetPos() then
			local c = owner:GetColor()
			local r,g,b,a = c.r, c.g, c.b, c.a
			self:SetColor(Color(r,g,b,math.max(1,a)))
			self:SetRenderMode( RENDERMODE_TRANSALPHA )
			self:SetPos(pos + ang:Forward() * 4)
			ang:RotateAroundAxis(ang:Up(), 90)
			ang:RotateAroundAxis(ang:Right(), 180)
			ang:RotateAroundAxis(ang:Forward(), 90)
			self:SetAngles(ang)
			self:DoModelScale(Vector(2.2, 2.2, 2.2))
			self:DrawModel()

			if self.NextEmit <= CurTime() and 200 < a and MySelf:IsValid() then
				self.NextEmit = CurTime() + 0.065
				local particle = self.Emitter:Add("effects/fire_cloud1", pos + MySelf:GetAimVector() * -2)
				particle:SetVelocity(owner:GetVelocity() * 0.25)
				particle:SetDieTime(math.Rand(0.4, 0.5))
				particle:SetStartAlpha(255)
				particle:SetStartSize(math.Rand(6, 14))
				particle:SetEndSize(0)
				particle:SetRoll(math.Rand(0, 360))
				particle:SetRollDelta(math.Rand(-1, 1))
				particle:SetGravity(Vector(0,0,125))
				particle:SetCollide(true)
				particle:SetAirResistance(12)
			end
			return
		end
	end

	local attach = owner:GetAttachment(owner:LookupAttachment("eyes"))
	if not attach then attach = owner:GetAttachment(owner:LookupAttachment("head")) end
	if attach then
		local c = owner:GetColor()
		local r,g,b,a = c.r, c.g, c.b, c.a
		self:SetColor(Color(r,g,b,a))
		self:SetRenderMode( RENDERMODE_TRANSALPHA )
		self:SetAngles(attach.Ang)
		self:DoModelScale(Vector(2.2, 2.2, 2.2))
		local pos = attach.Pos
		self:SetPos(pos)
		self:DrawModel()

		if self.NextEmit <= CurTime() and 200 < a and MySelf:IsValid() then
			self.NextEmit = CurTime() + 0.065
			local particle = self.Emitter:Add("effects/fire_cloud1", pos + MySelf:GetAimVector() * -2)
			particle:SetVelocity(owner:GetVelocity() * 0.25)
			particle:SetDieTime(math.Rand(0.4, 0.5))
			particle:SetStartAlpha(255)
			particle:SetStartSize(math.Rand(6, 14))
			particle:SetEndSize(0)
			particle:SetRoll(math.Rand(0, 360))
			particle:SetRollDelta(math.Rand(-1, 1))
			particle:SetGravity(Vector(0,0,125))
			particle:SetCollide(true)
			particle:SetAirResistance(12)
		end
	end
end



local ENTITY = FindMetaTable( "Entity" )
function ENTITY:DoModelScale( vecScale )   
   local matrix = Matrix()
   matrix:Scale( vecScale )
   self:EnableMatrix( "RenderMultiply", matrix )
end