HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. Special Effects
  3.  
  4. This Will Give Grenade Explosions And Bullet Impacts Cool Fx
  5.  
  6. Avalailable Effects:
  7.  
  8. 1. Sparks
  9. 2. Glow Effect
  10. 3. Energy Splash
  11.  
  12. Fordította: BBk
  13. */
  14.  
  15. #include <sourcemod>
  16. #include <sdktools>
  17.  
  18. #define VERSION "0.2"
  19.  
  20. new Handle:gSwitch;
  21. new Handle:HeNade;
  22. new Handle:Smoke;
  23. new Handle:Flash;
  24. new Handle:Slug;
  25. new Float:Origin[3];
  26. new Glow;
  27.  
  28. public Plugin:myinfo =
  29. {
  30. name = "Special Effects",
  31. author = "Peoples Army",
  32. description = "Specialis Effektek Hozzadasa",
  33. version = VERSION,
  34. url = "www.sourcemod.net"
  35. };
  36.  
  37. // set cvars and hook nade detonation events
  38.  
  39. public OnMapStart()
  40. {
  41. Glow = PrecacheModel("sprites/blueglow1.vmt");
  42. }
  43.  
  44. public OnPluginStart()
  45. {
  46. gSwitch = CreateConVar("nade_fx_on","1","plugin be es kikapcsolasa",FCVAR_NOTIFY);
  47. HeNade = CreateConVar("he_nade_fx","1","beallitja a HE granat Modjat",FCVAR_NOTIFY);
  48. Smoke = CreateConVar("sg_nade_fx","1","beallitja a Fustgranat Modjat",FCVAR_NOTIFY);
  49. Flash = CreateConVar("fb_nade_fx","1","beallitja a Vakito granat Modjat",FCVAR_NOTIFY);
  50. Slug = CreateConVar("slug_fx","1","beallitja a Lovedekek Modjat",FCVAR_NOTIFY);
  51.  
  52. HookEvent("hegrenade_detonate",HeExplode);
  53. HookEvent("flashbang_detonate",FbExplode);
  54. HookEvent("smokegrenade_detonate",SgExplode);
  55. HookEvent("bullet_impact",SlugImpact);
  56. }
  57.  
  58. // catch the x,y,and z of the he nade and do effects based on convar
  59.  
  60. public HeExplode(Handle:event,const String:name[],bool:dontBroadcast)
  61. {
  62. if(GetConVarInt(gSwitch))
  63. {
  64. Origin[0] = GetEventFloat(event,"x");
  65. Origin[1] = GetEventFloat(event,"y");
  66. Origin[2] = GetEventFloat(event,"z");
  67.  
  68. if(GetConVarInt(HeNade)== 1)
  69. {
  70. TE_SetupSparks(Origin,Origin,255,1);
  71. TE_SendToAll();
  72. }else if( GetConVarInt(HeNade)== 2)
  73. {
  74. TE_SetupGlowSprite(Origin,Glow,1.0,1.0,20);
  75. TE_SendToAll();
  76. }else if (GetConVarInt(HeNade)== 3)
  77. {
  78. TE_SetupEnergySplash(Origin,Origin,false);
  79. TE_SendToAll();
  80. }
  81. }
  82. }
  83.  
  84. // catch x,y,z of the flashbang nade and do effects based on convar
  85.  
  86. public FbExplode(Handle:event,const String:name[],bool:dontBroadcast)
  87. {
  88. if(GetConVarInt(gSwitch))
  89. {
  90. Origin[0] = GetEventFloat(event,"x");
  91. Origin[1] = GetEventFloat(event,"y");
  92. Origin[2] = GetEventFloat(event,"z");
  93.  
  94. if(GetConVarInt(Flash)== 1)
  95. {
  96. TE_SetupSparks(Origin,Origin,255,1);
  97. TE_SendToAll();
  98. }else if( GetConVarInt(Flash)== 2)
  99. {
  100. TE_SetupGlowSprite(Origin,Glow,1.0,1.0,20);
  101. TE_SendToAll();
  102. }else if (GetConVarInt(Flash)== 3)
  103. {
  104. TE_SetupEnergySplash(Origin,Origin,false);
  105. TE_SendToAll();
  106. }
  107. }
  108. }
  109.  
  110. // catch x,y,z of the smoke nade and do effects based on cvar
  111.  
  112. public SgExplode(Handle:event,const String:name[],bool:dontBroadcast)
  113. {
  114. if(GetConVarInt(gSwitch))
  115. {
  116. Origin[0] = GetEventFloat(event,"x");
  117. Origin[1] = GetEventFloat(event,"y");
  118. Origin[2] = GetEventFloat(event,"z");
  119.  
  120. if(GetConVarInt(Smoke)== 1)
  121. {
  122. TE_SetupSparks(Origin,Origin,255,1);
  123. TE_SendToAll();
  124. }else if( GetConVarInt(Smoke)== 2)
  125. {
  126. TE_SetupGlowSprite(Origin,Glow,1.0,1.0,20);
  127. TE_SendToAll();
  128. }else if (GetConVarInt(Smoke)== 3)
  129. {
  130. TE_SetupEnergySplash(Origin,Origin,false);
  131. TE_SendToAll();
  132. }
  133. }
  134. }
  135.  
  136. // catch x,y,z of the bullet impact and do effects based on cvar
  137.  
  138. public SlugImpact(Handle:event,const String:name[],bool:dontBroadcast)
  139. {
  140. if(GetConVarInt(gSwitch))
  141. {
  142. Origin[0] = GetEventFloat(event,"x");
  143. Origin[1] = GetEventFloat(event,"y");
  144. Origin[2] = GetEventFloat(event,"z");
  145.  
  146. if(GetConVarInt(Slug)== 1)
  147. {
  148. TE_SetupSparks(Origin,Origin,255,1);
  149. TE_SendToAll();
  150. }else if( GetConVarInt(Slug)== 2)
  151. {
  152. TE_SetupGlowSprite(Origin,Glow,1.0,1.0,20);
  153. TE_SendToAll();
  154. }else if (GetConVarInt(Slug)== 3)
  155. {
  156. TE_SetupEnergySplash(Origin,Origin,false);
  157. TE_SendToAll();
  158. }
  159. }
  160. }