Guest User

AcidRainClient

a guest
Jun 7th, 2024
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.59 KB | None | 0 0
  1. function AcidRainDamage(AcidRainEnabled)
  2.  
  3.     if AcidRainEnabled == true then
  4.  
  5.         print("Acid Rain Damage Enabled")
  6.  
  7.         local climateManager = getClimateManager()
  8.        
  9.         if climateManager:isRaining() and getPlayer():isOutside() and getPlayer():getVehicle() == nil then
  10.             local intensity = GetRainIntensity() * 10
  11.             local player = getPlayer()
  12.             local bodyDamage = player:getBodyDamage()
  13.             local randomPart = bodyDamage:getBodyPart(BodyPartType.getRandom())
  14.            
  15.             randomPart:AddDamage(intensity)
  16.             randomPart:setAdditionalPain(intensity * 2)
  17.            
  18.             if RandomInt(100, 1) == 100 then
  19.                 randomPart:setBurned()
  20.             end
  21.  
  22.             if RandomInt(100, 1) > 98 then
  23.                 player:Say(HurtMessageCreate())
  24.             end
  25.  
  26.         end
  27.     end
  28. end
  29.  
  30. function GetRainIntensity()
  31.     return math.max(getClimateManager():getRainIntensity())
  32. end
  33.  
  34. function RandomInt(maxValue, minValue)
  35.     return ZombRand(maxValue) + minValue
  36. end
  37.  
  38. function HurtMessageCreate()
  39.     local hurtMessages = {
  40.         "It burns, it burns!",
  41.         "Agh, fuck! My skin!",
  42.         "Need shelter...",
  43.         "*Fizzles*",
  44.         "I'm melting..."
  45.     }
  46.     return hurtMessages[RandomInt(#hurtMessages, 1)]
  47. end
  48.  
  49. function HandleServerCommand(module, command, args)
  50.  
  51.     if module ~= "MyMod" then return end
  52.     if command == "MyCommand" then
  53.         AcidRainDamage(args)
  54.     end
  55.  
  56. end
  57.  
  58. Events.OnServerCommand.Add(HandleServerCommand)
  59.  
  60. Events.EveryOneMinute.Add(AcidRainDamage)
  61.  
Add Comment
Please, Sign In to add comment