HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. //Terminate:
  2. #pragma semicolon 1
  3.  
  4. //Includes:
  5. #include <sourcemod>
  6. #include <sdktools>
  7. #include <tf2>
  8.  
  9. //Global:
  10. static Health[33];
  11. static Float:PrethinkBuffer;
  12.  
  13. //Weapons:
  14. static String:GibWeapons[6][32] = {"sniper", "knife", "shotgun", "scattergun", "minigun", "flame"};
  15. static String:MeleeWeapons[8][32] = {"club", "bat", "shovel", "axe", "bottle", "fists", "wrench", "bonesaw"};
  16.  
  17. //Write:
  18. WriteParticle(Ent, String:ParticleName[])
  19. {
  20.  
  21. //Declare:
  22. decl Particle;
  23. decl String:tName[64];
  24.  
  25. //Initialize:
  26. Particle = CreateEntityByName("info_particle_system");
  27.  
  28. //Validate:
  29. if(IsValidEdict(Particle))
  30. {
  31.  
  32. //Declare:
  33. decl Float:Position[3], Float:Angles[3];
  34.  
  35. //Initialize:
  36. Angles[0] = GetRandomFloat(0.0, 360.0);
  37. Angles[1] = GetRandomFloat(0.0, 15.0);
  38. Angles[2] = GetRandomFloat(0.0, 15.0);
  39.  
  40. //Origin:
  41. GetEntPropVector(Ent, Prop_Send, "m_vecOrigin", Position);
  42. Position[2] += GetRandomFloat(35.0, 65.0);
  43. TeleportEntity(Particle, Position, Angles, NULL_VECTOR);
  44.  
  45. //Properties:
  46. GetEntPropString(Ent, Prop_Data, "m_iName", tName, sizeof(tName));
  47. DispatchKeyValue(Particle, "targetname", "TF2Particle");
  48. DispatchKeyValue(Particle, "parentname", tName);
  49. DispatchKeyValue(Particle, "effect_name", ParticleName);
  50.  
  51. //Spawn:
  52. DispatchSpawn(Particle);
  53.  
  54. //Parent:
  55. SetVariantString(tName);
  56. AcceptEntityInput(Particle, "SetParent", -1, -1, 0);
  57. ActivateEntity(Particle);
  58. AcceptEntityInput(Particle, "start");
  59.  
  60. //Delete:
  61. CreateTimer(3.0, DeleteParticle, Particle);
  62. }
  63. }
  64.  
  65. //Delete:
  66. public Action:DeleteParticle(Handle:Timer, any:Particle)
  67. {
  68.  
  69. //Validate:
  70. if(IsValidEntity(Particle))
  71. {
  72.  
  73. //Declare:
  74. decl String:Classname[64];
  75.  
  76. //Initialize:
  77. GetEdictClassname(Particle, Classname, sizeof(Classname));
  78.  
  79. //Is a Particle:
  80. if(StrEqual(Classname, "info_particle_system", false))
  81. {
  82.  
  83. //Delete:
  84. RemoveEdict(Particle);
  85. }
  86. }
  87. }
  88.  
  89. //Bleed:
  90. public Action:Bleed(Handle:Timer, any:Client)
  91. {
  92.  
  93. //Bleed:
  94. WriteParticle(Client, "blood_spray_red_01_far");
  95. WriteParticle(Client, "blood_impact_red_01");
  96. }
  97.  
  98. //Spawn:
  99. public EventSpawn(Handle:Event, const String:Name[], bool:Broadcast)
  100. {
  101.  
  102. //Declare:
  103. decl Client;
  104.  
  105. //Initialize:
  106. Client = GetClientOfUserId(GetEventInt(Event, "userid"));
  107.  
  108. //Save HP:
  109. CreateTimer(0.1, UpdateHealth, Client);
  110. }
  111.  
  112. //Update Health:
  113. public Action:UpdateHealth(Handle:Timer, any:Client)
  114. {
  115.  
  116. //Save:
  117. Health[Client] = GetClientHealth(Client);
  118. }
  119.  
  120. //Damage:
  121. public EventDamage(Handle:Event, const String:Name[], bool:Broadcast)
  122. {
  123.  
  124. //Declare:
  125. decl Client, Attacker;
  126.  
  127. //Initialize:
  128. Client = GetClientOfUserId(GetEventInt(Event, "userid"));
  129. Attacker = GetClientOfUserId(GetEventInt(Event, "attacker"));
  130.  
  131. //World:
  132. if(Attacker != 0 && Attacker != Client)
  133. {
  134.  
  135. //In-Game:
  136. if(IsClientInGame(Client) && IsClientInGame(Attacker))
  137. {
  138.  
  139. //Declare:
  140. decl String:WeaponName[64];
  141.  
  142. //Initialize:
  143. GetClientWeapon(Attacker, WeaponName, sizeof(WeaponName));
  144.  
  145. //Loop:
  146. for(new X = 0; X < 8; X++)
  147. {
  148.  
  149. //Compare:
  150. if(StrContains(WeaponName, MeleeWeapons[X], false) != -1)
  151. {
  152.  
  153. //Write:
  154. WriteParticle(Client, "blood_impact_red_01_chunk");
  155. }
  156. }
  157. }
  158. }
  159. }
  160.  
  161. //Death:
  162. public EventDeath(Handle:Event, const String:Name[], bool:Broadcast)
  163. {
  164.  
  165. //Declare:
  166. decl Client, Attacker;
  167. decl Float:ClientOrigin[3];
  168.  
  169. //Initialize:
  170. Client = GetClientOfUserId(GetEventInt(Event, "userid"));
  171. Attacker = GetClientOfUserId(GetEventInt(Event, "attacker"));
  172. GetClientAbsOrigin(Client, ClientOrigin);
  173.  
  174. //World:
  175. if(Attacker != 0 && Attacker != Client)
  176. {
  177.  
  178. //In-Game:
  179. if(IsClientInGame(Client) && IsClientInGame(Attacker))
  180. {
  181.  
  182. //Declare:
  183. decl String:WeaponName[64];
  184.  
  185. //Initialize:
  186. GetClientWeapon(Attacker, WeaponName, sizeof(WeaponName));
  187.  
  188. //Loop:
  189. for(new X = 0; X < 6; X++)
  190. {
  191.  
  192. //Compare:
  193. if(StrContains(WeaponName, GibWeapons[X], false) != -1)
  194. {
  195.  
  196. //Declare:
  197. decl Ent;
  198.  
  199. //Initialize:
  200. Ent = CreateEntityByName("tf_ragdoll");
  201.  
  202. //Write:
  203. SetEntPropVector(Ent, Prop_Send, "m_vecRagdollOrigin", ClientOrigin);
  204. SetEntProp(Ent, Prop_Send, "m_iPlayerIndex", Client);
  205. SetEntPropVector(Ent, Prop_Send, "m_vecForce", NULL_VECTOR);
  206. SetEntPropVector(Ent, Prop_Send, "m_vecRagdollVelocity", NULL_VECTOR);
  207. SetEntProp(Ent, Prop_Send, "m_bGib", 1);
  208.  
  209. //Send:
  210. DispatchSpawn(Ent);
  211.  
  212. //Remove Body:
  213. CreateTimer(0.1, RemoveBody, Client);
  214. CreateTimer(15.0, RemoveGibs, Ent);
  215. }
  216. }
  217. }
  218. }
  219. }
  220.  
  221. //Remove Body:
  222. public Action:RemoveBody(Handle:Timer, any:Client)
  223. {
  224.  
  225. //Declare:
  226. decl BodyRagdoll;
  227.  
  228. //Initialize:
  229. BodyRagdoll = GetEntPropEnt(Client, Prop_Send, "m_hRagdoll");
  230.  
  231. //Remove:
  232. if(IsValidEdict(BodyRagdoll)) RemoveEdict(BodyRagdoll);
  233. }
  234.  
  235. //Remove Gibs:
  236. public Action:RemoveGibs(Handle:Timer, any:Ent)
  237. {
  238.  
  239. //Validate:
  240. if(IsValidEntity(Ent))
  241. {
  242.  
  243. //Declare:
  244. decl String:Classname[64];
  245.  
  246. //Initialize:
  247. GetEdictClassname(Ent, Classname, sizeof(Classname));
  248.  
  249. //Is a Particle:
  250. if(StrEqual(Classname, "tf_ragdoll", false))
  251. {
  252.  
  253. //Delete:
  254. RemoveEdict(Ent);
  255. }
  256. }
  257. }
  258.  
  259. //Pre-Think:
  260. public OnGameFrame()
  261. {
  262.  
  263. //Think Overflow:
  264. if(PrethinkBuffer <= (GetGameTime() - 10))
  265. {
  266.  
  267. //Refresh:
  268. PrethinkBuffer = GetGameTime();
  269.  
  270. //Declare:
  271. decl MaxPlayers;
  272.  
  273. //Initialize:
  274. MaxPlayers = GetMaxClients();
  275.  
  276. //Loop:
  277. for(new Client = 1; Client <= MaxPlayers; Client++)
  278. {
  279.  
  280. //Connected:
  281. if(IsClientInGame(Client))
  282. {
  283.  
  284. //Alive:
  285. if(IsPlayerAlive(Client))
  286. {
  287.  
  288. //Declare:
  289. decl HP;
  290.  
  291. //Initialize:
  292. HP = GetClientHealth(Client);
  293.  
  294. //Bleed:
  295. if(HP < Health[Client]) CreateTimer(GetRandomFloat(0.0, 10.0), Bleed, Client);
  296. }
  297. }
  298. }
  299. }
  300. }
  301.  
  302. //Information:
  303. public Plugin:myinfo =
  304. {
  305.  
  306. //Initialize:
  307. name = "TF2 Gore",
  308. author = "Joe 'Pinkfairie' Maley",
  309. description = "Ha megsebeznek nagyon folyik a vered",
  310. version = "2.0",
  311. url = "www.sourcemod.net"
  312. }
  313.  
  314. //Initation:
  315. public OnPluginStart()
  316. {
  317.  
  318. //Register:
  319. PrintToConsole(0, "[SM] TF2 Gore v2.0 by Pinkfairie betoltes sikeres!");
  320.  
  321. //Events:
  322. HookEvent("player_hurt", EventDamage);
  323. HookEvent("player_death", EventDeath);
  324. HookEvent("player_spawn", EventSpawn);
  325.  
  326. //Server Variable:
  327. CreateConVar("tf2gore_version", "2.0", "TF2 Gore Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
  328. }
  329. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  330. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  331. */
  332.