Team Arena Problem

07/24/2013 07:11 girgismena#1
Hello guys !!
I have 2 problem in my Arena Team and i don't know how can i fix it
The 1st problem is : after all sign up all start attack each other b4 the counter stop !
The 2nd problem : after all team die no 1 go out and i checked my TeamArena.cs file and i find the public void ExportTeam() is work
btw i'm just new person try to learn C# so i dont know if the code is right or something wrong
can some1 help me ?

this is the public void ExportTeam() code

PHP Code:
public void ExportTeam()
                {
                    foreach (
GameState state in this.Players1.Team.Teammates)
                    {
                        foreach (
GameState state2 in this.Players2.Team.Teammates)
                        {
                            foreach (
GameState state3 in this.Winner.Team.Teammates)
                            {
                                foreach (
GameState state4 in this.Loser.Team.Teammates)
                                {
                                    
state.Entity.InTeamArenaMap state2.Entity.InTeamArenaMap false;
                                    
state.InTeamArenaMatch state2.InTeamArenaMatch false;
                                    foreach (
GameState state5 in this.Watchers.ToArray())
                                    {
                                        
TeamArena.TeamQualifyEngine.DoLeaveTeam(state5);
                                    }
                                    
TeamArena.TeamWin(state3state4);
                                    
this.Inside false;
                                    
state.Entity.Teleport(state.Entity.PreviousMapIDstate.Entity.PrevXstate.Entity.PrevY);
                                    
state3.Entity.Teleport(state.Entity.PreviousMapIDstate.Entity.PrevXstate.Entity.PrevY);
                                    
state2.Entity.Teleport(state2.Entity.PreviousMapIDstate2.Entity.PrevXstate2.Entity.PrevY);
                                    
state4.Entity.Teleport(state2.Entity.PreviousMapIDstate2.Entity.PrevXstate2.Entity.PrevY);
                                    
state4.Entity.Ressurect();
                                    
state3.Entity.Ressurect();
                                    
state.TeamArenaStatistic.AcceptBox state2.TeamArenaStatistic.AcceptBox false;
                                    
state.TeamArenaStatistic.AcceptBoxShow state2.TeamArenaStatistic.AcceptBoxShow state2.TeamArenaStatistic.AcceptBoxShow.AddHours(2);
                                    
state.TeamArenaStatistic.PlayWith state2.TeamArenaStatistic.PlayWith 0;
                                    
TeamArena.TeamArenaSignup signup = new TeamArena.TeamArenaSignup
                                    
{
                                        
DialogID 10
                                    
};
                                    
state4.Send(signup.BuildPacket());
                                    
signup.OptionID 1;
                                    
state3.Send(signup.BuildPacket());
                                    
TeamArena.TeamQualifierList.Groups.Remove(this.ID);
                                    
state.Entity.PKMode this.P1Mode;
                                    
Data buffer = new Data(true)
                                    {
                                        
UID state.Entity.UID,
                                        
ID 0x60,
                                        
dwParam = (uint)state.Entity.PKMode
                                    
};
                                    
state.Send(buffer);
                                    
state2.Entity.PKMode this.P2Mode;
                                    
Data data2 = new Data(true)
                                    {
                                        
UID state2.Entity.UID,
                                        
ID 0x60,
                                        
dwParam = (uint)state2.Entity.PKMode
                                    
};
                                    
state2.Send(data2);
                                    
state.TeamQualifierGroup null;
                                    
state2.TeamQualifierGroup null;
                                    
state.Entity.InTeamArenaorArena false;
                                    
state2.Entity.InTeamArenaorArena false;
                                    if (
this.dynamicMap != null)
                                    {
                                        
this.dynamicMap.Dispose();
                                    }
                                }
                            }
                        }
                    }
                } 
thanks guys
07/24/2013 07:54 Spirited#2
Moved to the right section with a 4 hour redirect.
All private server questions should be in this section.
07/24/2013 08:04 girgismena#3
oh sorry
i know the true section but i dont know what happened
thanks for moving and sorry for that a mistake
07/24/2013 14:15 abdoumatrix#4
1.

2. if u r a public source then i 'm sure that all codes had to recoded and all structures too.
i know cuz i see most of them.
07/24/2013 23:35 girgismena#5
thanks for ur answer
for 1st problem u mean i add that in packet handel ?

for 2nd i'm not good too answer if my team arena in source are good or not
07/25/2013 00:50 Super Aids#6
Why the hell are you nesting 4 loops?
07/25/2013 01:08 girgismena#7
Quote:
Originally Posted by Super Aids View Post
Why the hell are you nesting 4 loops?
what's your problem ?
if you can help me ok if you didn't so whats your problem ?
07/25/2013 01:20 Super Aids#8
It's not my problem. It's your problem.

This is how your code works.

