Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #using scripts\codescripts\struct; // HARRY COMMENT
- #using scripts\shared\system_shared; // HARRY COMMENT
- #using scripts\shared\array_shared; // HARRY COMMENT
- #using scripts\shared\vehicle_shared; // HARRY COMMENT
- #using scripts\zm\_zm_score;
- #using scripts\shared\flag_shared;
- #using scripts\shared\clientfield_shared;
- #using scripts\shared\callbacks_shared; // HARRY COMMENT
- #using scripts\zm\_zm_utility;
- #using scripts\zm\_zm_weapons;
- #using scripts\shared\laststand_shared;
- #using scripts\shared\util_shared;
- #using scripts\shared\flagsys_shared;
- #using scripts\shared\hud_util_shared;
- #insert scripts\shared\shared.gsh;
- #using scripts\zm\_zm_powerups;
- #using scripts\zm\_zm_spawner;
- #using scripts\zm\_zm_equipment;
- #using scripts\shared\ai\zombie_utility;
- #using scripts\shared\ai\zombie_death;
- #using scripts\zm\_zm;
- #using scripts\zm\_zm_audio;
- thread trigger_end_game();
- function trigger_end_game()
- {
- trig = GetEnt("end_game_trig", "targetname");
- while(1)
- {
- trig waittill("trigger", ent);
- if( isPlayer( ent ) )
- continue;
- else
- end_game_custom();
- }
- }
- function end_game_custom()
- {
- zm::check_end_game_intermission_delay();
- setmatchflag( "game_ended", 1 );
- level clientfield::set("gameplay_started", 0);
- level clientfield::set("game_end_time", int( ( GetTime() - level.n_gameplay_start_time + 500 ) / 1000 ) );
- util::clientnotify( "zesn" );
- level thread zm_audio::sndMusicSystem_PlayState( "game_over" );
- //PlaySoundAtPosition("gameover_winid", player.origin );
- //AYERS: Turn off ANY last stand audio at the end of the game
- /*
- players = GetPlayers();
- for ( i = 0; i < players.size; i++ )
- {
- players[i] clientfield::set( "zmbLastStand", 0 );
- }
- for ( i = 0; i < players.size; i++ )
- {
- if ( players[i] laststand::player_is_in_laststand() )
- {
- players[i] RecordPlayerDeathZombies();
- players[i] zm_stats::increment_player_stat( "deaths" );
- players[i] zm_stats::increment_client_stat( "deaths" );
- }
- //clean up the revive text hud if it's active
- if( isdefined( players[i].reviveTextHud ) )
- {
- players[i].reviveTextHud destroy();
- }
- }
- */
- StopAllRumbles();
- level.intermission = true;
- level.zombie_vars["zombie_powerup_insta_kill_time"] = 0;
- level.zombie_vars["zombie_powerup_fire_sale_time"] = 0;
- level.zombie_vars["zombie_powerup_double_points_time"] = 0;
- wait 0.1;
- game_over = [];
- survived = [];
- players = GetPlayers();
- //disabled the ingame pause menu from opening after a game ends
- setMatchFlag( "disableIngameMenu", 1 );
- foreach( player in players )
- {
- player closeInGameMenu();
- player CloseMenu( "StartMenu_Main" );
- }
- //AAR - set stat for each player (this will show the menu)
- foreach( player in players )
- {
- player setDStat( "AfterActionReportStats", "lobbyPopup", "summary" );
- }
- if(!isDefined(level._supress_survived_screen))
- {
- for( i = 0; i < players.size; i++ )
- {
- You_win[i] = NewClientHudElem( players[i] );
- survived[i] = NewClientHudElem( players[i] );
- if ( IsDefined( level.custom_game_over_hud_elem ) )
- {
- [[ level.custom_game_over_hud_elem ]]( players[i], You_win[i], survived[i] );
- }
- else
- {
- You_win[i].alignX = "center";
- You_win[i].alignY = "middle";
- You_win[i].horzAlign = "center";
- You_win[i].vertAlign = "middle";
- You_win[i].y -= 130;
- You_win[i].foreground = true;
- You_win[i].fontScale = 3;
- You_win[i].alpha = 0;
- You_win[i].color = ( 1.0, 1.0, 1.0 );
- You_win[i].hidewheninmenu = true;
- You_win[i] SetText( "You escaped My good Zombie Slayer");
- You_win[i] FadeOverTime( 1 );
- You_win[i].alpha = 1;
- if ( players[i] isSplitScreen() )
- {
- You_win[i].fontScale = 2;
- You_win[i].y += 40;
- }
- survived[i].alignX = "center";
- survived[i].alignY = "middle";
- survived[i].horzAlign = "center";
- survived[i].vertAlign = "middle";
- survived[i].y -= 100;
- survived[i].foreground = true;
- survived[i].fontScale = 2;
- survived[i].alpha = 0;
- survived[i].color = ( 1.0, 1.0, 1.0 );
- survived[i].hidewheninmenu = true;
- if ( players[i] isSplitScreen() )
- {
- survived[i].fontScale = 1.5;
- survived[i].y += 40;
- }
- }
- //OLD COUNT METHOD
- if( level.round_number < 2 )
- {
- {
- survived[i] SetText( &"ZOMBIE_SURVIVED_ROUND" );
- }
- }
- else
- {
- survived[i] SetText( &"ZOMBIE_SURVIVED_ROUNDS", level.round_number );
- }
- survived[i] FadeOverTime( 1 );
- survived[i].alpha = 1;
- }
- }
- //check to see if we are in a game module that wants to do something with PvP damage
- if(isDefined(level.custom_end_screen))
- {
- level [[level.custom_end_screen]]();
- }
- for (i = 0; i < players.size; i++)
- {
- players[i] SetClientUIVisibilityFlag( "weapon_hud_visible", 0 );
- players[i] SetClientMiniScoreboardHide( true );
- //players[i] setDStat( "AfterActionReportStats", "lobbyPopup", "summary" );
- players[i] notify( "report_bgb_consumption" );
- }
- //LUINotifyEvent( &"force_scoreboard", 0 );
- //UploadStats();
- //zm_stats::update_players_stats_at_match_end( players );
- //zm_stats::update_global_counters_on_match_end();
- //zm::upload_leaderboards();
- //recordGameResult( "draw" );
- //globallogic::recordZMEndGameComScoreEvent( "draw" );
- //globallogic_player::recordActivePlayersEndGameMatchRecordStats();
- // Finalize Match Record
- finalizeMatchRecord();
- //zm_utility::play_sound_at_pos( "end_of_game", ( 0, 0, 0 ) );
- players = GetPlayers();
- foreach( player in players )
- {
- if( IsDefined( player.sessionstate ) && player.sessionstate == "spectator" )
- {
- player.sessionstate = "playing";
- player thread zm::end_game_player_was_spectator();
- }
- }
- WAIT_SERVER_FRAME;
- players = GetPlayers();
- LUINotifyEvent( &"force_scoreboard", 1, 1 );
- zm::intermission();
- wait( level.zombie_vars["zombie_intermission_time"] );
- //hide the gameover message
- if ( !isDefined( level._supress_survived_screen ) )
- {
- for ( i = 0; i < players.size; i++ )
- {
- survived[i] Destroy();
- game_over[i] Destroy();
- }
- }
- else
- {
- for ( i = 0; i < players.size; i++ )
- {
- if(isDefined(players[i].survived_hud ) )
- players[i].survived_hud Destroy();
- if (isDefined( players[i].game_over_hud ) )
- players[i].game_over_hud Destroy();
- }
- }
- level notify( "stop_intermission" );
- array::thread_all( GetPlayers(), &player_exit_level );
- wait( 1.5 );
- players = GetPlayers();
- for ( i = 0; i < players.size; i++ )
- {
- players[i] CameraActivate( false );
- }
- ExitLevel( false );
- // Let's not exit the function
- wait( 666 );
- }
- function player_exit_level()
- {
- self AllowStand( true );
- self AllowCrouch( false );
- self AllowProne( false );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement