shadowndacorner

mehfix

Mar 29th, 2013
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. function MyLegs(ply, hitgroup, dmginfo)
  2.     if hitgroup == HITGROUP_RIGHTLEG or hitgroup==HITGROUP_LEFTLEG then
  3.         dmginfo:ScaleDamage(2)
  4.         if !ply.lboldwalkspeed then
  5.             ply.lboldwalkspeed=ply:GetWalkSpeed()
  6.             ply.lboldrunspeed=ply:GetRunSpeed()
  7.         end
  8.         ply:SetWalkSpeed(100)
  9.         ply:SetRunSpeed(150)
  10.         ply.LegsDamaged=true
  11.         ply:SendHint( "You have broken your legs", 1)
  12.         if string.find(ply:GetModel(), 'female') then
  13.             ply:EmitSound('vo/npc/female01/myleg01.wav') else  
  14.             ply:EmitSound('vo/npc/male01/myleg01.wav')
  15.         end
  16.     elseif hitgroup==HITGROUP_STOMACH then
  17.         if string.find(ply:GetModel(), 'female') then
  18.             ply:EmitSound('vo/npc/female01/mygut02.wav')
  19.         else  
  20.             ply:EmitSound('vo/npc/male01/mygut02.wav')
  21.         end
  22.     end
  23. end
  24. hook.Add("ScalePlayerDamage", "scaleplayerDamage", MyLegs)
  25.  
  26. local nextCheck=0
  27. hook.Add('Think', 'fixLegs', function()
  28.     if CurTime()>nextCheck then
  29.         for f, v in pairs(player.GetAll()) do
  30.             if v.LegsDamaged then
  31.                 if v:Health()>=100 then
  32.                     v:SetWalkSpeed(v.lboldwalkspeed)
  33.                     v:SetRunSpeed(v.lboldrunspeed)
  34.                     v.LegsDamaged=false
  35.                     v.lboldwalkspeed=nil
  36.                     v.lboldrunspeed=nil
  37.                 end
  38.             end
  39.         end
  40.         nextCheck=CurTime()+1
  41.     end
  42. end)
Advertisement
Add Comment
Please, Sign In to add comment