For every player in player1's team you will loop player2's team.
For every player in player2's team you will loop the winners team.
For every player in the winners team you will loop the losers team.
For every player in the losers team you will handle the loops above.

This will cause the loser, winner and player2's team to be exeuted countless time.

You should run each loop for themselves.

Let me sum up why.
Let's say you have 2 players in player1's team, 2 players in player2's team,
the winner team is player1's team and the loser team is player2's team.

That means your loop will run this much:
Code:
2
	4
		8
			16
When you could have it run like this:
Code:
2
2
2
2
However you could even cut it down to:
Code:
2
2
By only using player1 and player2's team since those 2 teams will also be the winner and loser team.
07/25/2013 03:49 girgismena#9
Quote:
Originally Posted by Super Aids View Post
It's not my problem. It's your problem.

This is how your code works.

For every player in player1's team you will loop player2's team.
For every player in player2's team you will loop the winners team.
For every player in the winners team you will loop the losers team.
For every player in the losers team you will handle the loops above.

This will cause the loser, winner and player2's team to be exeuted countless time.

You should run each loop for themselves.

Let me sum up why.
Let's say you have 2 players in player1's team, 2 players in player2's team,
the winner team is player1's team and the loser team is player2's team.

That means your loop will run this much:
Code:
2
	4
		8
			16
When you could have it run like this:
Code:
2
2
2
2
However you could even cut it down to:
Code:
2
2
By only using player1 and player2's team since those 2 teams will also be the winner and loser team.
i cant understand bro
i just start learning C# from 2 days
and that alot for me
i try to edit that code but i dont know what mean of loop
that hard for me
thanks
07/25/2013 11:36 abdoumatrix#10
Quote:
Originally Posted by girgismena View Post
thanks for ur answer
for 1st problem u mean i add that in packet handel ?

for 2nd i'm not good too answer if my team arena in source are good or not
in ur handle.cs
search
PHP Code:
his.attacker.AttackStamp Time32.Now;
            if ((
this.attacker.Owner.QualifierGroup != null) && (Time32.Now this.attacker.Owner.QualifierGroup.CreateTime.AddSeconds(12)))
            {
                return;
            } 
and put

PHP Code:
if ((this.attacker.Owner.QualifierGroups != null) && (Time32.Now this.attacker.Owner.QualifierGroups.CreateTime.AddSeconds(12)))
            {
                return;
            } 

Quote:
Originally Posted by Super Aids View Post
Why the hell are you nesting 4 loops?
Trinty based source codes so we used to it so we used it till we gain more experience and improve it :D

Quote:
Originally Posted by Super Aids View Post
ty for ur helpful tip.:)
so this is gonna be better


the 4 loop will affect the performance.right?
07/25/2013 14:57 Super Aids#11
You are still nesting the loops. They have to be separated.
07/25/2013 16:54 abdoumatrix#12
Quote:
Originally Posted by Super Aids View Post
You are still nesting the loops. They have to be separated.
aha.
07/25/2013 19:26 shadowman123#13
Quote:
Originally Posted by abdoumatrix View Post
if u r a public source then i 'm sure that all codes had to recoded and all structures too.
i know cuz i see most of them.
thats it
07/25/2013 21:24 girgismena#14
Quote:
Originally Posted by abdoumatrix View Post
in ur handle.cs
search
PHP Code:
his.attacker.AttackStamp Time32.Now;
            if ((
this.attacker.Owner.QualifierGroup != null) && (Time32.Now this.attacker.Owner.QualifierGroup.CreateTime.AddSeconds(12)))
            {
                return;
            } 
and put

PHP Code:
if ((this.attacker.Owner.QualifierGroups != null) && (Time32.Now this.attacker.Owner.QualifierGroups.CreateTime.AddSeconds(12)))
            {
                return;
            } 



Trinty based source codes so we used to it so we used it till we gain more experience and improve it :D



ty for ur helpful tip.:)
so this is gonna be better


the 4 loop will affect the performance.right?
Quote:
Originally Posted by shadowman123 View Post
thats it
thanks again bro
i replace my public void ExportTeam() with yours but i got 1 Error
The Error is here :
PHP Code:
foreach (Client.GameState teammate1 in Player1.Entity.Owner.Team.Teammates
Error said Error: 2 The name 'Player1' does not exist in the current
i know i bother all so please forgive me guys
and thanks for helping me
07/25/2013 21:44 The.Goblin#15
Quote:
Originally Posted by girgismena View Post
thanks again bro
i replace my public void ExportTeam() with yours but i got 1 Error
The Error is here :
PHP Code:
foreach (Client.GameState teammate1 in Player1.Entity.Owner.Team.Teammates
Error said Error: 2 The name 'Player1' does not exist in the current
i know i bother all so please forgive me guys
and thanks for helping me
Will be Players1