HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /**
  2.  *
  3.  * No Team Flash SourceMOD Plugin
  4.  * Copyright (c) 2008 SAMURAI
  5.  *
  6.  * If you don't have what to to visit http://www.cs-utilz.net
  7.  * Thanks to Kigen for fixing some issues
  8.  *
  9.  * Fordította: BBk
  10.  *
  11. **/
  12.  
  13. #include <sourcemod>
  14. #include <sdktools>
  15.  
  16. public Plugin:myinfo =
  17. {
  18. name = "No Team Flash",
  19. author = "SAMURAI and Kigen",
  20. description = "Amikor eldobja a flasht a jatekos, a csapata tobbi tagja nem vakul be tole",
  21. version = "0.3",
  22. url = "www.cs-utilz.net"
  23. }
  24.  
  25.  
  26. new g_FlashOwner = -1;
  27.  
  28. #define ALPHA_SET 0.5
  29. new g_iFlashAlpha = -1;
  30.  
  31. new Handle:g_iConVar = INVALID_HANDLE;
  32.  
  33. public OnPluginStart()
  34. {
  35. HookEvent("flashbang_detonate", Event_Flashbang_detonate);
  36. HookEvent("player_blind", Event_Flashed);
  37.  
  38. g_iFlashAlpha = FindSendPropOffs("CCSPlayer", "m_flFlashMaxAlpha");
  39. if ( g_iFlashAlpha == -1 )
  40. SetFailState("Failed to find \"m_flFlashMaxAlpha\".");
  41.  
  42. g_iConVar = CreateConVar("no_team_flash","1"); // 0 - plugin disabled ; 1 - enabled
  43. }
  44.  
  45.  
  46. public Action:Event_Flashbang_detonate(Handle:event, const String:name[], bool:dontBroadcast)
  47. {
  48. new client = GetClientOfUserId(GetEventInt(event,"userid"));
  49.  
  50. if( !client || !IsClientConnected(client) || !IsClientInGame(client) || !IsPlayerAlive(client) )
  51. {
  52. g_FlashOwner = -1;
  53. return Plugin_Continue;
  54. }
  55.  
  56. g_FlashOwner = client;
  57.  
  58. return Plugin_Continue;
  59. }
  60.  
  61.  
  62. public Action:Event_Flashed(Handle:event, const String:name[], bool:dontBroadcast)
  63. {
  64. new client = GetClientOfUserId(GetEventInt(event,"userid"));
  65.  
  66. if ( !GetConVarBool(g_iConVar) || !client || !IsClientInGame(client) )
  67. return Plugin_Continue;
  68.  
  69. if ( !IsPlayerAlive(client) )
  70. {
  71. //PrintToChat(client, "Flash!");
  72. SetEntDataFloat(client, g_iFlashAlpha, ALPHA_SET);
  73. return Plugin_Continue;
  74. }
  75.  
  76. CreateTimer(0.01, BlindTime, client);
  77. return Plugin_Continue;
  78. }
  79.  
  80. public Action:BlindTime(Handle:timer, any:client)
  81. {
  82. if ( g_FlashOwner != -1 && client != g_FlashOwner && IsClientInGame(client) && IsPlayerAlive(client) && IsClientInGame(g_FlashOwner) && IsPlayerAlive(g_FlashOwner) && GetClientTeam(client) == GetClientTeam(g_FlashOwner) )
  83. SetEntDataFloat(client, g_iFlashAlpha, ALPHA_SET);
  84.  
  85. return Plugin_Stop;
  86. }