mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
104 lines
3.1 KiB
Lua
104 lines
3.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/
|
|||
|
|
--]]
|
|||
|
|
|
|||
|
|
netstream.Hook("ixLootProceed", function(client, data)
|
|||
|
|
local ent = data.ent
|
|||
|
|
local action = data.act
|
|||
|
|
local tool = data.tool or false
|
|||
|
|
local key = data.key
|
|||
|
|
local tpy = data.tpy // 1 = default, 2 = without action and additional loot.
|
|||
|
|
local getTool
|
|||
|
|
if tool then
|
|||
|
|
getTool = client:GetCharacter():GetInventory():GetItemByID(tool.id, false)
|
|||
|
|
if (getTool.isTool) then
|
|||
|
|
getTool:DamageDurability(1)
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
if action == 1 then
|
|||
|
|
if tpy == 1 then
|
|||
|
|
ent:EmitSound("willardnetworks/inventory/inv_bandage.wav")
|
|||
|
|
client:SetAction("Konteynerle etkileşimde bulunuyorsunuz.", 3.5, function()
|
|||
|
|
if not ent:IsValid() then return client:Notify("Bu konteyner boş!") end
|
|||
|
|
if ix.loot.CheckDist(client, ent) <= 200 then
|
|||
|
|
ent:FinalizeLoot(client:GetCharacter(), tool)
|
|||
|
|
else
|
|||
|
|
client:Notify("Çok uzaktasın!")
|
|||
|
|
end
|
|||
|
|
end)
|
|||
|
|
elseif tpy == 2 then
|
|||
|
|
ent:FinalizeLoot(client:GetCharacter(), tool, true)
|
|||
|
|
end
|
|||
|
|
elseif action == 2 then
|
|||
|
|
if tpy == 1 then
|
|||
|
|
if not getTool then
|
|||
|
|
return client:Notify("You have no required tools.")
|
|||
|
|
end
|
|||
|
|
ent:EmitSound("willardnetworks/inventory/inv_bandage.wav")
|
|||
|
|
client:SetAction("Konteynerle etkileşimde bulunuyorsunuz.", 3.5, function()
|
|||
|
|
if not ent:IsValid() then return client:Notify("Bu konteyner boş!") end
|
|||
|
|
if ix.loot.CheckDist(client, ent) <= 200 then
|
|||
|
|
ent:FinalizeLoot(client:GetCharacter(), false)
|
|||
|
|
else
|
|||
|
|
client:Notify("Çok uzaktasın!")
|
|||
|
|
end
|
|||
|
|
end)
|
|||
|
|
end
|
|||
|
|
elseif action == 3 then
|
|||
|
|
local getKey = client:GetCharacter():GetInventory():HasItem(key)
|
|||
|
|
if not getKey then
|
|||
|
|
return client:Notify("Gerekli anahtarlarınız yok.")
|
|||
|
|
else
|
|||
|
|
getKey:Remove()
|
|||
|
|
end
|
|||
|
|
client:Notify("Sadece anahtarı kullandın!")
|
|||
|
|
|
|||
|
|
ent:EmitSound("willardnetworks/inventory/inv_bandage.wav")
|
|||
|
|
client:SetAction("Konteynerle etkileşimde bulunuyorsunuz.", 3.5, function()
|
|||
|
|
if not ent:IsValid() then return client:Notify("Konteyner zaten başka biri tarafından arandı!") end
|
|||
|
|
if ix.loot.CheckDist(client, ent) <= 200 then
|
|||
|
|
ent:FinalizeLoot(client:GetCharacter(), false)
|
|||
|
|
else
|
|||
|
|
client:Notify("Çok uzaktasın!")
|
|||
|
|
end
|
|||
|
|
end)
|
|||
|
|
end
|
|||
|
|
end)
|
|||
|
|
netstream.Hook("ixLootInt", function(client, data)
|
|||
|
|
local action = data.act
|
|||
|
|
local ent = data.ent
|
|||
|
|
netstream.Start(client, "ixLootInteractStart", {act = action, ent = ent})
|
|||
|
|
end)
|
|||
|
|
function PLUGIN:LoadData()
|
|||
|
|
local contSpawns = ix.data.Get("contSpawns")
|
|||
|
|
|
|||
|
|
if contSpawns then
|
|||
|
|
for k, v in pairs(contSpawns) do
|
|||
|
|
local entity = ents.Create("ix_containerspawn")
|
|||
|
|
entity:SetAngles(v[1])
|
|||
|
|
entity:SetPos(v[2])
|
|||
|
|
entity:SetLootType(v[3])
|
|||
|
|
entity:Spawn()
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
function PLUGIN:SaveData()
|
|||
|
|
local contSpawns = {}
|
|||
|
|
|
|||
|
|
for k, v in pairs(ents.FindByClass("ix_containerspawn")) do
|
|||
|
|
contSpawns[#contSpawns + 1] = {
|
|||
|
|
v:GetAngles(),
|
|||
|
|
v:GetPos(),
|
|||
|
|
v:GetLootType()
|
|||
|
|
}
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
ix.data.Set("contSpawns", contSpawns)
|
|||
|
|
end
|