HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. public Plugin:myinfo =
  2. {
  3. name = "CS:GO Goremod",
  4. author = "Joe 'DiscoBBQ' Maley",
  5. description = "Noveli a vert",
  6. version = "1.3",
  7. url = "jmaley@clemson.edu"
  8. }
  9.  
  10. #include <sourcemod>
  11. #include <sdktools>
  12.  
  13. new bloodDecal[13];
  14. new Float:overflow[MAXPLAYERS + 1];
  15.  
  16. ChanceParticle(client, chance, String:particleName[], bool:dead = false, bool:headshot = false)
  17. {
  18. new roll;
  19. roll = GetRandomInt(1, 100);
  20.  
  21. if (roll <= chance)
  22. CreateParticle(client, particleName, dead, headshot);
  23. }
  24.  
  25. CreateParticle(client, String:particleName[], bool:dead, bool:headshot)
  26. {
  27. new particle;
  28. particle = CreateEntityByName("info_particle_system");
  29.  
  30. if (IsValidEdict(particle) && IsValidEdict(client))
  31. {
  32. new Float:origin[3];
  33. new String:targetName[64];
  34.  
  35. GetEntPropVector(client, Prop_Send, "m_vecOrigin", origin);
  36.  
  37. origin[2] += GetRandomFloat(25.0, 75.0);
  38.  
  39. TeleportEntity(particle, origin, NULL_VECTOR, NULL_VECTOR);
  40.  
  41. Format(targetName, sizeof(targetName), "Client%d", client);
  42. DispatchKeyValue(client, "targetname", targetName);
  43. GetEntPropString(client, Prop_Data, "m_iName", targetName, sizeof(targetName));
  44.  
  45. DispatchKeyValue(particle, "targetname", "CSGOParticle");
  46. DispatchKeyValue(particle, "parentname", targetName);
  47. DispatchKeyValue(particle, "effect_name", particleName);
  48.  
  49. DispatchSpawn(particle);
  50.  
  51. if(dead)
  52. {
  53. ParentToBody(client, particle, headshot);
  54. }
  55. else
  56. {
  57. SetVariantString(targetName);
  58. AcceptEntityInput(particle, "SetParent", particle, particle, 0);
  59. }
  60.  
  61. ActivateEntity(particle);
  62. AcceptEntityInput(particle, "start");
  63.  
  64. CreateTimer(1.0, DeleteParticle, particle);
  65. }
  66. }
  67.  
  68. public Action:DeleteParticle(Handle:Timer, any:particle)
  69. {
  70. if (IsValidEdict(particle))
  71. {
  72. new String:className[64];
  73.  
  74. GetEdictClassname(particle, className, sizeof(className));
  75.  
  76. if(StrEqual(className, "info_particle_system", false))
  77. RemoveEdict(particle);
  78. }
  79. }
  80.  
  81. ParentToBody(client, particle, bool:headshot = false)
  82. {
  83. if (IsValidEdict(client))
  84. {
  85. new body;
  86. new String:targetName[64], String:className[64];
  87.  
  88. body = GetEntPropEnt(client, Prop_Send, "m_hRagdoll");
  89.  
  90. if (IsValidEdict(body))
  91. {
  92. Format(targetName, sizeof(targetName), "Body%d", body);
  93.  
  94. GetEdictClassname(body, className, sizeof(className));
  95.  
  96. if (IsValidEdict(body) && StrEqual(className, "cs_ragdoll", false))
  97. {
  98. DispatchKeyValue(body, "targetname", targetName);
  99. GetEntPropString(body, Prop_Data, "m_iName", targetName, sizeof(targetName));
  100.  
  101. SetVariantString(targetName);
  102. AcceptEntityInput(particle, "SetParent", particle, particle, 0);
  103.  
  104. if (headshot)
  105. SetVariantString("forward");
  106. else
  107. SetVariantString("primary");
  108.  
  109. AcceptEntityInput(particle, "SetParentAttachment", particle, particle, 0);
  110. }
  111. }
  112. }
  113. }
  114.  
  115. GoreDecal(client, count)
  116. {
  117. new decal;
  118. new Float:origin[3];
  119.  
  120. GetClientAbsOrigin(client, origin);
  121.  
  122. for (new i = 0; i < count; i++)
  123. {
  124. origin[0] += GetRandomFloat(-50.0, 50.0);
  125. origin[1] += GetRandomFloat(-50.0, 50.0);
  126.  
  127. if (GetRandomInt(1, 20) == 20)
  128. decal = GetRandomInt(2, 4);
  129. else
  130. decal = GetRandomInt(5, 12);
  131.  
  132. TE_Start("World Decal");
  133. TE_WriteVector("m_vecOrigin", origin);
  134. TE_WriteNum("m_nIndex", bloodDecal[decal]);
  135. TE_SendToAll();
  136. }
  137. }
  138.  
  139. public EventDamage(Handle:event, const String:name[], bool:broadcast)
  140. {
  141. new client, damage, health;
  142.  
  143. client = GetClientOfUserId(GetEventInt(event, "userid"));
  144. damage = GetEventInt(event, "dmg_health");
  145. health = GetEventInt(event, "health");
  146.  
  147. if (overflow[client] > GetGameTime() - 0.1)
  148. return;
  149.  
  150. overflow[client] = GetGameTime();
  151.  
  152. for (new i = 0; i < 3; i++)
  153. {
  154. ChanceParticle(client, damage, "blood_impact_red_01_backspray");
  155. ChanceParticle(client, damage, "blood_impact_drops1");
  156. ChanceParticle(client, damage, "blood_impact_red_01_drops");
  157. }
  158.  
  159. ChanceParticle(client, damage, "blood_impact_red_01_goop_c");
  160. ChanceParticle(client, damage, "blood_impact_goop_medium");
  161. ChanceParticle(client, damage, "blood_impact_red_01_goop_b");
  162. ChanceParticle(client, damage, "blood_impact_red_01_goop_a");
  163. ChanceParticle(client, damage, "blood_impact_medium");
  164. ChanceParticle(client, damage, "blood_impact_basic");
  165.  
  166. if (health > 0)
  167. GoreDecal(client, (damage / 20));
  168. else
  169. GoreDecal(client, 30);
  170. }
  171.  
  172. public EventDeath(Handle:event, const String:name[], bool:broadcast)
  173. {
  174. new client;
  175. new bool:headshot;
  176.  
  177. client = GetClientOfUserId(GetEventInt(event, "userid"));
  178. headshot = GetEventBool(event, "headshot");
  179.  
  180. ChanceParticle(client, 75, "blood_impact_heavy", true);
  181. ChanceParticle(client, 75, "blood_impact_goop_heavy", true);
  182. ChanceParticle(client, 75, "blood_impact_mist_heavy", true);
  183.  
  184. if (headshot)
  185. {
  186. ChanceParticle(client, 100, "blood_impact_headshot_01c", true, true);
  187. ChanceParticle(client, 100, "blood_impact_red_01_chunk", true, true);
  188. ChanceParticle(client, 100, "blood_impact_headshot_01b", true, true);
  189. ChanceParticle(client, 100, "blood_impact_headshot_01d", true, true);
  190. }
  191. else
  192. {
  193. ChanceParticle(client, 50, "blood_impact_red_01_goop_c");
  194. ChanceParticle(client, 50, "blood_impact_goop_medium");
  195. ChanceParticle(client, 50, "blood_impact_red_01_goop_b");
  196. ChanceParticle(client, 50, "blood_impact_red_01_goop_a");
  197. ChanceParticle(client, 50, "blood_impact_medium");
  198. ChanceParticle(client, 50, "blood_impact_basic");
  199. }
  200. }
  201.  
  202. ForcePrecache(String:particleName[])
  203. {
  204. new particle;
  205.  
  206. particle = CreateEntityByName("info_particle_system");
  207.  
  208. if(IsValidEdict(particle))
  209. {
  210. DispatchKeyValue(particle, "effect_name", particleName);
  211.  
  212. DispatchSpawn(particle);
  213. ActivateEntity(particle);
  214. AcceptEntityInput(particle, "start");
  215.  
  216. CreateTimer(1.0, DeleteParticle, particle, TIMER_FLAG_NO_MAPCHANGE);
  217. }
  218. }
  219.  
  220. public OnMapStart()
  221. {
  222. ForcePrecache("blood_impact_heavy");
  223. ForcePrecache("blood_impact_goop_heavy");
  224. ForcePrecache("blood_impact_red_01_chunk");
  225. ForcePrecache("blood_impact_headshot_01c");
  226. ForcePrecache("blood_impact_headshot_01b");
  227. ForcePrecache("blood_impact_headshot_01d");
  228. ForcePrecache("blood_impact_basic");
  229. ForcePrecache("blood_impact_medium");
  230. ForcePrecache("blood_impact_red_01_goop_a");
  231. ForcePrecache("blood_impact_red_01_goop_b");
  232. ForcePrecache("blood_impact_goop_medium");
  233. ForcePrecache("blood_impact_red_01_goop_c");
  234. ForcePrecache("blood_impact_red_01_drops");
  235. ForcePrecache("blood_impact_drops1");
  236. ForcePrecache("blood_impact_red_01_backspray");
  237.  
  238. bloodDecal[0] = PrecacheDecal("decals/blood_splatter.vtf");
  239. bloodDecal[1] = PrecacheDecal("decals/bloodstain_003.vtf");
  240. bloodDecal[2] = PrecacheDecal("decals/bloodstain_101.vtf");
  241. bloodDecal[3] = PrecacheDecal("decals/bloodstain_002.vtf");
  242. bloodDecal[4] = PrecacheDecal("decals/bloodstain_001.vtf");
  243. bloodDecal[5] = PrecacheDecal("decals/blood8.vtf");
  244. bloodDecal[6] = PrecacheDecal("decals/blood7.vtf");
  245. bloodDecal[7] = PrecacheDecal("decals/blood6.vtf");
  246. bloodDecal[8] = PrecacheDecal("decals/blood5.vtf");
  247. bloodDecal[9] = PrecacheDecal("decals/blood4.vtf");
  248. bloodDecal[10] = PrecacheDecal("decals/blood3.vtf");
  249. bloodDecal[11] = PrecacheDecal("decals/blood2.vtf");
  250. bloodDecal[12] = PrecacheDecal("decals/blood1.vtf");
  251.  
  252. for (new i = 1; i < MaxClients; i++)
  253. overflow[i] = 0.0;
  254. }
  255.  
  256. public OnPluginStart()
  257. {
  258. HookEvent("player_hurt", EventDamage);
  259. HookEvent("player_death", EventDeath);
  260.  
  261. CreateConVar("csgogore_version", "1.3", "Goremod Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
  262. }