Home » Renegade Discussions » Mod Forum » Scripting Help
Re: Scripting Help [message #418283 is a reply to message #418277] |
Sat, 23 January 2010 15:20 |
|
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);
[Updated on: Sat, 23 January 2010 15:21] Report message to a moderator
|
|
|
|
|
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 Dec 18 20:27:17 MST 2024
Total time taken to generate the page: 0.01193 seconds
|