SendScreen Issue

10/14/2011 18:20 abdeen#1
here is my issue , O.o




[Only registered and activated users can see links. Click Here To Register...]


any help ?
10/14/2011 18:36 BaussHacker#2
Objects.Count is probably a method like Objects.Count();

So try Objects.Count()
10/14/2011 19:01 abdeen#3
those cods for friend and enemy , but when you request someone friend and he is accept it , nothing happen.


this in paclethandler.cs

PHP Code:
        #region KnownPersons
        
static void RemoveFriend(KnownPersons knownpersonClient.GameState client)
        {
            if (
client.Friends.ContainsKey(knownperson.UID))
            {
                
Game.ConquerStructures.Society.Friend friend client.Friends[knownperson.UID];
                if (
friend.IsOnline)
                {
                    
friend.Client.Friends.Remove(client.Entity.UID);
                    
friend.Client.Send(new KnownPersons(true)
                    {
                        
UID client.Entity.UID,
                        
Type KnownPersons.RemovePerson,
                        
Name "",
                        
Online false
                    
});
                }
                
client.Friends.Remove(friend.ID);
                
client.Send(new KnownPersons(true)
                {
                    
UID friend.ID,
                    
Type KnownPersons.RemovePerson,
                    
Name "",
                    
Online false
                
});
                
Database.KnownPersons.RemoveFriend(clientfriend.ID);
            }
        }
        static 
void RemoveEnemy(KnownPersons knownpersonClient.GameState client)
        {
            if (
client.Enemy.ContainsKey(knownperson.UID))
            {
                
Game.ConquerStructures.Society.Enemy enemy client.Enemy[knownperson.UID];

                
client.Enemy.Remove(enemy.ID);
                
client.Send(new KnownPersons(true)
                {
                    
UID enemy.ID,
                    
Type KnownPersons.RemovePerson,
                    
Name "",
                    
Online false
                
});
                
Database.KnownPersons.RemoveEnemy(clientenemy.ID);
            }
        }
        static 
void AddFriend(KnownPersons knownpersonClient.GameState client)
        {
            if (!
client.Friends.ContainsKey(knownperson.UID))
            {
                
Client.GameState Client ServerBase.Kernel.GamePool[knownperson.UID];
                if (
Client != null)
                {
                    
Client.OnMessageBoxOK delegate
                    
{
                        if (
client != null)
                        {
                            if (
client.Socket.Connected)
                            {
                                if (!
Client.Friends.ContainsKey(client.Entity.UID))
                                {
                                    
client.Friends.Add(Client.Entity.UID, new Conquer_Online_Server.Game.ConquerStructures.Society.Friend()
                                    {
                                        
ID Client.Entity.UID,
                                        
Name Client.Entity.Name
                                    
});
                                    
Client.Friends.Add(client.Entity.UID, new Conquer_Online_Server.Game.ConquerStructures.Society.Friend()
                                    {
                                        
ID client.Entity.UID,
                                        
Name client.Entity.Name
                                    
});
                                    
client.Send(new KnownPersons(true)
                                    {
                                        
UID Client.Entity.UID,
                                        
Type KnownPersons.AddFriend,
                                        
Name Client.Entity.Name,
                                        
Online true
                                    
});
                                    
Client.Send(new KnownPersons(true)
                                    {
                                        
UID client.Entity.UID,
                                        
Type KnownPersons.AddFriend,
                                        
Name client.Entity.Name,
                                        
Online true
                                    
});
                                    
Database.KnownPersons.AddFriend(clientclient.Friends[Client.Entity.UID]);
                                    
client.Screen.SendScreen(new Message(Client.Entity.Name " has accepted " client.Entity.Name "'s friendship request."System.Drawing.Color.BlueMessage.TopLeft), true);
                                }
                            }
                        }
                    };
                    
Client.OnMessageBoxCANCEL delegate
                    
{
                        if (
client != null)
                        {
                            if (
client.Socket.Connected)
                            {
                                if (
Client != null)
                                {
                                    if (
Client.Socket.Connected)
                                    {
                                        
client.Send(new Message(Client.Entity.Name " has rejected your friendship request."System.Drawing.Color.BlueMessage.TopLeft));
                                    }
                                }
                            }
                        }
                    };
                    
Client.Send(new NpcReply(NpcReply.MessageBoxclient.Entity.Name " wants to be your friend."));
                }
            }
        }
        public static 
void AddEnemy(Client.GameState clientClient.GameState enemy)
        {
            if (!
client.Enemy.ContainsKey(enemy.Entity.UID))
            {
                
client.Enemy.Add(enemy.Entity.UID, new Conquer_Online_Server.Game.ConquerStructures.Society.Enemy()
                {
                    
ID enemy.Entity.UID,
                    
Name enemy.Entity.Name
                
});
                
client.Send(new KnownPersons(true)
                {
                    
UID enemy.Entity.UID,
                    
Type KnownPersons.AddEnemy,
                    
Name enemy.Entity.Name,
                    
Online true
                
});
                
Database.KnownPersons.AddEnemy(clientclient.Enemy[enemy.Entity.UID]);
            }
        }

        
#endregion 
this in Screen.cs
PHP Code:
        public void SendScreen(Interfaces.IPacket bufferbool self)
        {
            for (
int c 0Objects.Count(); c++)
            {
                
//For a multi threaded application, while we go through the collection
                //the collection might change. We will make sure that we wont go off  
                //the limits with a check.
                
if (>= Objects.Count())
                    break;
                
Interfaces.IMapObject _obj Objects[c];
                if (
_obj == null)
                    continue;
                if (
_obj.UID != Owner.Entity.UID)
                {
                    if (
_obj.MapObjType == Game.MapObjectType.Player)
                    {
                        
GameState client _obj.Owner as GameState;
                        if (
Owner.WatchingGroup != null && client.WatchingGroup == null)
                            continue;
                        
client.Send(buffer);
                    }
                }
            }

            if (
self)
                
Owner.Send(buffer);
        } 
10/14/2011 21:34 ryuchetval#4
you can't compare an integer with a void function...you have to compare 2 numbers
10/14/2011 21:53 abdeen#5
Quote:
Originally Posted by ryuchetval View Post
you can't compare an integer with a void function...you have to compare 2 numbers
more explain please
10/14/2011 21:59 DontSpeakToMe#6
change this (int c = 0; c < Objects.Count(); c++)
for (int c = 0; c < Objects.Length(); c++)

and if (c >= Objects.Count())
for if (c >= Objects.Length())
10/14/2011 22:14 abdeen#7
Quote:
Originally Posted by DontSpeakToMe View Post
change this (int c = 0; c < Objects.Count(); c++)
for (int c = 0; c < Objects.Length(); c++)

and if (c >= Objects.Count())
for if (c >= Objects.Length())
you see this error ?

[Only registered and activated users can see links. Click Here To Register...]
10/14/2011 22:25 DontSpeakToMe#8
ok then try to change ini for uint
10/14/2011 23:46 BaussHacker#9
Remove the () in the code.

Just Objects.Length;
10/14/2011 23:53 abdeen#10
Quote:
Originally Posted by BaussHacker View Post
Remove the () in the code.

Just Objects.Length;

thanks , i`ll try