Initial commit
This commit is contained in:
30
gamemodes/darkrp/gamemode/modules/base/cl_drawfunctions.lua
Normal file
30
gamemodes/darkrp/gamemode/modules/base/cl_drawfunctions.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
-- 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
|
||||
Reference in New Issue
Block a user