Home » Renegade Discussions » Mod Forum » Scripting Help
Re: Scripting Help [message #418449 is a reply to message #418187] |
Mon, 25 January 2010 14:50 |
|
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","");
}
}
}
|
|
|
|
|
Scripting Help
|
|
|
Re: Vector3 pos
By: Sir Kane on Fri, 22 January 2010 16:31
|
|
|
Re: Vector3 pos
By: zunnie on Fri, 22 January 2010 22:16
|
|
|
Re: Vector3 pos
|
|
|
Re: Vector3 pos
|
|
|
Re: Scripting Help
By: Omar007 on Sat, 23 January 2010 03:39
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
By: Omar007 on Sat, 23 January 2010 13:01
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
By: Omar007 on Sat, 23 January 2010 15:23
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
By: Omar007 on Sun, 24 January 2010 03:38
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
By: reborn on Wed, 27 January 2010 07:34
|
|
|
Re: Scripting Help
By: cAmpa on Mon, 25 January 2010 15:31
|
|
|
Re: Scripting Help
By: Hex on Wed, 27 January 2010 07:06
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
By: reborn on Wed, 27 January 2010 17:52
|
|
|
Re: Scripting Help
By: Hex on Thu, 28 January 2010 02:44
|
|
|
Re: Scripting Help
By: raven on Thu, 28 January 2010 10:31
|
|
|
Re: Scripting Help
By: reborn on Fri, 29 January 2010 16:37
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
By: reborn on Sat, 30 January 2010 03:08
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
By: reborn on Wed, 24 February 2010 03:35
|
|
|
Re: Scripting Help
By: Tunaman on Wed, 24 February 2010 08:16
|
|
|
Re: Scripting Help
By: raven on Wed, 24 February 2010 08:40
|
|
|
Re: Scripting Help
By: reborn on Wed, 24 February 2010 08:45
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
By: Omar007 on Wed, 24 February 2010 12:46
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
By: Omar007 on Wed, 24 February 2010 14:47
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
By: Hex on Sun, 04 April 2010 02:44
|
|
|
Re: Scripting Help
|
|
|
Re: Scripting Help
|
Goto Forum:
Current Time: Wed Nov 27 08:34:36 MST 2024
Total time taken to generate the page: 0.01322 seconds
|