Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Scripting Help
Re: Scripting Help [message #418283 is a reply to message #418277] Sat, 23 January 2010 15:20 Go to previous messageGo to previous message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma:
General (3 Stars)
Omar007 wrote on Sat, 23 January 2010 21:01

Gen_Blacky wrote on Sat, 23 January 2010 19:52

thank you I forgot about that I increased the team size. It works now but now if one team has one more player then the other team they can switch teams. How would I check if the other team has 1 more player then the other team. Thats why I originally added
nodPlayers++;
gdiPlayers++;

So if the other team had +1 it wouldn't switch teams.
Then added even teams and one player later.


if(nodPlayers < gdiPlayers - 1)
{
//dont swap -> nod only has 1 player more
}

if(gdiPlayers < nodPlayers - 1)
{
//dont swap -> gdi only has 1 player more
}


I tired that but it didn't work. I got it working though by checking for the difference. Thanks for the help.

class TeamChangeChatCommand : public ChatCommandClass 
{
	void Triggered(int ID,const TokenClass &Text,int ChatType) 
	{
		if(!PluginSettings->TeamChange){return;}
		GameObject *obj = Get_GameObj(ID);
		int difference = 0;
		int gdiPlayers = (Tally_Team_Size(1));
		int nodPlayers = (Tally_Team_Size(0));
		int team = Get_Object_Type(obj);


		if (team == 1) 
		{
			if (gdiPlayers - nodPlayers )
			{
				difference = gdiPlayers - nodPlayers;
			}
			else if (gdiPlayers == 1)
			{
				Console_Input(StrFormat("ppage %d You are the only player on GDI.",Get_Player_ID(obj)).c_str()); 
			}
			else if (difference == 1)
			{
				char message[256];
				sprintf(message,"msg GDI has only one more player then NOD No need to Switch.", Get_Player_Name_By_ID(ID));
				Console_Input(message);
			}
			else if (nodPlayers == gdiPlayers)
			{
				char message[256];
				sprintf(message,"msg Teams are Even", Get_Player_Name_By_ID(ID));
				Console_Input(message);
			}
			
			else if (nodPlayers < gdiPlayers + 1) 
			{
				printf("Change Team GDI to Nod\n");
				Change_Team_By_ID(ID,0);
				char message[256];
				sprintf(message,"msg Player %s has changed to Team Nod to make the teams even.", Get_Player_Name_By_ID(ID));
				Console_Input(message);
			}
			else 
			{
				char message[256];
				sprintf(message,"msg Sorry GDI doesn't have enough Players!", Get_Player_Name_By_ID(ID));
				Console_Input(message);
			}
	
		}
		if (team == 0) 
		{
			if (nodPlayers == 1)
			{
				Console_Input(StrFormat("ppage %d You are the only player on NOD.",Get_Player_ID(obj)).c_str()); 
			}
			else if (nodPlayers - gdiPlayers  )
			{
				difference = nodPlayers - gdiPlayers;
			}
			if (difference == 1)
			{
				char message[256];
				sprintf(message,"msg Nod has only one more player then GDI No need to Switch.", Get_Player_Name_By_ID(ID));
				Console_Input(message);
			}
			else if (gdiPlayers == nodPlayers)
			{
				char message[256];
				sprintf(message,"msg Teams are Even", Get_Player_Name_By_ID(ID));
				Console_Input(message);
			}
			else if (gdiPlayers < nodPlayers + 1)
			{
				printf("Change Team Nod to GDI\n");
				Change_Team_By_ID (ID,1);
				char message[256];
				sprintf(message,"msg Player %s has changed to Team GDI to make the teams even.", Get_Player_Name_By_ID(ID));
				Console_Input(message);
			}
			else 
			{
				char message[256];
				sprintf(message,"msg Sorry NOD doesn't have enough Players!", Get_Player_Name_By_ID(ID));
				Console_Input(message);
			}
		}
	}
};
ChatCommandRegistrant<TeamChangeChatCommand> TeamChangeChatCommandReg("!TeamChange;!tc;!switch;",CHATTYPE_TEAM,0,GAMEMODE_ALL);


http://s18.postimage.org/jc6qbn4k9/bricks3.png

[Updated on: Sat, 23 January 2010 15:21]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to add startup spawners and spawners etc!!! help!
Next Topic: Cables of the transport.
Goto Forum:
  


Current Time: Wed Dec 18 23:16:10 MST 2024

Total time taken to generate the page: 0.01652 seconds