Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #include <sourcemod>
- #pragma newdecls required
- Handle Timers = null;
- public Plugin myinfo =
- {
- name = "[L4D2] Spawn Tank",
- author = "dr_lex & BHaType",
- description = "Spawn Tank",
- version = "0.1",
- url = ""
- }
- public void OnPluginStart()
- {
- HookEvent("round_start", Event_RoundStart);
- }
- public void OnMapStart()
- {
- if (Timers != null)
- {
- CloseHandle(Timers);
- Timers = null;
- }
- 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;
- }
- }
- 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