Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Action:timerMainTimer(Handle:timer)
- {
- if(g_bEscapeStarted)
- {
- decl String:map[256];
- GetCurrentMap(map, sizeof(map));
- if(StrEqual(map, "c5m5_bridge"))
- {
- if(!g_bCreateChopperWaitTime)
- {
- g_bCreateChopperWaitTime = true;
- g_iTimeLeft = 120;
- }
- }
- else
- {
- DebugToClient("\x04[DEBUG] \x01Timer is not necessary anymore, killing");
- g_iTimeLeft = GetMapTime();
- return Plugin_Stop;
- }
- }
- if(!g_bShouldAddTimer || !g_bShowTimer)
- {
- DebugToClient("\x04[DEBUG] \x01Timer is not necessary anymore, killing");
- g_iTimeLeft = GetMapTime();
- return Plugin_Stop;
- }
- if(g_iTimeLeft <= 0)
- {
- DebugToClient("\x04[DEBUG] \x01The finale timed out, triggering escape");
- g_iTimeLeft = GetMapTime();
- ForceEscapeStart();
- return Plugin_Stop;
- }
- if(GetSurvivorsCount() <= 0)
- {
- DebugToClient("\x04[DEBUG] \x01No survivors alive, canceling timer");
- return Plugin_Stop;
- }
- if(g_iGameVer == 2)
- {
- decl String:map[256];
- GetCurrentMap(map, sizeof(map));
- if(StrEqual(map, "c7m3_port"))
- {
- if(g_iGeneratorCount < 3)
- {
- DebugToClient("\x04[DEBUG] \x01Cannot continue finale, generators needed");
- PrintHintTextToAll("ALL GENERATORS MUST BE ACTIVATED TO CONTINUE THE FINALE!");
- return Plugin_Continue;
- }
- }
- if(StrEqual(map, "c2m5_concert"))
- {
- if(g_iTimeLeft == 240)
- {
- CheatCommand(_, "ent_fire", "tank1_music playsound");
- CheatCommand(_, "ent_fire", "arch_beams_relay Trigger");
- CheatCommand(_, "ent_fire", "side_beams_relay Trigger");
- CheatCommand(_, "ent_fire", "arch_side_beams_start_counter Kill");
- CheatCommand(_, "ent_fire", "stage_lights_dim_relay Trigger");
- }
- if(g_iTimeLeft == 237)
- {
- CheatCommand(_, "ent_fire", "arch_beams_stop_relay Trigger");
- CheatCommand(_, "ent_fire", "side_beams_off_relay Trigger");
- CheatCommand(_, "ent_fire", "arch_side_beams_stop_counter Kill");
- }
- if(g_iTimeLeft == 234)
- {
- CheatCommand(_, "ent_fire", "stage_lastsong_relay Trigger");
- }
- if(g_iTimeLeft == 140)
- {
- CheatCommand(_, "ent_fire", "mic_spotlights_relay Trigger");
- CheatCommand(_, "ent_fire", "arch_side_miclights_start_counter Kill");
- CheatCommand(_, "ent_fire", "stage_lights_dim_relay Trigger");
- }
- if(g_iTimeLeft == 120)
- {
- CheatCommand(_, "ent_fire", "arch_side_fireworks_start_counter Kill");
- CheatCommand(_, "ent_fire", "fireworks_relay Trigger");
- CheatCommand(_, "ent_fire", "tank2_music PlaySound");
- }
- }
- if(RequireTanks() && GetTankCount() > 0 && IsCooperativeGameMode())
- {
- PrintHintTextToAll("THE RESCUE VEHICLE CANNOT ARRIVE WITH TANKS AROUND!");
- return Plugin_Continue;
- }
- }
- if(!g_bDestroy)
- {
- DebugToClient("Detected HoldOut Finale");
- new iTimePassed = GetMapTime() - g_iTimeLeft;
- DebugToClient("Time Left: %i, Time Passed: %i", g_iTimeLeft, iTimePassed);
- if(iTimePassed > GetMapTime()/4)
- {
- DebugToClient("25% of the time reached, scores will be modified now");
- new Percent = RoundFloat(((iTimePassed*1.0)/GetMapTime())*100);
- DebugToClient("The percent of the finale done is: %i%%", Percent);
- if(g_iGameVer == 2)
- {
- DebugToClient("Detected Left 4 Dead 2");
- new NeededTotalScore = RoundFloat(((1.0*GetMaxScore())*Percent)/100);
- DebugToClient("NeededTotalScore: %i | CS(1): %i | CS(2): %i | CS(3): %i", NeededTotalScore, SDKCall(sdkGetTeamScore, 1, 0), SDKCall(sdkGetTeamScore, 2, 0), SDKCall(sdkGetTeamScore, 3, 0));
- new ScorePerChar = RoundFloat(NeededTotalScore/(4*1.0));
- if(g_iTimeLeft == GetMapTime()/2 || g_iTimeLeft == GetMapTime()/4)
- {
- if(RequireTanks())
- {
- ForceTankSpawn();
- }
- }
- if(SDKCall(sdkGetTeamScore, 1, 0) <= 0)
- {
- if(SDKCall(sdkGetTeamScore, 2, 0) <= NeededTotalScore)
- {
- for(new i = 0; i <= 3; i++)
- {
- DebugToClient("\x04[DEBUG] \x01 IsMainDeath(%i, 2) -> %b", i, IsMainDeath(i, 2));
- if(!IsMainDeath(i, 2))
- {
- SDKCall(sdkSetCharScore, i, 2, ScorePerChar);
- }
- }
- }
- }
- else if(SDKCall(sdkGetTeamScore, 2, 0) <= 0)
- {
- if(SDKCall(sdkGetTeamScore, 1, 0) <= NeededTotalScore)
- {
- for(new i = 0; i <= 3; i++)
- {
- DebugToClient("\x04[DEBUG] \x01 IsMainDeath(%i, 2) -> %b", i, IsMainDeath(i, 2));
- if(!IsMainDeath(i, 2))
- {
- SDKCall(sdkSetCharScore, i, 2, ScorePerChar);
- }
- }
- }
- }
- }
- }
- if(g_iTimeLeft == 60)
- {
- ClientCommandAll("music_dynamic_play Event.ApproachingScavengeRoundWin");
- ClientCommandAll("play music/scavenge/gascanofvictory");
- PrintToChatAll("\x0460 seconds left!");
- }
- }
- else
- {
- if(g_iTimeLeft == 25)
- {
- ClientCommandAll("play music/terror/clingingtohell4.wav");
- }
- if(g_iTimeLeft == 15)
- {
- ClientCommandAll("play music/terror/iamsocold.wav");
- }
- }
- new iMinutes = g_iTimeLeft/60;
- new iSeconds = g_iTimeLeft%60;
- decl String:SurvMessage[256], String:InfMessage[256], String:sMinutes[5], String:sSeconds[5];
- GetSurvivorMsg(SurvMessage, sizeof(SurvMessage));
- GetInfectedMsg(InfMessage, sizeof(InfMessage));
- if(iMinutes < 10 && iMinutes >= 0)
- {
- Format(sMinutes, sizeof(sMinutes), "0%d", iMinutes);
- }
- else
- {
- Format(sMinutes, sizeof(sMinutes), "%d", iMinutes);
- }
- if(iSeconds < 10 && iSeconds >= 0)
- {
- Format(sSeconds, sizeof(sSeconds), "0%d", iSeconds);
- }
- else
- {
- Format(sSeconds, sizeof(sSeconds), "%d", iSeconds);
- }
- for(new i = 1; i <= MaxClients; i++)
- {
- if(IsValidEntity(i) && IsClientInGame(i) && !IsFakeClient(i))
- {
- if(GetClientTeam(i) == 3)
- {
- PrintHintText(i, "%s %s:%s", InfMessage, sMinutes, sSeconds);
- }
- else
- {
- PrintHintText(i, "%s %s:%s", SurvMessage, sMinutes, sSeconds);
- }
- }
- }
- g_iTimeLeft--;
- return Plugin_Continue;
- }
Add Comment
Please, Sign In to add comment