Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. function CorpsEating( ply, mv, usercmd )
  2. local trace = ply:GetEyeTrace()
  3. if ( ply:GetNWInt("RCells", 0) >= GHOULLIMITRC and ply:KeyDown( IN_USE ) ) then
  4. if trace.HitPos:Distance(ply:GetShootPos()) <= 75 then
  5. if trace.Entity:GetClass() == "prop_ragdoll" and trace.Entity:GetNWInt("CorpsRCells", 0 ) > 0 then
  6. if ply.corpsentity != trace.Entity then
  7. ply.corpsentity = trace.Entity
  8. ply:SetNWInt("CorpsDelay", CurTime() + CORPSEATINGTIME )
  9. elseif ply:GetNWInt("CorpsDelay", 0 ) < CurTime() and ply.corpsentity == trace.Entity then
  10. ply:SetNWInt("CorpsDelay", 0 )
  11. ply.corpsentity = NULL
  12. if trace.Entity:GetNWInt("CorpsOriginalOwner", ply:UniqueID() ) == ply:UniqueID() then
  13. if ply:GetNWInt("RCells", 1000 ) >= GHOULLIMITRC then
  14. if ply.EatDelay < CurTime() then
  15. ply.EatDelay = CurTime() + 120
  16. ply:SetNWInt("RCells", math.max(GHOULLIMITRC, ply:GetNWInt("RCells", 1000 ) - trace.Entity:GetNWInt("CorpsRCells", 5 ) ) )
  17. end
  18. ply:SetNWInt("TKGFood", math.max( 0, ply:GetNWInt("TKGFood") - trace.Entity:GetNWInt("TKGFood") ) )
  19. end
  20. trace.Entity:Remove()
  21. else
  22. ply:SetNWInt("RCells", math.max(GHOULLIMITRC, ply:GetNWInt("RCells", 1000 ) + trace.Entity:GetNWInt("CorpsRCells", 5 ) ) )
  23. ply:EmitSound("vo/sandwicheat09.mp3", 75, 100, 0.6)
  24. ply:SetNWInt("TKGFood", math.min(ply:GetNWInt("TKGMaxFood"), ply:GetNWInt("TKGFood") + trace.Entity:GetNWInt("TKGFood") ) )
  25. trace.Entity:Remove()
  26. end
  27. end
  28. end
  29. end
  30. end
  31. if ply:KeyReleased( IN_USE ) or trace.HitPos:Distance(ply:GetShootPos()) > 75 or trace.Entity != ply.corpsentity then
  32. if ply.corpsentity != NULL then
  33. ply.corpsentity = NULL
  34. ply:SetNWInt("CorpsDelay", 0 )
  35. end
  36. end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement