Hello! I was wondering how to add a speed boost to activate when the player is shot. I have tried a few things but nothing seemed to work. Any ideas?
The code
[code]
function plymeta:fakedeath()
self:SetNWBool("Dead", true)
self:SetNWBool("CanAttack", false)
self:SetNWBool("Status", 3)
self:SetColor(Color(255,255,255,0))
self:SetNoDraw(true)
self:SetNWBool("disguised", true)
---------------------------
--------"corpse"-------
---------------------------
-- this is time to make our corpse
local weapons = {"weapon_zm_pistol","weapon_ttt_m16","weapon_zm_revolver","weapon_zm_shotgun","weapon_ttt_glock","weapon_zm_mac10","weapon_zm_revolver","weapon_zm_sledge"}
local dmginfo = DamageInfo()
dmginfo:SetDamage( math.random(10,100) )
dmginfo:SetDamageType( DMG_BULLET )
-- create the ragdoll
local rag = ents.Create("prop_ragdoll", dmginfo)
rag:SetPos(self:GetPos())
rag:SetModel(self:GetModel())
rag:SetAngles(self:GetAngles())
rag:SetColor(self:GetColor())
rag.SetOwner(self)
rag:Spawn(self)
rag:Activate(self)
-- flag this ragdoll as being a player's
rag.player_ragdoll = self
rag.uqid = self:UniqueID()
self:SetNWBool("is_pretending", true)
self:SetNWString("nick", self:Nick())
-- network data
CORPSE.SetPlayerNick(rag, self)
CORPSE.SetCredits(rag, 0)
-- if someone searches this body they can find info on the victim and the
-- death circumstances
rag.equipment = self:GetEquipmentItems()
rag.was_role = ROLE_INNOCENT
rag.bomb_wire = false
rag.dmgtype = ( DMG_BULLET )
rag.dmgwep = table.Random(weapons)
rag.was_headshot = true
rag.time = CurTime()
rag.kills = table.Copy(self.kills)
rag.killer_sample = nil
-- position the bones
local num = rag:GetPhysicsObjectCount()-1
local v = self:GetVelocity()
for i=0, num do
local bone = rag:GetPhysicsObjectNum(i)
if IsValid(bone) then
local bp, ba = self:GetBonePosition(rag:TranslatePhysBoneToBone(i))
if bp and ba then
bone:SetPos(bp)
bone:SetAngles(ba)
end
end
end
end
[/code]
Sorry, you need to Log In to post a reply to this thread.