mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
22
gamemodes/darkrp/plugins/butchering/cl_hooks.lua
Normal file
22
gamemodes/darkrp/plugins/butchering/cl_hooks.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
function PLUGIN:PopulateEntityInfo(entity, container)
|
||||
local drop = entity:GetNetVar("drop")
|
||||
|
||||
if (drop) then
|
||||
local corpseTooltip = container:AddRow("corpse")
|
||||
corpseTooltip:SetContentAlignment(5)
|
||||
corpseTooltip:SetText("Vous pouvez massacrer ce cadavre en le frappant avec le bon outil.")
|
||||
corpseTooltip:SizeToContents()
|
||||
end
|
||||
end
|
||||
45
gamemodes/darkrp/plugins/butchering/sh_npcs.lua
Normal file
45
gamemodes/darkrp/plugins/butchering/sh_npcs.lua
Normal file
@@ -0,0 +1,45 @@
|
||||
--[[
|
||||
| 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.npcs = {
|
||||
["npc_zombie"] = {
|
||||
["ing_headcrab_meat"] = 1
|
||||
},
|
||||
["npc_fastzombie"] = {
|
||||
["ing_headcrab_meat"] = 1
|
||||
},
|
||||
["npc_antlion"] = {
|
||||
["ing_antlion_meat"] = 1
|
||||
},
|
||||
["npc_antlion_grub"] = {
|
||||
["ing_antlion_meat"] = 1
|
||||
},
|
||||
["npc_antlionguard"] = {
|
||||
["ing_antlion_meat"] = 5
|
||||
},
|
||||
["npc_antlionguardian"] = {
|
||||
["ing_antlion_meat"] = 10
|
||||
},
|
||||
["npc_antlion_worker"] = {
|
||||
["ing_antlion_meat"] = 2
|
||||
},
|
||||
["npc_crow"] = {
|
||||
["ing_bird_meat"] = 1
|
||||
},
|
||||
["npc_pigeon"] = {
|
||||
["ing_bird_meat"] = 1
|
||||
},
|
||||
["npc_seagull"] = {
|
||||
["ing_bird_meat"] = 1
|
||||
}
|
||||
}
|
||||
19
gamemodes/darkrp/plugins/butchering/sh_plugin.lua
Normal file
19
gamemodes/darkrp/plugins/butchering/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 ix = ix
|
||||
|
||||
PLUGIN.name = "Butchering"
|
||||
PLUGIN.author = "AleXXX_007"
|
||||
PLUGIN.description = "Permet de massacrer les cadavres de certains PNJ pour obtenir diverses ressources."
|
||||
|
||||
ix.util.Include("cl_hooks.lua")
|
||||
ix.util.Include("sh_npcs.lua")
|
||||
ix.util.Include("sv_hooks.lua")
|
||||
103
gamemodes/darkrp/plugins/butchering/sv_hooks.lua
Normal file
103
gamemodes/darkrp/plugins/butchering/sv_hooks.lua
Normal file
@@ -0,0 +1,103 @@
|
||||
--[[
|
||||
| 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 table = table
|
||||
local ents = ents
|
||||
local timer = timer
|
||||
local IsValid = IsValid
|
||||
local hook = hook
|
||||
local ix = ix
|
||||
local EffectData = EffectData
|
||||
local util = util
|
||||
local math = math
|
||||
local VectorRand = VectorRand
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
function PLUGIN:OnNPCKilled(entity, attacker, inflictor)
|
||||
local drop = self.npcs[entity:GetClass()]
|
||||
|
||||
if (drop and !table.IsEmpty(drop)) then
|
||||
local corpse = ents.Create("prop_ragdoll")
|
||||
corpse:SetModel(entity:GetModel())
|
||||
corpse:PrecacheGibs()
|
||||
corpse:SetSkin(entity:GetSkin())
|
||||
corpse:SetBodyGroups(entity:GetBodyGroups())
|
||||
corpse:SetPos(entity:GetPos())
|
||||
corpse:SetAngles(entity:GetAngles())
|
||||
corpse:SetNetVar("drop", table.Copy(drop))
|
||||
|
||||
entity:Remove()
|
||||
|
||||
corpse:Spawn()
|
||||
|
||||
timer.Simple(180, function()
|
||||
if (IsValid(corpse)) then
|
||||
corpse:Remove()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
local tools = {
|
||||
["tfa_nmrih_kknife"] = true,
|
||||
["tfa_nmrih_cleaver"] = true,
|
||||
["tfa_nmrih_machete"] = true,
|
||||
["tfa_nmrih_fireaxe"] = true,
|
||||
["tfa_nmrih_hatchet"] = true
|
||||
}
|
||||
|
||||
function PLUGIN:EntityTakeDamage(entity, damageInfo)
|
||||
local drop = entity:GetNetVar("drop")
|
||||
|
||||
if (drop) then
|
||||
local attacker = damageInfo:GetAttacker()
|
||||
local noTool = hook.Run("CanButcherWithoutTool", attacker, entity, drop)
|
||||
|
||||
if (noTool or IsValid(attacker) and attacker:IsPlayer()) then
|
||||
local weapon = attacker:GetActiveWeapon()
|
||||
|
||||
if (noTool or IsValid(weapon) and tools[weapon:GetClass()]) then
|
||||
local inventory = attacker:GetCharacter():GetInventory()
|
||||
local amount, uniqueID = table.Random(drop)
|
||||
local itemTable = ix.item.Get(uniqueID)
|
||||
|
||||
if (itemTable) then
|
||||
if (!inventory:Add(uniqueID, 1)) then
|
||||
attacker:NotifyLocalized("Vous n'avez pas assez de place dans votre inventaire, "..itemTable:GetName().." a été laissé tomber.")
|
||||
ix.item.Spawn(uniqueID, damageInfo:GetDamagePosition())
|
||||
else
|
||||
attacker:NotifyLocalized("Tu as massacré "..itemTable:GetName())
|
||||
end
|
||||
|
||||
drop[uniqueID] = amount > 1 and amount - 1 or nil
|
||||
end
|
||||
|
||||
local pos = entity:GetPos()
|
||||
local effect = EffectData()
|
||||
effect:SetStart(pos)
|
||||
effect:SetOrigin(pos)
|
||||
effect:SetScale(6)
|
||||
effect:SetFlags(3)
|
||||
effect:SetColor(0)
|
||||
util.Effect("bloodspray", effect)
|
||||
|
||||
if (table.IsEmpty(drop)) then
|
||||
entity:EmitSound("physics/body/body_medium_break"..math.random(2, 4)..".wav")
|
||||
entity:GibBreakClient(VectorRand())
|
||||
entity:Remove()
|
||||
else
|
||||
entity:EmitSound("physics/flesh/flesh_squishy_impact_hard"..math.random(1, 4)..".wav")
|
||||
entity:SetNetVar("drop", drop)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user