Elite Pk Tournament

10/23/2011 04:13 abdeen#1
Okay i am working on Elite PK Tournament , and i am trying to make it like real co.

its select two players from each map group to fight , the winner will be sent to Waiting map , and the loser will be sent to Twin City .

so i created it like that .

but till now i have 2 problems .

first one is its selecting 2 players from all game maps not only which i added it in the code ..

second one when player 1 kill player 2 , or The contrary .

the killer dose not sent to waiting map , and who was killed is stay in the map till revive it.


here is my code of it:


PHP Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Conquer_Online_Server.Database;
using Conquer_Online_Server.Client;
using Conquer_Online_Server.Network;
using System.IO;
using Conquer_Online_Server.Network.GamePackets;
using System.Threading;

namespace 
Conquer_Online_Server.Game.Tournaments
{
    public class 
EliteTournament
    
{
        public 
void Start()
        {
            foreach (
Conquer_Online_Server.Client.GameState players in Conquer_Online_Server.ServerBase.Kernel.GamePool.Values)
                if (
players.Entity.MapID == 1631)
                    
this.RandomSelect();
        }

        public static 
Map dynamicMap;
        public 
Client.GameState WinnerLoser;
        public 
Client.GameState pOnepTwo;
        public 
bool Done;
        public 
bool CanEnd;
        public 
Time32 DoneStamp;
        public 
uint pOneDamagepTwoDamage;
        public static 
SafeDictionary<uintGameStatePlayerList = new SafeDictionary<uintGameState>(10000);
        public 
void RandomSelect()
        {

            List<
Client.GameStateplayers = new List<Client.GameState>();
            foreach (
Client.GameState p in ServerBase.Kernel.GamePool.Values)
                
players.Add(p);
            
Random rand = new Random();
            
Client.GameState pOnepTwo;
            
int selectedIndex rand.Next(players.Count);
            
pOne players[selectedIndex];
            
players.RemoveAt(selectedIndex);
            
selectedIndex rand.Next(players.Count);
            
pTwo players[selectedIndex];
            
players.RemoveAt(selectedIndex);
            if (!
ServerBase.Kernel.Maps.ContainsKey(700))
                new 
Map(700Database.DMaps.MapPaths[700]);
            
Map origMap ServerBase.Kernel.Maps[700];
            
dynamicMap origMap.MakeDynamicMap();
            
pOne.Entity.Teleport(origMap.IDdynamicMap.ID, (ushort)ServerBase.Kernel.Random.Next(3570), (ushort)ServerBase.Kernel.Random.Next(3570));
            
pTwo.Entity.Teleport(origMap.IDdynamicMap.ID, (ushort)ServerBase.Kernel.Random.Next(3570), (ushort)ServerBase.Kernel.Random.Next(3570));
            if (
pOne.Map.ID == pTwo.Map.ID)
            {
                
pOne.Entity.RemoveFlag(Network.GamePackets.Update.Flags.Ride);
                
pTwo.Entity.RemoveFlag(Network.GamePackets.Update.Flags.Ride);
                
pTwo.Entity.PKMode pOne.Entity.PKMode;
                
pOne.Entity.PKMode Conquer_Online_Server.Game.Enums.PKMode.PK;
                
pOne.Send(new Data(true) { UID pOne.Entity.UIDID Data.ChangePKModedwParam = (uint)pOne.Entity.PKMode });
                
pOne.Entity.PKMode pTwo.Entity.PKMode;
                
pTwo.Entity.PKMode Conquer_Online_Server.Game.Enums.PKMode.PK;
                
pTwo.Send(new Data(true) { UID pTwo.Entity.UIDID Data.ChangePKModedwParam = (uint)pTwo.Entity.PKMode });
                
Conquer_Online_Server.Network.PacketHandler.WorldMessage("" pOne.Entity.Name " Is Meeting " pTwo.Entity.Name " in the Elite Pk Tournament");
                
Client.GameState[] Clients Conquer_Online_Server.ServerBase.Kernel.GamePool.Values.ToArray();
                foreach (
Client.GameState client in Clients)
                
this.End(client);
            }
        }

        public 
void End(Client.GameState client)
        {
            if (
pOneDamage pTwoDamage)
            {
                
Winner pOne;
                
Loser pTwo;
            }
            else
            {
                
Winner pTwo;
                
Loser pOne;
            }
            
Winner.Entity.Teleport(pOne.Entity.PreviousMapIDpOne.Entity.PrevXpOne.Entity.PrevY);
            
Loser.Entity.Teleport(1002444444);
            
pTwo.Entity.PKMode pOne.Entity.PKMode;
            
pOne.Entity.PKMode Conquer_Online_Server.Game.Enums.PKMode.Capture;
            
pOne.Send(new Data(true) { UID pOne.Entity.UIDID Data.ChangePKModedwParam = (uint)pOne.Entity.PKMode });
            
pOne.Entity.PKMode pTwo.Entity.PKMode;
            
pTwo.Entity.PKMode Conquer_Online_Server.Game.Enums.PKMode.Capture;
            
pTwo.Send(new Data(true) { UID pTwo.Entity.UIDID Data.ChangePKModedwParam = (uint)pTwo.Entity.PKMode });
            
Done true;
            
DoneStamp Time32.Now;
            
CanEnd true;
        }
    }

had i forgot something ? anything error ? :handsdown:

# edit :

please any moderator edit my thread to " I need Help With This "

because its " Hep " O.o
10/23/2011 10:43 -Sensei-#2
Why dont you ask TQ for there cq_map. That should fixed your problem.
10/23/2011 10:50 BaussHacker#3
The map does not auto invite. You have to code it yourself, it's a npcdialog subtype or whatever the name is.
10/23/2011 11:19 dego4ever#4
this is map id "2068"
10/23/2011 18:50 abdeen#5
Quote:
Originally Posted by dego4ever View Post
this is map id "2068"
Thanks Dego4Ever i`ll try it , thanks for help !

Quote:
Originally Posted by Fаng View Post
so... many... threads... and .... questions....
So what ?

Quote:
Originally Posted by -Sensei- View Post
Why dont you ask TQ for there cq_map. That should fixed your problem.
Sure, i will :)

Quote:
Originally Posted by BaussHacker View Post
The map does not auto invite. You have to code it yourself, it's a npcdialog subtype or whatever the name is.
i am just asking about map id and thanks i got it .
10/25/2011 00:43 abdeen#6
Quote:
Originally Posted by Deсker View Post
This is like your 3rd or 4th thread about Elite PK Tournament. I'm not flaming, but I suggest you keep it all in the same thread.
Each thread with a different problem , so could you help me with it ?:D
10/25/2011 01:22 -Sensei-#7
Quote:
Originally Posted by abdeen View Post
Each thread with a different problem , so could you help me with it ?:D
Hey what source are you using?
10/25/2011 01:26 abdeen#8
Quote:
Originally Posted by -Sensei- View Post
Hey what source are you using?
5518+
10/25/2011 02:47 pro4never#9
#Merging threads.

Please stop spamming the forum with incredibly similar threads or ones which ask single small questions. Use a single thread for all your questions as it avoids SO much hassle for everyone involved.


#Cleaned

Try to stay on topic guys.
10/26/2011 17:37 abdeen#10
Quote:
Originally Posted by pro4never View Post
#Merging threads.

Please stop spamming the forum with incredibly similar threads or ones which ask single small questions. Use a single thread for all your questions as it avoids SO much hassle for everyone involved.


#Cleaned

Try to stay on topic guys.
Yes Sir. :D

Quote:
Originally Posted by abdeen View Post
Okay i am working on Elite PK Tournament , and i am trying to make it like real co.

its select two players from each map group to fight , the winner will be sent to Waiting map , and the loser will be sent to Twin City .

so i created it like that .

but till now i have 2 problems .

first one is its selecting 2 players from all game maps not only which i added it in the code ..

second one when player 1 kill player 2 , or The contrary .

the killer dose not sent to waiting map , and who was killed is stay in the map till revive it.


here is my code of it:


PHP Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Conquer_Online_Server.Database;
using Conquer_Online_Server.Client;
using Conquer_Online_Server.Network;
using System.IO;
using Conquer_Online_Server.Network.GamePackets;
using System.Threading;

namespace 
Conquer_Online_Server.Game.Tournaments
{
    public class 
EliteTournament
    
{
        public 
void Start()
        {
            foreach (
Conquer_Online_Server.Client.GameState players in Conquer_Online_Server.ServerBase.Kernel.GamePool.Values)
                if (
players.Entity.MapID == 1631)
                    
this.RandomSelect();
        }

        public static 
Map dynamicMap;
        public 
Client.GameState WinnerLoser;
        public 
Client.GameState pOnepTwo;
        public 
bool Done;
        public 
bool CanEnd;
        public 
Time32 DoneStamp;
        public 
uint pOneDamagepTwoDamage;
        public static 
SafeDictionary<uintGameStatePlayerList = new SafeDictionary<uintGameState>(10000);
        public 
void RandomSelect()
        {

            List<
Client.GameStateplayers = new List<Client.GameState>();
            foreach (
Client.GameState p in ServerBase.Kernel.GamePool.Values)
                
players.Add(p);
            
Random rand = new Random();
            
Client.GameState pOnepTwo;
            
int selectedIndex rand.Next(players.Count);
            
pOne players[selectedIndex];
            
players.RemoveAt(selectedIndex);
            
selectedIndex rand.Next(players.Count);
            
pTwo players[selectedIndex];
            
players.RemoveAt(selectedIndex);
            if (!
ServerBase.Kernel.Maps.ContainsKey(700))
                new 
Map(700Database.DMaps.MapPaths[700]);
            
Map origMap ServerBase.Kernel.Maps[700];
            
dynamicMap origMap.MakeDynamicMap();
            
pOne.Entity.Teleport(origMap.IDdynamicMap.ID, (ushort)ServerBase.Kernel.Random.Next(3570), (ushort)ServerBase.Kernel.Random.Next(3570));
            
pTwo.Entity.Teleport(origMap.IDdynamicMap.ID, (ushort)ServerBase.Kernel.Random.Next(3570), (ushort)ServerBase.Kernel.Random.Next(3570));
            if (
pOne.Map.ID == pTwo.Map.ID)
            {
                
pOne.Entity.RemoveFlag(Network.GamePackets.Update.Flags.Ride);
                
pTwo.Entity.RemoveFlag(Network.GamePackets.Update.Flags.Ride);
                
pTwo.Entity.PKMode pOne.Entity.PKMode;
                
pOne.Entity.PKMode Conquer_Online_Server.Game.Enums.PKMode.PK;
                
pOne.Send(new Data(true) { UID pOne.Entity.UIDID Data.ChangePKModedwParam = (uint)pOne.Entity.PKMode });
                
pOne.Entity.PKMode pTwo.Entity.PKMode;
                
pTwo.Entity.PKMode Conquer_Online_Server.Game.Enums.PKMode.PK;
                
pTwo.Send(new Data(true) { UID pTwo.Entity.UIDID Data.ChangePKModedwParam = (uint)pTwo.Entity.PKMode });
                
Conquer_Online_Server.Network.PacketHandler.WorldMessage("" pOne.Entity.Name " Is Meeting " pTwo.Entity.Name " in the Elite Pk Tournament");
                
Client.GameState[] Clients Conquer_Online_Server.ServerBase.Kernel.GamePool.Values.ToArray();
                foreach (
Client.GameState client in Clients)
                
this.End(client);
            }
        }

        public 
void End(Client.GameState client)
        {
            if (
pOneDamage pTwoDamage)
            {
                
Winner pOne;
                
Loser pTwo;
            }
            else
            {
                
Winner pTwo;
                
Loser pOne;
            }
            
Winner.Entity.Teleport(pOne.Entity.PreviousMapIDpOne.Entity.PrevXpOne.Entity.PrevY);
            
Loser.Entity.Teleport(1002444444);
            
pTwo.Entity.PKMode pOne.Entity.PKMode;
            
pOne.Entity.PKMode Conquer_Online_Server.Game.Enums.PKMode.Capture;
            
pOne.Send(new Data(true) { UID pOne.Entity.UIDID Data.ChangePKModedwParam = (uint)pOne.Entity.PKMode });
            
pOne.Entity.PKMode pTwo.Entity.PKMode;
            
pTwo.Entity.PKMode Conquer_Online_Server.Game.Enums.PKMode.Capture;
            
pTwo.Send(new Data(true) { UID pTwo.Entity.UIDID Data.ChangePKModedwParam = (uint)pTwo.Entity.PKMode });
            
Done true;
            
DoneStamp Time32.Now;
            
CanEnd true;
        }
    }

had i forgot something ? anything error ? :handsdown:

# edit :

please any moderator edit my thread to " I need Help With This "

because its " Hep " O.o


hey guys , so what ?

any help ?????


So what , no one will help me ??
11/25/2011 04:16 nikito157#11
Quote:
Originally Posted by abdeen View Post
5518+

hey bro i want to help you coding it
please add my msn and we can start any time

[Only registered and activated users can see links. Click Here To Register...]
11/25/2011 19:34 agathom#12
Quote:
Originally Posted by nikito157 View Post
hey bro i want to help you coding it
please add my msn and we can start any time

[Only registered and activated users can see links. Click Here To Register...]
:handsdown:
11/26/2011 03:36 thesamuraivega#13
Maybe i can help you
i worck in same proyects :D
example: killtheterrorist fixed :P
add me
[Only registered and activated users can see links. Click Here To Register...] or facebook : @javier.vargasruiz