Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2024, 02:36:38 PM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Help my crippled limbs code
Pages: [1]
Author Topic: Help my crippled limbs code  (Read 3089 times)
crowstar
Poster

Posts: 3


« on: April 22, 2011, 05:25:16 PM »

I think it has something to do with the dmginfo or something, this is in it's own file.
print("success")
function crippleLegsToggle(ply, toggleBool)

if toggleBool == true then
ply:SetWalkSpeed(1)
end

if toggleBool == false then
ply:SetWalkSpeed(250)
end
end

function crippleArmsToggle(ply, toggleBool)

if toggleBool == True then
ply.StripWeapon(ply:GetActiveWeapon())
end
end



function crippleLimbs(ply, hitgroup, dmginfo)
-- Lets cripple their legs first
if (hitgroup == HITGROUP_LEFTLEG or
hitgroup == HITGROUP_RIGHTLEG) then

--If they were shot in the leg (or they fell) then lower their leg health
if ply.legHealth != 0 and ply:HasEquipmentItem(EQUIP_ARMOR) == false then
ply.legHealth = ply.legHealth - dmginfo.GetBaseDamage()/2
end
--When their leghealth is zero? Cripple them
if ply.legHealth == 0 or dmginfo:IsFallDamage() then
print("Got this far...")
crippleLegsToggle(ply, true)
end

end

if (hitgroup == HITGROUP_LEFTARM or
       hitgroup == HITGROUP_RIGHTARM) then

if ply.armHealth !=0 and ply:HasEquipmentItem(EQUIP_ARMOR) == false then
ply.armHealth = ply.armHealth - dmginfo.GetBaseDamage()/2
end
if ply.armHealth == 0 then
crippleArmsToggle(ply, true)
end
end
end

hook.Add("EntityTakeDamage", "CrippleLimbHook", crippleLimbs(ent, ent:LastHitGroup() or HITGROUP_GENERIC, dmginfo))


Also in player.lua
armHealth == 50
legHealth == 50
« Last Edit: April 22, 2011, 05:27:53 PM by crowstar »
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Help my crippled limbs code « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.009 seconds with 17 queries.