Когда ставлю текстскрин выскакивает ошибка:
[ERROR] lua/includes/extensions/entity.lua:192: attempt to index local ‘col’ (a number value)
- SetColor - lua/includes/extensions/entity.lua:192
- unknown - gamemodes/darkrp/entities/entities/ent_textscreen/cl_init.lua:36
Что делать? Куски кода из файлов:
--скрипт в lua
local SetColorOriginal4 = meta.SetColor4Part -- Do not use me! I will be removed
local SetColorOriginal = meta.SetColor
function meta:SetColor( col )
-- Backwards comp slower method
if ( !SetColorOriginal4 ) then
return SetColorOriginal( self, col )
end
-- Even more backwards compat
if ( !col ) then
return SetColorOriginal4( self, 255, 255, 255, 255 )
end
SetColorOriginal4( self, col.r, col.g, col.b, col.a )
end
и
---cl_init энтити текстскрина
include("shared.lua")
function ENT:Initialize()
self:SetMaterial("models/effects/vol_light001")
self:SetRenderMode(RENDERMODE_TRANSALPHA)
self:SetColor(255, 255, 255, 0)
end
function ENT:Draw()
local inView, dist = self:InDistance(562500)
if (not inView) or self.Rendering then return end
local pos = self:GetPos()
local ang = self:GetAngles()
pos = pos + ang:Up()
local camangle = Angle(ang.p, ang.y, ang.r)
self.lines = self.lines or {}
for i = 1, 3 do
if self:GetNetVar("Text"..i) ~= "" then
self.lines[i] = self.lines[i] or {}
self.lines[i].font = rp.cfg.TextSrceenFonts[self:GetNetVar("Font"..i) or 1]
self.lines[i].text = self:GetNetVar("Text"..i) or ''
self.lines[i].r = self:GetNetVar("r"..i) or 255
self.lines[i].g = self:GetNetVar("g"..i) or 255
self.lines[i].b = self:GetNetVar("b"..i) or 255
self.lines[i].a = self:GetNetVar("a"..i) or 255
self.lines[i].size = math_Clamp(self:GetNetVar("size"..i) or 100, 1,100)
self.lines[i].fontname = getFont(self.lines[i].font, self.lines[i].size)
else
self.lines[i] = nil
end
end