Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 06:51

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Hello just want to ask something on this

Discussion on Hello just want to ask something on this within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
marlyandedsel's Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 343
Received Thanks: 21
Hello just want to ask something on this

PHP Code:
public class Elite_Pk Writer
    
{
        private 
byte[] Packet;
        public 
Elite_Pk(uint clientID)
        {
            
Packet = new byte[356];
            
WriteUInt16(3480Packet);
            
WriteUInt16(22232Packet);
            
Packet[8] = 3;//type
            
Packet[16] = 8// count
            
WriteUInt32(clientID20Packet);
        }
        public 
byte[] ToArray()
        {
         
ushort Position 32;
            
Game.Tournaments.Elite_client[] cometition;
            
cometition Game.Tournaments.EliteTournament.Top8.Values.ToArray();
            for (
byte x 19x++)
            {
                foreach (
Game.Tournaments.Elite_client clients in cometition)
                {
                    if (
== clients.Postion)
                    {
                        
Packet[Position] = (byte)clients.Postion;
                        
Position += 4;
                        
WriteString(clients.NamePositionPacket);
                        
Position += 16;
                        
WriteUInt32(uint.Parse(clients.Avatar.ToString() + clients.Mesh.ToString()), PositionPacket);
                        
Position += 4;
                        
WriteUInt32(clients.UIDPositionPacket);
                        
Position += 12;
                    }
                }
            }
            return 
Packet;
        }
        public 
void Send(Client.GameState client)
        {
            
client.Send(ToArray());
        }
    } 
at this line ushort Position = 32; it said Index was outside of the bound of the Array.

why is happening this, I know someone want to help me about this just confuse
marlyandedsel is offline  
Old 09/17/2012, 23:32   #2
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,383
I can guarantee that your error is NOT actually on the line ushort Position = 32 as nothing is actually done in that line besides assigning 2 bytes in memory for the variable "Position" with the value "32"

The actual error likely occurs on Packet[Position] = (byte)clients.Postion;

Check your loop and the Position. If it goes above 355 then you are going to have that error because you are outside the bounds of the array Packet.


Breakpointing + outputting the number of loops being performed would be a fantastic start to finding your issue.
pro4never is offline  
Thanks
4 Users
Old 09/18/2012, 04:59   #3
 
marlyandedsel's Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 343
Received Thanks: 21
hell yea Pro4 THANKS VERY MUCH FOR THIS... )

#edit : yes it ends at 356
marlyandedsel is offline  
Reply




All times are GMT +2. The time now is 06:52.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.