Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. #pragma semicolon 1
  2. #include <sourcemod>
  3. #define PLUGIN_VERSION "1.0"
  4.  
  5. public Plugin:myinfo =
  6. {
  7. name = "[L4D & L4D2] MoreDirectorBosses",
  8. author = "ConnerRia",
  9. description = "A simple plugin that forces the director to spawn multiple witches each map alongside one tank. More witches, bitches! ",
  10. version = PLUGIN_VERSION,
  11. url = "N/A"
  12. }
  13.  
  14. new bool: bHasTankSpawned = false;
  15.  
  16.  
  17. public OnPluginStart()
  18. {
  19. decl String:game_name[64];
  20. GetGameFolderName(game_name, sizeof(game_name));
  21. if (!StrEqual(game_name, "left4dead2", false) && !StrEqual(game_name, "left4dead", false))
  22. {
  23. SetFailState("Plugin supports Left 4 Dead series only.");
  24. }
  25. CreateConVar("l4d_moredirectorbosses_version", PLUGIN_VERSION, "Version of MoreDirectorBosses on this server", FCVAR_PLUGIN|FCVAR_NOTIFY|FCVAR_REPLICATED|FCVAR_DONTRECORD);
  26. HookEvent("player_left_start_area", Event_PlayerLeftStartArea);
  27. HookEvent("door_open", Event_DoorOpen);
  28. HookEvent("round_start", Event_RoundStart);
  29. HookEvent("witch_spawn", Event_Witch);
  30. HookEvent("tank_spawn", EventHook:OnTankSpawn, EventHookMode_PostNoCopy);
  31. }
  32.  
  33. public OnMapStart()
  34. {
  35. SetConVarInt(FindConVar("director_force_tank"), 0, true, false);
  36. SetConVarInt(FindConVar("director_force_witch"), 1, true, false);
  37. bHasTankSpawned = false;
  38. }
  39.  
  40. public Action: Event_PlayerLeftStartArea(Handle:event, const String:name[], bool:dontBroadcast)
  41. {
  42. SetConVarInt(FindConVar("director_force_tank"), 0, true, false);
  43. SetConVarInt(FindConVar("director_force_witch"), 1, true, false);
  44. bHasTankSpawned = false;
  45. }
  46.  
  47. public Action: Event_DoorOpen(Handle:event, const String:name[], bool:dontBroadcast)
  48. {
  49. new bool:safe = GetEventBool(event, "checkpoint");
  50.  
  51. if (safe)
  52. {
  53. SetConVarInt(FindConVar("director_force_tank"), 0, true, false);
  54. SetConVarInt(FindConVar("director_force_witch"), 1, true, false);
  55. bHasTankSpawned = false;
  56. }
  57. }
  58.  
  59. public Action: Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast) // Version 1.2
  60. {
  61. SetConVarInt(FindConVar("director_force_tank"), 0, true, false);
  62. SetConVarInt(FindConVar("director_force_witch"), 1, true, false);
  63. bHasTankSpawned = false;
  64. }
  65.  
  66. public Action:Event_Witch(Handle:event, const String:name[], bool:dontBroadcast)
  67. {
  68. decl String:mapname[128];
  69. GetCurrentMap(mapname, sizeof(mapname));
  70. // To maximize witch spawns, we dont want to force tank on finale maps, maps with no tanks or maps with static tank spawns.
  71. if (!StrEqual(mapname, "c7m1_docks") && !StrEqual(mapname, "c13m2_southpinestream") && !StrEqual(mapname, "c1m1_hotel") && !StrEqual(mapname, "c8m1_apartment") && !StrEqual(mapname, "c9m2_lots"))
  72. {
  73. if (strncmp(mapname, "m5_", 3) == 0)
  74. {
  75. if (!bHasTankSpawned)
  76. {
  77. SetConVarInt(FindConVar("director_force_tank"), 1, true, false);
  78. SetConVarInt(FindConVar("director_force_witch"), 0, true, false);
  79. }
  80. }
  81. }
  82. }
  83.  
  84. public OnTankSpawn()
  85. {
  86. if (!bHasTankSpawned)
  87. {
  88. SetConVarInt(FindConVar("director_force_tank"), 0, true, false);
  89. SetConVarInt(FindConVar("director_force_witch"), 1, true, false);
  90. bHasTankSpawned = true;
  91. }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement