HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. [Cvars]
  3. // 1 by round, 0 by map (Default: 1)
  4. sm_random_c4t_mode <1 or 0>
  5. // Min time for random c4 time (Default: 0)
  6. sm_random_c4t_mintime <value>
  7. // Max time for random c4 time (Default: 35)
  8. sm_random_c4t_maxtime <value>
  9.  
  10. [Changelog]
  11. 0.0.1 - First release playable.
  12. */
  13.  
  14. #include <sourcemod>
  15. #pragma semicolon 1
  16.  
  17. #define Version "0.0.1"
  18.  
  19. new Handle:CvarMode;
  20. new Handle:CvarMin;
  21. new Handle:CvarMax;
  22. new Handle:mp_c4timer;
  23. new Random;
  24. new bool:IsHooked;
  25.  
  26. public Plugin:myinfo =
  27. {
  28. name = "Random C4 Time",
  29. author = "Dark Style",
  30. description = "Ez a plugin, véletlenszerű C4 Időt mutat map/körönként.",
  31. version = Version,
  32. url = "http://forums.alliedmods.net"
  33. };
  34.  
  35. public OnPluginStart()
  36. {
  37. CvarMode = CreateConVar("sm_random_c4t_mode", "1", "1 - Körönként / 0 - Maponként", FCVAR_PLUGIN, true, 0.0, true, 1.0);
  38. CvarMin = CreateConVar("sm_random_c4t_mintime", "5", "Minimum idő", FCVAR_PLUGIN, true, 0.0);
  39. CvarMax = CreateConVar("sm_random_c4t_maxtime", "45", "Maximum idő", FCVAR_PLUGIN, true, 1.0);
  40.  
  41. mp_c4timer = FindConVar("mp_c4timer");
  42.  
  43. if(GetConVarInt(CvarMode) == 0)
  44. {
  45. Functions();
  46.  
  47. PrintToServer("[SM] Véletlenszerű C4 Idő [MAP]: %i Másodperc%s", Random, (Random > 1) ? "s." : ".");
  48.  
  49. return;
  50. }
  51.  
  52. HookEvent("round_start", Event_RoundStart);
  53.  
  54. IsHooked = true;
  55. }
  56.  
  57. public OnPluginEnd()
  58. {
  59. if(IsHooked == true) UnhookEvent("round_start", Event_RoundStart);
  60. }
  61.  
  62. public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
  63. {
  64. Functions();
  65.  
  66. PrintToChatAll("[SM] Véletlenszerű C4 Idő [KÖR]: %i Másodperc%s", Random, (Random > 1) ? "s." : ".");
  67. }
  68.  
  69. Functions()
  70. {
  71. Random = GetRandomInt(GetConVarInt(CvarMin), GetConVarInt(CvarMax));
  72. SetConVarInt(mp_c4timer, Random);
  73. }
  74.