if player1 killed player2 do this action , else do another action .

10/27/2011 03:23 abdeen#1
Okay , sorry for this thread but the old one none joining it , or trying to correct my wrong , well .

if p1 killed p2 do this action , else do this action . is what i wanna to convert this into C# , so how to make it,

for example.



PHP Code:
if (Player1 killed Player2)
{
Player1.Entity.Teleport(1002000 000);
Player2.Entity.Teleport(1003000 000);
}
else 
{
Player1.Entity.Teleport(1003000 000);
Player2.Entity.Teleport(1002000 000); 
10/27/2011 04:02 shadowman123#2
Quote:
Originally Posted by abdeen View Post
Okay , sorry for this thread but the old one none joining it , or trying to correct my wrong , well .

if p1 killed p2 do this action , else do this action . is what i wanna to convert this into C# , so how to make it,

for example.



PHP Code:
if (Player1 killed Player2)
{
Player1.Entity.Teleport(1002000 000);
Player2.Entity.Teleport(1003000 000);
}
else 
{
Player1.Entity.Teleport(1003000 000);
Player2.Entity.Teleport(1002000 000); 
Code:
if (attacker.MapID == 1038 && attacked.MapID == 1038) <<== Check about that They r in same map (its useless anyways )
                        {
                            if (attacker.Owner.Entity.Dead)
                            {
                                attacker.Teleport(1002, 421, 380);<<= This case means that attacker is Dead and teleported to Tc Then
                            }
                            else
                            {
                                attacker.Teleport(1003, 421, 380); <<= This case means that attacker is alive and be teleported to get prize
                            }
                        }
thats what came on my mind
10/27/2011 04:10 abdeen#3
its Dynamic map , so its wont work .
10/27/2011 06:42 pro4never#4
Simplest way I can think of doing it is when you add them to your event (I assume this is still for your elite pk tournament so you should be posting this question inside that thread like I told you to...) would be to create a class for ElitePkTournamentMatch.

This will hold both players, their damage and everything else as well as having some simple methods such as..

EventStart()
EventEnd()
Win(bool playerOne)

etc

Then in your player death code do something like..

if(user.ElitePkMatch !=null)
{
if(user == user.ElitePkMatch.PlayerOne)
user.ElitePkMatch.Win(PlayerOne);
else
user.ElitePkMath.Win(PlayerTwo);
}


Then in your win method make sure to award prizes and run your RoundEnd() code which would clear the ElitePkMatch value for all clients competing and send them to wherever you want.

Tada!


<edit>

The reason I would do something like that is it avoids any extra threads or timers checking conditions... I'd consider it more of an "asynchronous event" because the only time the event needs to end (in this situation) is when a player dies... so you run your checks only when someone dies! If you wanted the round to also have a timeout value then you'd need a different solution (such as a timer which will end the round if it hasn't already been destroyed when the timer expires... but w/e!)
10/27/2011 18:06 abdeen#5
Quote:
Originally Posted by pro4never View Post
Simplest way I can think of doing it is when you add them to your event (I assume this is still for your elite pk tournament so you should be posting this question inside that thread like I told you to...) would be to create a class for ElitePkTournamentMatch.

This will hold both players, their damage and everything else as well as having some simple methods such as..

EventStart()
EventEnd()
Win(bool playerOne)

etc

Then in your player death code do something like..

if(user.ElitePkMatch !=null)
{
if(user == user.ElitePkMatch.PlayerOne)
user.ElitePkMatch.Win(PlayerOne);
else
user.ElitePkMath.Win(PlayerTwo);
}


Then in your win method make sure to award prizes and run your RoundEnd() code which would clear the ElitePkMatch value for all clients competing and send them to wherever you want.

Tada!


<edit>

The reason I would do something like that is it avoids any extra threads or timers checking conditions... I'd consider it more of an "asynchronous event" because the only time the event needs to end (in this situation) is when a player dies... so you run your checks only when someone dies! If you wanted the round to also have a timeout value then you'd need a different solution (such as a timer which will end the round if it hasn't already been destroyed when the timer expires... but w/e!)

so this code will not work for me ?

PHP Code:
        public void EventEnd()
        {
            if (
pOne.Entity.Dead)
            {
                
pOne.Entity.Teleport(1002421380); //<<= This case means that attacker is Dead and teleported to Tc Then
                
pTwo.Entity.Teleport(pTwo.Entity.PreviousMapIDpTwo.Entity.PrevXpTwo.Entity.PrevY);
                
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 });
                
this.EventEnd();
            }
            else
            {
                
pTwo.Entity.Teleport(1002421380); //<<= This case means that attacker is Dead and teleported to Tc Then
                
pOne.Entity.Teleport(pOne.Entity.PreviousMapIDpOne.Entity.PrevXpOne.Entity.PrevY);
                
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 });
                
this.EventEnd();
            }
        } 
10/28/2011 22:13 thesamuraivega#6
abdeen

hey bro ty for help me with random select player sistem hehe :)
10/29/2011 22:54 abdeen#7
you are welcome.