Files
VnUtest/garrysmod/gamemodes/militaryrp/plugins/weapon_kits/sh_plugin.lua
2026-03-31 10:27:04 +03:00

84 lines
1.9 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
local PLUGIN = PLUGIN
PLUGIN.name = "Weapon Kits"
PLUGIN.author = "Scripty"
PLUGIN.description = "Adds weapon kits for specific user groups with cooldowns."
ix.util.Include("sv_plugin.lua")
ix.util.Include("cl_plugin.lua")
PLUGIN.kits = PLUGIN.kits or {}
ix.command.Add("KitMenu", {
description = "Open the weapon kit selection menu.",
OnRun = function(self, client)
local character = client:GetCharacter()
if (!character) then return end
local allowedGroups = {
["superadmin"] = true,
["sponsor"] = true,
["prem"] = true
}
if (!allowedGroups[client:GetUserGroup()]) then
return "У вас нет доступа к этому меню."
end
net.Start("ixKitMenu")
net.Send(client)
end
})
ix.command.Add("KitAdd", {
description = "Add a new weapon kit (Admin only).",
privilege = "Manage Kits",
adminOnly = true,
arguments = {
ix.type.string,
ix.type.number
},
OnRun = function(self, client, weaponClass, cooldown)
local weaponTable = weapons.GetStored(weaponClass)
if (!weaponTable) then
return "Некорректный класс оружия."
end
PLUGIN.kits[weaponClass] = {
name = weaponTable.PrintName or weaponClass,
cooldown = cooldown -- in seconds
}
if (SERVER) then
PLUGIN:SaveData()
PLUGIN:SyncKits()
end
return "Вы добавили набор: " .. (weaponTable.PrintName or weaponClass) .. " с КД " .. (cooldown / 60) .. " мин."
end
})
ix.command.Add("KitRemove", {
description = "Remove a weapon kit (Admin only).",
privilege = "Manage Kits",
adminOnly = true,
arguments = {
ix.type.string
},
OnRun = function(self, client, weaponClass)
if (!PLUGIN.kits[weaponClass]) then
return "Такого набора не существует."
end
PLUGIN.kits[weaponClass] = nil
if (SERVER) then
PLUGIN:SaveData()
PLUGIN:SyncKits()
end
return "Вы удалили набор: " .. weaponClass
end
})