Results 1 to 4 of 4

Thread: Define team and show for team.

  1. #1
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts

    Define team and show for team.

    Hi Guys, i want to make a special end map, before all will be ended then will come something with string with "Lose" or "Win" (for the team who win/lose) and "Draw".

    Here is my tried script:

    Code:
    endMap()
    {
    	game["state"] = "intermission";
    	level notify("intermission");
    
    	alliedscore = getTeamScore("allies");
    	axisscore = getTeamScore("axis");
    
    	self freezeControls(true);
    	self playsound("end");
    
    	if(alliedscore == axisscore) // DRAW
    	{
               script.........
            }
            else if(alliedscore > axisscore)
    	{
    		if(self.pers["team"] == "allies") // Allies WIN!
    		{
                       script...........
    		}
    		else if(self.pers["team"] == "axis") // Axis LOSE!
    		{
                          script.............
    		}
    	}
    	wait(13);
    
    /////////// NOW ALL WILL BE ENDED HOW LIKE DEFAULT
    	if(alliedscore == axisscore)
    	{
    		winningteam = "tie";
    		losingteam = "tie";
    		text = "MP_THE_GAME_IS_A_TIE";
    	}
    	else if(alliedscore > axisscore)
    	{
    		winningteam = "allies";
    		losingteam = "axis";
    		text = &"MP_ALLIES_WIN";
    	}
    	else
    	{
     ......................................................
    So what now happens:
    If map ends, then i will be not freeze (should be all) and there will not come WIN or Lose or Draw for teams.
    Why and how i can fix it that it comes to teams the win or lose for players?

    But after 13 secounds works that it ends.

  2. #2
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    EDIT: Fixed by RobsoN per TV!

  3. #3
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Can you show the working script then, please?

  4. #4
    Lieutenant Loveboy's Avatar
    Join Date
    Nov 2012
    Posts
    546
    Thanks
    229
    Thanked 72 Times in 46 Posts
    Made by RobsoN:

    Code:
    endMap()
    {
    	game["state"] = "intermission";
    	level notify("intermission");
    
    	alliedscore = getTeamScore("allies");
    	axisscore = getTeamScore("axis");
    
    	if(alliedscore == axisscore)
    	{
    		winningteam = "tie";
    		losingteam = "tie";
    		text = "MP_THE_GAME_IS_A_TIE";
    	}
    	else if(alliedscore > axisscore)
    	{
    		winningteam = "allies";
    		losingteam = "axis";
    		text = &"MP_ALLIES_WIN";
    	}
    	else
    	{
    		winningteam = "axis";
    		losingteam = "allies";
    		text = &"MP_AXIS_WIN";
    	}
    	
    	players = getentarray("player", "classname");
    	for(i = 0; i < players.size; i++)
    	{
    		if(winningteam == "tie")
    		{
    			players[i] iprintlnbold("Game is a tie");
    		}
    		else if(winningteam == "axis") //axis won
    		{
    			if(players[i].pers["team"] == "axis")
    			{
    				players[i] iprintlnbold("Congratulations, your team has won the match.");
    			}
    			else if(players[i].pers["team"] == "allies")
    			{
    				players[i] iprintlnbold("Your team has lost the match.");
    			}
    			else //spectator
    			{
    				players[i] iprintlnbold("Axis won.");
    			}
    		}
    		else if(winningteam == "allies") //allies won
    		{
    			if(players[i].pers["team"] == "axis")
    			{
    				players[i] iprintlnbold("Your team has lost the match.");
    			}
    			else if(players[i].pers["team"] == "allies")
    			{
    				players[i] iprintlnbold("Congratulations, your team has won the match.");	
    			}
    			else //spectator
    			{
    				players[i] iprintlnbold("Allies won.");
    			}
    		}
    	}
    	
    	wait 13;
    
    	winners = "";
    	losers = "";
    
    	if(winningteam == "allies")
    		level thread playSoundOnPlayers("MP_announcer_allies_win");
    	else if(winningteam == "axis")
    		level thread playSoundOnPlayers("MP_announcer_axis_win");
    	else
    		level thread playSoundOnPlayers("MP_announcer_round_draw");
    
    	players = getentarray("player", "classname");
    	for(i = 0; i < players.size; i++)
    	{
    		player = players[i];
    		if((winningteam == "allies") || (winningteam == "axis"))
    		{
    			lpGuid = player getGuid();
    			if((isDefined(player.pers["team"])) && (player.pers["team"] == winningteam))
    					winners = (winners + ";" + lpGuid + ";" + player.name);
    			else if((isDefined(player.pers["team"])) && (player.pers["team"] == losingteam))
    					losers = (losers + ";" + lpGuid + ";" + player.name);
    		}
    
    		player closeMenu();
    		player closeInGameMenu();
    		player setClientCvar("cg_objectiveText", text);
    		
    		player spawnIntermission();
    	}
    
    	if((winningteam == "allies") || (winningteam == "axis"))
    	{
    		logPrint("W;" + winningteam + winners + "\n");
    		logPrint("L;" + losingteam + losers + "\n");
    	}
    
    	// set everyone's rank on xenon
    	if(level.xenon)
    	{
    		players = getentarray("player", "classname");
    		highscore = undefined;
    
    		for(i = 0; i < players.size; i++)
    		{
    			player = players[i];
    	
    			if(!isdefined(player.score))
    				continue;
    	
    			if(!isdefined(highscore) || player.score > highscore)
    				highscore = player.score;
    		}
    
    		for(i = 0; i < players.size; i++)
    		{
    			player = players[i];
    
    			if(!isdefined(player.score))
    				continue;
    
    			if(highscore <= 0)
    				rank = 0;
    			else
    			{
    				rank = int(player.score * 10 / highscore);
    				if(rank < 0)
    					rank = 0;
    			}
    
    			if(player.pers["team"] == "allies")
    				setplayerteamrank(player, 0, rank);
    			else if(player.pers["team"] == "axis")
    				setplayerteamrank(player, 1, rank);
    			else if(player.pers["team"] == "spectator")
    				setplayerteamrank(player, 2, rank);
    		}
    		sendranks();
    	}
    
    	wait 10;
    	exitLevel(false);
    }

  5. The Following User Says Thank You to Loveboy For This Useful Post:

    Ni3ls (12th July 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •