mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
61
gamemodes/darkrp/plugins/rappelling/sv_plugin.lua
Normal file
61
gamemodes/darkrp/plugins/rappelling/sv_plugin.lua
Normal file
@@ -0,0 +1,61 @@
|
||||
--[[
|
||||
| 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:CreateRope(client)
|
||||
local attachmentIndex
|
||||
|
||||
if (client.ixAnimModelClass == "metrocop") then
|
||||
attachmentIndex = client:LookupAttachment("anim_attachment_LH")
|
||||
else
|
||||
attachmentIndex = client:LookupAttachment("hips")
|
||||
end
|
||||
|
||||
local attachment = client:GetAttachment(attachmentIndex)
|
||||
|
||||
if (attachmentIndex == 0 or attachmentIndex == -1) then
|
||||
attachment = {Pos = client:GetBonePosition(client:LookupBone("ValveBiped.Bip01_Pelvis"))}
|
||||
attachmentIndex = client:LookupAttachment("forward")
|
||||
end
|
||||
|
||||
local rappelRope = ents.Create("keyframe_rope")
|
||||
rappelRope:SetParent(client, attachmentIndex)
|
||||
rappelRope:SetPos(attachment and attachment.Pos or client:GetPos())
|
||||
rappelRope:SetColor(Color(150, 150, 150))
|
||||
rappelRope:SetEntity("StartEntity", rappelRope)
|
||||
rappelRope:SetEntity("EndEntity", Entity(0))
|
||||
rappelRope:SetKeyValue("Width", 2)
|
||||
rappelRope:SetKeyValue("Collide", 1)
|
||||
rappelRope:SetKeyValue("RopeMaterial", "cable/cable")
|
||||
rappelRope:SetKeyValue("EndOffset", tostring(client.rappelPos or client:GetPos()))
|
||||
rappelRope:SetKeyValue("EndBone", 0)
|
||||
client.rappelRope = rappelRope
|
||||
|
||||
client:DeleteOnRemove(rappelRope)
|
||||
client:EmitSound("npc/combine_soldier/zipline_clip" .. math.random(2) .. ".wav")
|
||||
|
||||
end
|
||||
|
||||
function PLUGIN:RemoveRope(client)
|
||||
if (IsValid(client.rappelRope)) then
|
||||
client.rappelRope:Remove()
|
||||
end
|
||||
|
||||
client.rappelRope = nil
|
||||
client.oneTimeRappelSound = nil
|
||||
|
||||
local sequence = client:LookupSequence("rappelloop")
|
||||
|
||||
if (sequence != 1 and client:GetNetVar("forcedSequence") == sequence) then
|
||||
client:SetNetVar("forcedSequence", nil)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user