Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Scripting Help
Re: Vector3 pos [message #418243 is a reply to message #418187] Sat, 23 January 2010 02:57 Go to previous messageGo to previous message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma:
General (3 Stars)
Can some one tell me why this chat command isn't working correctly> I don't understand how gdiplayer == nodplayer does not = even teams.

class TeamChangeChatCommand : public ChatCommandClass 
{
	void Triggered(int ID,const TokenClass &Text,int ChatType) 
	{
		GameObject *obj = Get_GameObj(ID);
		int gdiPlayers = (Tally_Team_Size(1));
		int nodPlayers = (Tally_Team_Size(0));
		int team = Get_Object_Type(obj);
		if (team == 1) 
		{
			printf("GDI\n");
			nodPlayers++;
			if (nodPlayers < gdiPlayers) 
			{
				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 if (nodPlayers == 0)
			{
				char message[256];
				sprintf(message,"msg You are the only player on GDI", 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);
				//Console_Input(StrFormat("msg Teams are Even.",Get_Player_ID(obj)).c_str();
			}
			else 
			{
				//Console_Input(StrFormat("msg Sorry GDI doesn't have enough Players!.",Get_Player_ID(obj)).c_str();
				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) 
		{
			printf("NOD\n");
			gdiPlayers++;
			if (gdiPlayers < nodPlayers) 
			{
				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 if (gdiPlayers == 0)
			{
				char message[256];
				sprintf(message,"msg You are the only player on Nod.", Get_Player_Name_By_ID(ID));
				Console_Input(message);
				//Console_Input(StrFormat("msg You are the only player on Nod.",Get_Player_ID(obj)).c_str();
			}
			else if (gdiPlayers == nodPlayers)
			{
				char message[256];
				sprintf(message,"msg Teams are Even", Get_Player_Name_By_ID(ID));
				Console_Input(message);
			}
			else 
			{
				//Console_Input(StrFormat("msg Sorry NOD doesn't have enough Players!.",Get_Player_ID(obj)).c_str();
				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);


index.php?t=getfile&id=12378&private=0


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

[Updated on: Sat, 23 January 2010 02:58]

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: Tue Dec 24 14:07:48 MST 2024

Total time taken to generate the page: 0.01100 seconds