mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
58 lines
1.6 KiB
Lua
58 lines
1.6 KiB
Lua
--[[
|
|
| This file was obtained through the combined efforts
|
|
| of Madbluntz & Plymouth Antiquarian Society.
|
|
|
|
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
|
| Maloy, DrPepper10 @ RIP, Atle!
|
|
|
|
|
| Visit for more: https://plymouth.thetwilightzone.ru/
|
|
--]]
|
|
|
|
local ix = ix
|
|
local string = string
|
|
local tostring = tostring
|
|
|
|
|
|
PLUGIN.name = "Extended Character Description"
|
|
PLUGIN.author = "AleXXX_007"
|
|
PLUGIN.description = "Adds new panel for longer character descriptions."
|
|
|
|
ix.util.Include("cl_hooks.lua")
|
|
ix.util.Include("sh_commands.lua")
|
|
ix.util.Include("sv_hooks.lua")
|
|
|
|
ix.config.Add("maxDescriptionLength", 512, "Maximum amount of characters in the description.", nil, {
|
|
data = {min = 64, max = 2048},
|
|
category = "characters"
|
|
})
|
|
|
|
ix.lang.AddTable("english", {
|
|
descMaxLen = "Opis nie może zawierać więcej niż %d znaków!"
|
|
})
|
|
|
|
ix.lang.AddTable("spanish", {
|
|
descMaxLen = "¡Tu descripción no puede tener más de %d carácteres!"
|
|
})
|
|
|
|
ix.lang.AddTable("polish", {
|
|
descMaxLen = "Opis nie może zawierać więcej niż %d znaków!"
|
|
})
|
|
|
|
do
|
|
ix.char.vars.description.OnValidate = function(self, value, payload)
|
|
value = string.Trim((tostring(value):gsub("\r\n", ""):gsub("\n", "")))
|
|
local minLength = ix.config.Get("minDescriptionLength", 16)
|
|
local maxLength = ix.config.Get("maxDescriptionLength", 512)
|
|
|
|
if (value:utf8len() < minLength) then
|
|
return false, "descMinLen", minLength
|
|
elseif (value:utf8len() > maxLength) then
|
|
return false, "descMaxLen", maxLength
|
|
elseif (!value:find("%S")) then
|
|
return false, "invalid", "description"
|
|
end
|
|
|
|
return value
|
|
end
|
|
end
|