Quote:
Originally Posted by pro4never
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(1002, 421, 380); //<<= This case means that attacker is Dead and teleported to Tc Then
pTwo.Entity.Teleport(pTwo.Entity.PreviousMapID, pTwo.Entity.PrevX, pTwo.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.UID, ID = Data.ChangePKMode, dwParam = (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.UID, ID = Data.ChangePKMode, dwParam = (uint)pTwo.Entity.PKMode });
this.EventEnd();
}
else
{
pTwo.Entity.Teleport(1002, 421, 380); //<<= This case means that attacker is Dead and teleported to Tc Then
pOne.Entity.Teleport(pOne.Entity.PreviousMapID, pOne.Entity.PrevX, pOne.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.UID, ID = Data.ChangePKMode, dwParam = (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.UID, ID = Data.ChangePKMode, dwParam = (uint)pTwo.Entity.PKMode });
this.EventEnd();
}
}