Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Scripting Help
Re: Scripting Help [message #418449 is a reply to message #418187] Mon, 25 January 2010 14:50 Go to previous messageGo to previous message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma:
General (3 Stars)
I made this Team change message system and Force team change if teams have 3 or more players. It works but is it proper to attach it to the level load hook.


void tctimer::Created(GameObject *obj){
	Commands->Start_Timer(obj,this,30.0f,1);
	Commands->Start_Timer(obj,this,200.0f,2);
	Commands->Start_Timer(obj,this,8.0f,3);
}


void tctimer::Timer_Expired(GameObject *obj,int number){
	if(PluginSettings->TeamChange)
	{
		//printf("TC Timer Expired\n");
		int difference = 0;
		int gdiPlayers = (Tally_Team_Size(1));
		int nodPlayers = (Tally_Team_Size(0));
		int teamnod = 0;
		int teamgdi = 1;
		GameObject *ato = Find_First_Player(teamnod);
		GameObject *ato2 = Find_First_Player(teamgdi);
		int ID = Get_Player_ID(ato);
		int ID2 = Get_Player_ID(ato2);
		if (gdiPlayers - nodPlayers )
		{
			difference = gdiPlayers - nodPlayers;
			//printf("Player difference %d\n",difference);
		}
		if(number == 1)
		{
			if (difference >= 2)
			{
				Console_Input(StrFormat("msg Use the Team Change Chat Comamnd !tc to switch Teams").c_str());
			}
			if (difference <= -2)
			{
				Console_Input(StrFormat("msg Use the Team Change Chat Comamnd !tc to switch Teams").c_str());
			}
			Commands->Start_Timer(obj,this,30.0f,1);
		}
		else if(number == 2)
		{
			if (difference >= 2)
			{
				Console_Input(StrFormat("msg What are you doing idiots Even The Teams.").c_str());
			}
			if (difference <= -2)
			{
				Console_Input(StrFormat("msg What are you doing idiots Even The Teams.").c_str());
			}
			Commands->Start_Timer(obj,this,200.0f,2);
		}
		//auto switch
		else if(number == 3)
		{
			if (difference <= -3)
			{
				Change_Team_By_ID(ID,1);
				Console_Input(StrFormat("msg Force Team Change Engaged %s Switched to team GDI ",Get_Player_Name_By_ID(ID)).c_str());
			}
			if (difference >= 3)
			{
				Change_Team_By_ID(ID2,0);
				Console_Input(StrFormat("msg Force Team Change Engaged %s Switched to team Nod ",Get_Player_Name_By_ID(ID2)).c_str());
			}
			Commands->Start_Timer(obj,this,15.0f,3);
		}
	}
}


extern "C" {
	DLLEXPORT void SSGM_Level_Loaded_Hook() {
		PluginSettings->Load();
		if(PluginSettings->TeamChange)
		{
			GameObject *temp = Commands->Create_Object("Invisible_Object",Vector3(0.0f,0.0f,0.0f));
			Commands->Attach_Script(temp,"tctimer","");
		}
	}
}


http://s18.postimage.org/jc6qbn4k9/bricks3.png
 
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 22:46:49 MST 2024

Total time taken to generate the page: 0.01203 seconds