mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 05:43:46 +03:00
43 lines
1.1 KiB
Lua
43 lines
1.1 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 PLUGIN = PLUGIN
|
||
|
||
PLUGIN.name = "Ammo Limit"
|
||
PLUGIN.author = "Gr4Ss"
|
||
PLUGIN.description = "Limit how much ammo can be loaded from ammo boxes."
|
||
|
||
ix.lang.AddTable("english", {
|
||
ammoLimitReached = "Mevcut mermi limitine ulaştınız!"
|
||
})
|
||
|
||
ix.config.Add("ammoBoxLimit", 4, "The maximum amount of ammo boxes someone is allowed to equip", nil, {
|
||
data = {min = 0, max = 10, decimals = 1},
|
||
category = "Other"
|
||
})
|
||
|
||
function PLUGIN:CanPlayerInteractItem(client, action, item, data)
|
||
if (isentity(item)) then
|
||
if (IsValid(item)) then
|
||
item = ix.item.instances[item.ixItemID]
|
||
else
|
||
return
|
||
end
|
||
elseif (isnumber(item)) then
|
||
item = ix.item.instances[item]
|
||
end
|
||
|
||
if (!item) then return end
|
||
if (action == "use" and item.ammo and item.ammoAmount and client:GetAmmoCount(item.ammo) >= item.ammoAmount * ix.config.Get("ammoBoxLimit")) then
|
||
client:NotifyLocalized("ammoLimitReached")
|
||
return false
|
||
end
|
||
end |