mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
19
gamemodes/ixhl2rp/plugins/preventsuitsteal/sh_plugin.lua
Normal file
19
gamemodes/ixhl2rp/plugins/preventsuitsteal/sh_plugin.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
--[[
|
||||
| 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
|
||||
local ix = ix
|
||||
|
||||
PLUGIN.name = "Prevent suit theft"
|
||||
PLUGIN.description = "Prevents people from stealing suits from downed OTA and cops."
|
||||
PLUGIN.author = "Asimo"
|
||||
|
||||
ix.util.Include("sv_hooks.lua")
|
||||
39
gamemodes/ixhl2rp/plugins/preventsuitsteal/sv_hooks.lua
Normal file
39
gamemodes/ixhl2rp/plugins/preventsuitsteal/sv_hooks.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
--[[
|
||||
| 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
|
||||
local ix = ix
|
||||
|
||||
function PLUGIN:OnItemTransferred(item, lastInventory, inventory)
|
||||
if lastInventory:GetID() == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local isDroppedToWorld = (inventory:GetID() == 0)
|
||||
local lastOwnerCharacter = ix.char.loaded[lastInventory.owner]
|
||||
|
||||
if lastOwnerCharacter and (item.isCP or item.isOTA) and (lastOwnerCharacter:GetBleedout() > 0) then
|
||||
local faction = lastOwnerCharacter:GetFaction()
|
||||
if faction == FACTION_CP or faction == FACTION_OTA then
|
||||
local replaceItem = item.replaceOnDeath
|
||||
|
||||
if replaceItem then
|
||||
if isDroppedToWorld then
|
||||
local dropPos = lastOwnerCharacter:GetPlayer():GetPos()
|
||||
ix.item.Spawn(replaceItem, dropPos)
|
||||
item:Remove()
|
||||
else
|
||||
item:Remove()
|
||||
inventory:Add(replaceItem)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user