Register for your free account! | Forgot your password?

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

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

Advertisement



[Help]Check map of chars

Discussion on [Help]Check map of chars within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
[Help]Check map of chars

Hello....I would need some help in finding if there's any character on a map id like: (this is for LOTF 5165)
Code:
bool CharOnMap(MapId)
{
Character C;
C = Game.World.H_Chars[MapId]
if (C!=null)
return true;
else return false;
}
But I don't think this works so I want to know how I find out if the map contains at least 1 character...
Thanks
ryuchetval is offline  
Old 12/05/2010, 12:08   #2
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,225
Received Thanks: 868
I'd do this.

Code:
public static bool CharsOnMap(int MapID)
{
foreach(GameClient Client in ConnectedClients.Values)
if (Client.Entity.MapID == MapID) { return true; } }
return false;
}
I didnt really understand what you wanted to do.

so just do if (CharsOnMap(MAPID)) or whatever and it'l work.

This just sees if there are ANY characters on the map specified.
_DreadNought_ is offline  
Thanks
1 User
Old 12/05/2010, 12:30   #3
 
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
oh great thanks
ryuchetval is offline  
Old 12/05/2010, 13:22   #4
 
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 506
Quote:
Originally Posted by _DreadNought_ View Post
I'd do this.

Code:
public static bool CharsOnMap(int MapID)
{
foreach(GameClient Client in ConnectedClients.Values)
if (Client.Entity.MapID == MapID) { return true; } }
return false;
}
I didnt really understand what you wanted to do.

so just do if (CharsOnMap(MAPID)) or whatever and it'l work.

This just sees if there are ANY characters on the map specified.
I'll teach you Linq sometime. =)
Basser is offline  
Thanks
1 User
Old 12/05/2010, 16:45   #5
 
.Ocularis's Avatar
 
elite*gold: 0
Join Date: Mar 2008
Posts: 309
Received Thanks: 208
Oh how I love not even looking at loft anymore.
.Ocularis is offline  
Old 12/05/2010, 19:05   #6
 
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
yeah that's a good decision...
ryuchetval is offline  
Old 12/08/2010, 00:50   #7


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Code:
        public bool MapIsEmpty(int MapID)
        {
            GameClient Target = ConnectedClients.Values.Find((GameClient Client) => { return Client.Entity.MapID == MapID; });

            if (Target == null)
                return true;

            return false;
        }
Something like this would be best.
Korvacs is offline  
Thanks
1 User
Old 12/08/2010, 07:39   #8
 
elite*gold: 0
Join Date: Feb 2006
Posts: 550
Received Thanks: 82
or depending how your server is structured

public boolean playersOnMap(int mapID) {
return World.getMap(mapID).size() > 0;
}
ChingChong23 is offline  
Old 12/08/2010, 12:19   #9
 
elite*gold: 0
Join Date: Nov 2010
Posts: 1,162
Received Thanks: 370
Code:
public bool AnyPlayersInMap(ushort MapID)//Since mapids are ushort
{
    int i = 0;
    foreach (Game.Character C in World.H_Chars.Values) {
        if (C.Loc.Map == MapID)
            i++; }

    if (i > 0)
        return true;

    return false;
}
Code:
public int PlayersInMap(ushort MapID)//Since mapids are ushort
{
    int i = 0;
    foreach (Game.Character C in World.H_Chars.Values) {
        if (C.Loc.Map == MapID)
            i++; }

    return i;
}
Syst3m_W1z4rd is offline  
Old 12/08/2010, 14:14   #10
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
Quote:
Originally Posted by 1337 H4X0R View Post
Code:
public bool AnyPlayersInMap(ushort MapID)//Since mapids are ushort
{
    int i = 0;
    foreach (Game.Character C in World.H_Chars.Values) {
        if (C.Loc.Map == MapID)
            i++; }

    if (i > 0)
        return true;

    return false;
}
I'm not saying your method is good or not, but if you're doing it that way simply do:

Code:
public bool MapHasPlayers(ushort Map)
{
foreach(GameClient client in Kernel.GameClients)
 if(client.Entity.MapID == Map)
  return true;

return false
}
Might just stick in that I recommend a public dictonary for all spawned objects on the server, with that you could simply call something like this:

Quote:
public bool MapHasPlayers(Maps map)
{
return (Kernel.Objects[map].Lenght > 0);
}
_Emme_ is offline  
Old 12/08/2010, 16:30   #11
 
elite*gold: 0
Join Date: Feb 2006
Posts: 550
Received Thanks: 82
Length - Wikipedia, the free encyclopedia
ChingChong23 is offline  
Reply


Similar Threads Similar Threads
S> Royality_EU - CHARS ! , Check it out
05/13/2010 - Conquer Online 2 Trading - 41 Replies
Hi all ! :) i have to sell some chars in server ROYALITY_EU , i quit so maybe someone need good chars.. 1. 1st Char is : war-war-tro 130 - 130 - 131 ! with eq: - Super +5 2 soc TRO ARMOR ( SDG SDG ) lvl 120 - Super +5 2 soc RING ( SDG SDG ) lvl 126 !! - Super +5 2 soc CLUB ( SDG SDG ) lvl 130 - Super +5 2 soc BLADE ( SDG SDG ) lvl 130 - Super +4 1soc CORO ( SDG ) lvl 112 - Elite +4 1 soc Neck ( SDG ) lvl 120 - Elite +4 1 soc Boots ( SDG ) lvl 100
[Price check] Chars even.
05/11/2010 - Archlord Trading - 36 Replies
Guys, I have some acounts, and i was wondering what there worth. 1: lvl 3x mage with collection lvl 14,4(and about 2k mats and roughly 700 meta pots) 2: lvl 2x knight with collection lvl 12 and alchemy lvl 9,3(also around 2k mats, lots of rare and finest, so way way more then enough to get it to lvl 10)
WTT/WTS 2 chars persia check it !
03/25/2010 - Silkroad Online Trading - 6 Replies
Name/server:_XenSui_ persia lvl 65 Gold/set:50 milll , npc set +3wep Skills:wizzard 65 cleric 65 +20 k sp Name/server:__Fuxi__ persia lvl 60 gold/set:0 set npc wep npc skills:bicheon/fire/cold 48 520000 sp
just check it ^^ chars + gold for sale
06/15/2009 - 9Dragons - 19 Replies
Hello all :) i have 2 nukers and 1 warrior for sale + lots of gold :) --well the warrior is almost hm :P and it is a bit expensive cuz i used 40k + coins on this account ^^ it has 7 months premium left 2-3 decos 2 tiagrams few xp cards 40 kgs , 100 ems and more ^^ as for items all relics u need , adv clan clothes , a veri nice sword bd 2 sloted +9 3/3 :P 500 def clothes and many others items :P the price for it is around 400e ...idk how this looks for u but after so many time and coins...
WTS/WTT Check thread 2moons/WoW chars
03/13/2009 - Dekaron Trading - 7 Replies
OPEN TO SENSIBLE OFFERS IN CASH OR EVE ISK OK well this is a bit of a stretch but I have two chars on different games which I'd like to sell or trade. 12x Segnale - 2moons Abaddon Naked, no gears at all, has wings, multiple costumes, sylphid token, pet token and 10m dil. Would make a nice addition to someones char base. Also has 60 summoner on the account plus a couple of tiny chars. 80 Blood Elf Death Knight (Unholy DPS) - WoW EU Turalyon



All times are GMT +1. The time now is 11:02.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

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