Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #include <sourcemod>
- #include <sdktools>
- char sMap[64];
- Handle Timers = null;
- ConVar hCount;
- int ghCount = 0;
- new bool:isFinale = false;
- new bool:RestMap = false;
- public Plugin myinfo =
- {
- name = "[L4D2] Spawn Tank",
- author = "dr_lex & BHaType",
- description = "Spawn Tank",
- version = "0.1",
- url = ""
- }
- public void OnPluginStart()
- {
- hCount = CreateConVar("sm_tank_timer", "2", "43126301285", FCVAR_NONE);
- HookEvent("round_start", Event_RoundStart);
- HookEvent("tank_spawn", skuka);
- }
- public Action skuka(Event event, const char[] name, bool dontBroadcast)
- {
- ghCount++;
- }
- public OnMapStart()
- {
- if (Timers != null)
- {
- CloseHandle(Timers);
- Timers = null;
- }
- new FinaleEntity;
- while ((FinaleEntity = FindEntityByClassname(FinaleEntity, "trigger_finale")) != -1)
- {
- isFinale = true;
- }
- GetCurrentMap(sMap, sizeof(sMap));
- if (StrContains(sMap, "c1m1_hotel", true) > 1)
- {
- RestMap = true;
- }
- else if(StrContains(sMap, "c2m1_highway", true) > 1)
- {
- RestMap = true;
- }
- else if(StrContains(sMap, "c3m1_plankcountry", true) > 1)
- {
- RestMap = true;
- }
- else if(StrContains(sMap, "c4m1_milltown_a", true) > 1)
- {
- RestMap = true;
- }
- else if(StrContains(sMap, "c5m1_waterfront", true) > 1)
- {
- RestMap = true;
- }
- else if(StrContains(sMap, "c6m1_riverbank", true) > 1)
- {
- RestMap = true;
- }
- else if(StrContains(sMap, "c7m1_docks", true) > 1)
- {
- RestMap = true;
- }
- else if(StrContains(sMap, "c8m1_apartment", true) > 1)
- {
- RestMap = true;
- }
- else if(StrContains(sMap, "c10m1_caves", true) > 1)
- {
- RestMap = true;
- }
- else if(StrContains(sMap, "c11m1_greenhouse", true) > 1)
- {
- RestMap = true;
- }
- else if(StrContains(sMap, "c13m1_alpinecreek", true) > 1)
- {
- RestMap = true;
- }
- else if(StrContains(sMap, "c6m2_bedlam", true) > 1)
- {
- RestMap = true;
- }
- else if(RestMap == false)
- {
- if(isFinale == false)
- {
- if(ghCount < GetConVarInt(hCount))
- {
- float TimerTank = GetRandomFloat(90.0, 240.0);
- Timers = CreateTimer(TimerTank, SpawnTank);
- }
- }
- }
- }
- public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
- {
- if (Timers != null)
- {
- CloseHandle(Timers);
- Timers = null;
- }
- ghCount = 0;
- }
- public Action SpawnTank(Handle timer)
- {
- for (int i = 1; i <= MaxClients; ++i) if(IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i))
- {
- HxFakeCHEAT(i, "z_spawn_old", "tank auto");
- }
- Timers = null;
- return Plugin_Stop;
- }
- void HxFakeCHEAT(int &client, const char[] sCmd, const char[] sArg)
- {
- int iFlags = GetCommandFlags(sCmd);
- SetCommandFlags(sCmd, iFlags & ~FCVAR_CHEAT);
- FakeClientCommand(client, "%s %s", sCmd, sArg);
- SetCommandFlags(sCmd, iFlags);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement