67 lines
2.1 KiB
Lua
67 lines
2.1 KiB
Lua
local PLUGIN = PLUGIN
|
|
PLUGIN.name = "RP Chat Extras"
|
|
PLUGIN.author = "Scripty"
|
|
PLUGIN.description = "Добавляет /do, /try и алиасы /s, /y."
|
|
|
|
hook.Add("InitializedChatClasses", "rp_chat_extras", function()
|
|
timer.Simple(0, function()
|
|
|
|
ix.chat.Register("do", {
|
|
OnChatAdd = function(self, speaker, text)
|
|
chat.AddText(ix.config.Get("chatColor"), text)
|
|
end,
|
|
CanHear = ix.config.Get("chatRange", 280) * 2,
|
|
prefix = {"/do", "/Do"},
|
|
description = "@cmdDo",
|
|
indicator = "chatPerforming",
|
|
deadCanChat = true
|
|
})
|
|
|
|
ix.chat.Register("try", {
|
|
color = Color(155, 111, 176),
|
|
CanHear = ix.config.Get("chatRange", 280),
|
|
deadCanChat = true,
|
|
prefix = {"/try", "/Try"},
|
|
description = "@cmdTry",
|
|
indicator = "chatPerforming",
|
|
|
|
OnChatAdd = function(self, speaker, text)
|
|
local success = math.random(0, 1) == 1
|
|
|
|
local resultColor = success and Color(0, 200, 0) or Color(200, 0, 0)
|
|
local resultText = success and "[Успешно]" or "[Неудачно]"
|
|
|
|
chat.AddText(
|
|
resultColor, resultText .. " ",
|
|
self.color, speaker:Name() .. ": " .. text
|
|
)
|
|
end
|
|
})
|
|
|
|
local whisper = ix.chat.classes.y
|
|
if whisper then
|
|
whisper.format = "%s шепчет \"%s\""
|
|
whisper.description = "@cmdY"
|
|
|
|
if istable(whisper.prefix) then
|
|
table.insert(whisper.prefix, "/y")
|
|
else
|
|
whisper.prefix = { whisper.prefix, "/y" }
|
|
end
|
|
end
|
|
|
|
local yell = ix.chat.classes.s
|
|
if yell then
|
|
yell.format = "%s кричит \"%s\""
|
|
yell.description = "@cmdS"
|
|
|
|
if istable(yell.prefix) then
|
|
table.insert(yell.prefix, "/s")
|
|
else
|
|
yell.prefix = { yell.prefix, "/s" }
|
|
end
|
|
end
|
|
|
|
end)
|
|
end)
|