This commit is contained in:
lifestorm
2024-08-04 23:54:45 +03:00
parent 8064ba84d8
commit 6a58f406b1
7522 changed files with 4011896 additions and 15 deletions

View File

@@ -0,0 +1,76 @@
--[[
| 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 = "One-way-container"
PLUGIN.author = "Whitehole"
PLUGIN.description = "Adds one way containers."
ix.lang.AddTable("english", {
normalToOneWayContainer = "Tek yönlü bir konteynere dönüştürün",
oneWayToNormalContainer = "Normal bir konteynere dönüştürün",
})
ix.lang.AddTable("spanish", {
normalToOneWayContainer = "Convertir en un contenedor de una sola via",
oneWayToNormalContainer = "Convertir en un contenedor normal",
})
properties.Add("ixContainerToOneWay", {
MenuLabel = "Turn into a one-way container",
Order = 402,
MenuIcon = "icon16/arrow_switch.png",
Filter = function(self, entity, client)
if (ix.config.Get("AllowContainerSpawn")) then return false end
if (entity:GetClass() != "ix_container") then return false end
if (!gamemode.Call("CanProperty", client, "ixContainerCreate", entity)) then return false end
if (!ix.container.stored[entity:GetModel():lower()]) then return false end
if (entity:GetNetVar("isOneWay", false)) then return false end
return true
end,
Action = function(self, entity)
self:MsgStart()
net.WriteEntity(entity)
self:MsgEnd()
end,
Receive = function(self, length, client)
local entity = net.ReadEntity()
entity:SetNetVar("isOneWay", true)
end
})
properties.Add("ixOneWayToContainer", {
MenuLabel = "Turn into a normal container",
Order = 402,
MenuIcon = "icon16/arrow_switch.png",
Filter = function(self, entity, client)
if (ix.config.Get("AllowContainerSpawn")) then return false end
if (entity:GetClass() != "ix_container") then return false end
if (!gamemode.Call("CanProperty", client, "ixContainerCreate", entity)) then return false end
if (!ix.container.stored[entity:GetModel():lower()]) then return false end
if (!entity:GetNetVar("isOneWay", false)) then return false end
return true
end,
Action = function(self, entity)
self:MsgStart()
net.WriteEntity(entity)
self:MsgEnd()
end,
Receive = function(self, length, client)
local entity = net.ReadEntity()
entity:SetNetVar("isOneWay", false)
end
})
ix.util.Include("sv_hooks.lua")

View File

@@ -0,0 +1,41 @@
--[[
| 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/
--]]
function PLUGIN:CanTransferItem(item, srcInv, dstInv)
if (srcInv.vars and srcInv.vars.isContainer) then
local entity = srcInv.storageInfo.entity
if (entity:GetNetVar("isOneWay", false)) then
-- If dstInv is zeroInv then it'll not have the method GetOwner
if (!dstInv.GetOwner) then return false end
local character = dstInv:GetOwner():GetCharacter()
if (entity:GetLocked() and !entity.keypad and !entity.Sessions[character:GetID()]) then
net.Start("ixContainerPassword")
net.WriteEntity(entity)
net.Send(dstInv:GetOwner())
return false
end
end
end
end
function PLUGIN:CanTakeMoney(client, entity, amount)
local character = client:GetCharacter()
if (entity:GetNetVar("isOneWay", false) and entity:GetLocked() and !entity.keypad and !entity.Sessions[character:GetID()]) then
net.Start("ixContainerPassword")
net.WriteEntity(entity)
net.Send(client)
return false
end
end