Guest User

Untitled

a guest
Jul 4th, 2026
186
0
264 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. /* SCREAMING INJURED PEDS *
  2. * a GTA V script made by EnforcerZhukov, *
  3. * updated (unofficially) by Xire using ChatGPT *
  4. * https://github.com/David-Lor/ScreamingInjuredPeds */
  5.  
  6. using GTA;
  7. using GTA.Native;
  8. using GTA.Math;
  9. using System;
  10. using System.Collections.Generic;
  11.  
  12. public class ScreamingInjuredPeds : Script
  13. {
  14. // Settings
  15. private bool setBlipsOnInjuredPeds = false;
  16. private int cooldown = 5; //cooldown timer
  17.  
  18. private List<Ped> injured = new List<Ped>();
  19. private List<Ped> injuredRmv = new List<Ped>();
  20. private List<DateTime> execTime = new List<DateTime>();
  21. private Random r = new Random();
  22. private DateTime firstDT;
  23. private TimeSpan dff;
  24.  
  25. private Dictionary<Ped, Blip> blipDict = new Dictionary<Ped, Blip>();
  26.  
  27. public ScreamingInjuredPeds()
  28. {
  29. Tick += OnTick;
  30. Interval = 100;
  31. firstDT = new DateTime(1999, 1, 1);
  32. }
  33.  
  34. void OnTick(object sender, EventArgs e)
  35. {
  36. DateTime now = DateTime.UtcNow;
  37.  
  38. foreach (Ped p in World.GetAllPeds())
  39. {
  40. if (!injured.Contains(p)
  41. && Function.Call<bool>(Hash.IS_PED_HURT, p)
  42. && p.IsAlive && p.IsHuman)
  43. {
  44. injured.Add(p);
  45. execTime.Add(firstDT);
  46. }
  47. }
  48.  
  49. for (int i = injured.Count - 1; i >= 0; i--)
  50. {
  51. Ped p = injured[i];
  52. DateTime prev = execTime[i];
  53. dff = now - prev;
  54.  
  55. if (p.IsDead)
  56. {
  57. injuredRmv.Add(p);
  58. continue;
  59. }
  60.  
  61. bool firstTime = (prev.Year == 1999);
  62. if (firstTime || dff.TotalSeconds >= cooldown)
  63. {
  64. string facialLib = p.Gender == Gender.Female
  65. ? "facials@gen_female@base"
  66. : "facials@gen_male@base";
  67.  
  68. int style = r.Next(0, 3);
  69. if (style == 0)
  70. Function.Call(Hash.PLAY_PAIN, p, 19, 1, 0f);
  71. else if (style == 1)
  72. Function.Call(Hash.PLAY_FACIAL_ANIM, p, "coughing_1", facialLib);
  73. else
  74. {
  75. Function.Call(Hash.PLAY_PAIN, p, 8, 1, 0f);
  76. Function.Call(Hash.PLAY_FACIAL_ANIM, p, "burning_1", facialLib);
  77. }
  78.  
  79. execTime[i] = now;
  80.  
  81. if (setBlipsOnInjuredPeds)
  82. UpdateBlip(p);
  83. }
  84. }
  85.  
  86. foreach (Ped p in injuredRmv)
  87. {
  88. int idx = injured.IndexOf(p);
  89. if (idx >= 0)
  90. {
  91. injured.RemoveAt(idx);
  92. execTime.RemoveAt(idx);
  93. }
  94.  
  95. Function.Call(Hash.DISABLE_PED_PAIN_AUDIO, p, true);
  96. RemoveBlip(p);
  97. }
  98. injuredRmv.Clear();
  99. }
  100.  
  101. private void UpdateBlip(Ped p)
  102. {
  103. Blip existing;
  104. if (blipDict.TryGetValue(p, out existing))
  105. {
  106. if (!existing.Exists() || existing.Sprite == BlipSprite.Dead)
  107. {
  108. Function.Call(Hash.REMOVE_BLIP, existing);
  109. blipDict.Remove(p);
  110. }
  111. }
  112.  
  113. if (!blipDict.ContainsKey(p))
  114. {
  115. Blip b = p.AddBlip();
  116. b.Sprite = BlipSprite.Dead;
  117. b.Color = BlipColor.Yellow;
  118. b.Name = "Injured Ped";
  119. blipDict[p] = b;
  120. }
  121. }
  122.  
  123. private void RemoveBlip(Ped p)
  124. {
  125. Blip b;
  126. if (blipDict.TryGetValue(p, out b))
  127. {
  128. if (b.Exists())
  129. {
  130. Function.Call(Hash.REMOVE_BLIP, b);
  131. }
  132. blipDict.Remove(p);
  133. }
  134. }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment