mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
79 lines
2.1 KiB
Lua
79 lines
2.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/
|
|
--]]
|
|
|
|
|
|
ITEM.name = "Collier de serrage"
|
|
ITEM.description = "Un collier de serrage orange utilisé pour restreindre les gens."
|
|
ITEM.price = 80
|
|
ITEM.model = "models/items/crossbowrounds.mdl"
|
|
ITEM.category = "Combine"
|
|
ITEM.maxStackSize = 10
|
|
ITEM.factions = {FACTION_CP, FACTION_OTA, FACTION_RESISTANCE}
|
|
ITEM.functions.Use = {
|
|
name = "Utiliser",
|
|
OnRun = function(itemTable)
|
|
local client = itemTable.player
|
|
local data = {}
|
|
data.start = client:GetShootPos()
|
|
data.endpos = data.start + client:GetAimVector() * 96
|
|
data.filter = client
|
|
local target = util.TraceLine(data).Entity
|
|
local ragdoll = nil
|
|
|
|
if (target:IsRagdoll() and target.ixPlayer) then
|
|
ragdoll = target
|
|
target = target.ixPlayer
|
|
end
|
|
|
|
if (IsValid(target) and target:IsPlayer() and target:GetCharacter() and !target:GetNetVar("tying") and !target:IsRestricted()) then
|
|
itemTable.bBeingUsed = true
|
|
|
|
client:SetAction("@tying", 5)
|
|
|
|
client:DoStaredAction(ragdoll or target, function()
|
|
itemTable.bBeingUsed = false
|
|
|
|
if (!(ix.fights and target:GetFight())) then
|
|
target:SetRestricted(true)
|
|
target:SetNetVar("tying")
|
|
target:NotifyLocalized("fTiedUp")
|
|
client:NotifyLocalized("La cible a été attachée avec succès.")
|
|
target:SetWalkSpeed(target:GetWalkSpeed()/3)
|
|
itemTable:Remove()
|
|
else
|
|
target:SetAction()
|
|
target:SetNetVar("tying")
|
|
end
|
|
end, 5, function()
|
|
client:SetAction()
|
|
|
|
target:SetAction()
|
|
target:SetNetVar("tying")
|
|
|
|
itemTable.bBeingUsed = false
|
|
end)
|
|
|
|
target:SetNetVar("tying", true)
|
|
target:SetAction("@fBeingTied", 5)
|
|
else
|
|
itemTable.player:NotifyLocalized("plyNotValid")
|
|
end
|
|
|
|
return false
|
|
end,
|
|
OnCanRun = function(itemTable)
|
|
return !IsValid(itemTable.entity) or itemTable.bBeingUsed
|
|
end
|
|
}
|
|
|
|
function ITEM:CanTransfer(inventory, newInventory)
|
|
return !self.bBeingUsed
|
|
end
|