Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #include <sourcemod>
- #pragma newdecls required
- bool g_stop_event, g_stop_event2;
- Handle g_iEnable = null, g_iInterval = null, g_qInterval = null, g_iInterval2 = null, g_qInterval2 = null, g_iEnable_MissionLost = null;
- Handle g_Timer = null, g_Timer2 = null;
- public void OnPluginStart()
- {
- g_iEnable = CreateConVar("sm_enable_unlocked_tank","1", "0:Выкл. 1:Вкл.", FCVAR_NOTIFY);
- g_iEnable_MissionLost = CreateConVar("sm_enable_mission_lost","1", "Вызвать танка если команда проиграла? 0:Выкл. 1:Вкл.", FCVAR_NOTIFY);
- g_iInterval = CreateConVar("sm_interval_1","90.0", "Первое рандомное время.", FCVAR_NOTIFY);
- g_qInterval = CreateConVar("sm_interval_2","180.0", "Второе рандомное время.", FCVAR_NOTIFY);
- g_iInterval2 = CreateConVar("sm_interval2_1","120.0", "Первое рандомное время.", FCVAR_NOTIFY);
- g_qInterval2 = CreateConVar("sm_interval2_2","240.0", "Второе рандомное время.", FCVAR_NOTIFY);
- HookEvent("player_left_checkpoint", EventPlayerHook);
- HookEvent("round_start", ResetBool);
- HookEvent("round_end", ResetBool);
- }
- public void EventPlayerHook(Event event, const char[] name, bool dontBroadcast)
- {
- if (!GetConVarInt(g_iEnable))
- {
- if (g_stop_event)
- {
- if (g_Timer != null)
- {
- delete(g_Timer);
- g_Timer = null;
- }
- g_Timer = CreateTimer(GetRandomInt(0, 1) ? GetConVarFloat(g_iInterval) : GetConVarFloat(g_qInterval), SpawnTank, _, TIMER_FLAG_NO_MAPCHANGE);
- g_stop_event = true;
- }
- if (g_stop_event2)
- {
- if (g_Timer2 != null)
- {
- delete(g_Timer2);
- g_Timer2 = null;
- }
- g_Timer2 = CreateTimer(GetRandomInt(0, 1) ? GetConVarFloat(g_iInterval2) : GetConVarFloat(g_qInterval2), SpawnWitch, _, TIMER_FLAG_NO_MAPCHANGE);
- g_stop_event2 = true;
- }
- }
- }
- public void OnMapStart()
- {
- g_stop_event = true;
- g_stop_event2 = true;
- g_Timer = null;
- g_Timer2 = null;
- if (!IsModelPrecached("models/infected/hulk_dlc3.mdl"))
- {
- PrecacheModel("models/infected/hulk_dlc3.mdl", true);
- }
- }
- public void OnMapEnd()
- {
- g_Timer = null;
- g_Timer2 = null;
- }
- public void ResetBool(Event event, const char[] name, bool dontBroadcast)
- {
- if (!GetConVarInt(g_iEnable_MissionLost)) return;
- {
- g_stop_event = false;
- g_stop_event2 = false;
- }
- }
- 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");
- break;
- }
- g_Timer = null;
- return Plugin_Stop;
- }
- public Action SpawnWitch(Handle timer)
- {
- for (int i = 1; i <= MaxClients; ++i) if(IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i))
- {
- HxFakeCHEAT(i, "z_spawn_old", "witch auto");
- break;
- }
- g_Timer2 = 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