dobrograd-13-06-2022/garrysmod/gamemodes/darkrp/gamemode/modules/base/cl_drawfunctions.lua

31 lines
966 B
Lua
Raw Normal View History

2023-11-16 15:01:19 +05:00
-- concatenate a space to avoid the text being parsed as valve string
local function safeText(text)
return string.match(text, "^#([a-zA-Z_]+)$") and text .. " " or text
end
DarkRP.deLocalise = safeText
function draw.DrawNonParsedText(text, font, x, y, color, xAlign)
return draw.DrawText(safeText(text), font, x, y, color, xAlign)
end
function draw.DrawNonParsedSimpleText(text, font, x, y, color, xAlign, yAlign)
return draw.SimpleText(safeText(text), font, x, y, color, xAlign, yAlign)
end
function draw.DrawNonParsedSimpleTextOutlined(text, font, x, y, color, xAlign, yAlign, outlineWidth, outlineColor)
return draw.SimpleTextOutlined(safeText(text), font, x, y, color, xAlign, yAlign, outlineWidth, outlineColor)
end
function surface.DrawNonParsedText(text)
return surface.DrawText(safeText(text))
end
function chat.AddNonParsedText(...)
local tbl = {...}
for i = 2, #tbl, 2 do
tbl[i] = safeText(tbl[i])
end
return chat.AddText(unpack(tbl))
end