Advertisement
FlacoBey

Untitled

Jan 31st, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. #pragma semicolon 1
  2. #include <sourcemod>
  3. #include <sdktools>
  4.  
  5. char sMap[64];
  6. Handle Timers = null;
  7. ConVar hCount;
  8. int ghCount = 0;
  9.  
  10. new bool:isFinale = false;
  11. new bool:RestMap = false;
  12.  
  13. public Plugin myinfo =
  14. {
  15. name = "[L4D2] Spawn Tank",
  16. author = "dr_lex & BHaType",
  17. description = "Spawn Tank",
  18. version = "0.1",
  19. url = ""
  20. }
  21.  
  22. public void OnPluginStart()
  23. {
  24. hCount = CreateConVar("sm_tank_timer", "2", "43126301285", FCVAR_NONE);
  25. HookEvent("round_start", Event_RoundStart);
  26. HookEvent("tank_spawn", skuka);
  27. }
  28.  
  29. public Action skuka(Event event, const char[] name, bool dontBroadcast)
  30. {
  31. ghCount++;
  32. }
  33.  
  34. public OnMapStart()
  35. {
  36. if (Timers != null)
  37. {
  38. CloseHandle(Timers);
  39. Timers = null;
  40. }
  41.  
  42. new FinaleEntity;
  43. while ((FinaleEntity = FindEntityByClassname(FinaleEntity, "trigger_finale")) != -1)
  44. {
  45. isFinale = true;
  46. }
  47.  
  48. GetCurrentMap(sMap, sizeof(sMap));
  49. if (StrContains(sMap, "c1m1_hotel", true) > 1)
  50. {
  51. RestMap = true;
  52. }
  53. else if(StrContains(sMap, "c2m1_highway", true) > 1)
  54. {
  55. RestMap = true;
  56. }
  57. else if(StrContains(sMap, "c3m1_plankcountry", true) > 1)
  58. {
  59. RestMap = true;
  60. }
  61. else if(StrContains(sMap, "c4m1_milltown_a", true) > 1)
  62. {
  63. RestMap = true;
  64. }
  65. else if(StrContains(sMap, "c5m1_waterfront", true) > 1)
  66. {
  67. RestMap = true;
  68. }
  69. else if(StrContains(sMap, "c6m1_riverbank", true) > 1)
  70. {
  71. RestMap = true;
  72. }
  73. else if(StrContains(sMap, "c7m1_docks", true) > 1)
  74. {
  75. RestMap = true;
  76. }
  77. else if(StrContains(sMap, "c8m1_apartment", true) > 1)
  78. {
  79. RestMap = true;
  80. }
  81. else if(StrContains(sMap, "c10m1_caves", true) > 1)
  82. {
  83. RestMap = true;
  84. }
  85. else if(StrContains(sMap, "c11m1_greenhouse", true) > 1)
  86. {
  87. RestMap = true;
  88. }
  89. else if(StrContains(sMap, "c13m1_alpinecreek", true) > 1)
  90. {
  91. RestMap = true;
  92. }
  93. else if(StrContains(sMap, "c6m2_bedlam", true) > 1)
  94. {
  95. RestMap = true;
  96. }
  97. else if(RestMap == false)
  98. {
  99. if(isFinale == false)
  100. {
  101. if(ghCount < GetConVarInt(hCount))
  102. {
  103. float TimerTank = GetRandomFloat(90.0, 240.0);
  104. Timers = CreateTimer(TimerTank, SpawnTank);
  105. }
  106. }
  107. }
  108. }
  109.  
  110. public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
  111. {
  112. if (Timers != null)
  113. {
  114. CloseHandle(Timers);
  115. Timers = null;
  116. }
  117. ghCount = 0;
  118. }
  119.  
  120. public Action SpawnTank(Handle timer)
  121. {
  122. for (int i = 1; i <= MaxClients; ++i) if(IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i))
  123. {
  124. HxFakeCHEAT(i, "z_spawn_old", "tank auto");
  125. }
  126.  
  127. Timers = null;
  128.  
  129. return Plugin_Stop;
  130. }
  131.  
  132. void HxFakeCHEAT(int &client, const char[] sCmd, const char[] sArg)
  133. {
  134. int iFlags = GetCommandFlags(sCmd);
  135. SetCommandFlags(sCmd, iFlags & ~FCVAR_CHEAT);
  136. FakeClientCommand(client, "%s %s", sCmd, sArg);
  137. SetCommandFlags(sCmd, iFlags);
  138. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement