. Also Credits to EmmeTheCoder for his Start/stop npc codes used for this.Remember to hit Thanks!
First:
Go to General.cs and add this somewhere:
Code:
public static bool PKEvent = false;
Go to Character.cs and search for:
Code:
public void TimerElapsed(object source, ElapsedEventArgs e)
{
Code:
foreach (DictionaryEntry DE in World.AllChars)
{
Character Charr = (Character)DE.Value;
if (Charr.LocMap == 1082)
{
if (DateTime.Now > Charr.Death.AddSeconds(2))
{
if (!Charr.Alive)
{
Charr.Revive(true);
World.SpawnMeToOthers(Charr, true);
World.SpawnOthersToMe(Charr, true);
World.UpdateSpawn(Charr);
Charr.Teleport(1002, 438, 377);
Charr.MyClient.SendPacket(General.MyPackets.Vital( UID, 26, Charr.GetStat()));
Charr.MyClient.SendPacket(General.MyPackets.SendMsg(Charr.MyClient.MessageId, "Eliminator", Charr.Name, "You Were Eliminated!", 2011));
System.Threading.Thread.Sleep(100);
}
}
}
}
In client.cs find the commands all players can use: (usually /save or /coords)
and add this above one of them:
Code:
if (Message == "/joinpk")//coded by RapidBlade
{
if (General.PKEvent == true)
{
MyChar.Teleport(1082, 224, 224);
}
else
{
SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "The PK Event has started is already over, you cannot use the command anymore!", 2005));
}
}
Add the command to start and end it:
Code:
if (Splitter[0] == "/announcepk")//Coded by RapidBlade
{
World.SendMsgToAll("PK Event is about to start! Type /joinpk to join!", "[SYSTEM]", 2011);
General.PKEvent = true;
}
if (Splitter[0] == "/joinpkend")//Coded by RapidBlade
{
World.SendMsgToAll("You are too late! You cannot join the PK Event anymore!", "[SYSTEM]", 2011);
General.PKEvent = false;
}
Add the NPC to leave the area:
Code:
if (CurrentNPC == 61)//PK Event Exiter:By RapidBlade
{
SendPacket(General.MyPackets.NPCSay("Hi there! Would you like to leave the PK Event area?"));
SendPacket(General.MyPackets.NPCLink("Hell Yeah, getting owned is tiring!", 1));
SendPacket(General.MyPackets.NPCLink("Just passing by.", 255));
SendPacket(General.MyPackets.NPCSetFace(30));
SendPacket(General.MyPackets.NPCFinish());
}
Code:
if (CurrentNPC == 61)
{
if (Control == 1)
{
MyChar.Teleport(1002, 438, 377);
MyChar.Action = 250;
}
MyChar.Ready = true;
}
The prize NPC- Credits to Emme for making the start and stop npc codes.
Search in General.cs:
Code:
public static System.Timers.Timer Thetimer;
Code:
public static bool CanTalkToNPC = false;//credits to Emme
Code:
if (Splitter[0] == "/stopnpc")
if (!General.CanTalkToNPC)
{
string K = "Disabled!";
General.CanTalkToNPC = true;
{
World.SendMsgToAll("The Prize Npc For Find/PK Event Has Been Disabled." + K, "NPCHandeler", 2005);
}
}
if (Splitter[0] == "/startnpc")//credits to EmmeTheCoder
{
string K = "Activated!";
if (General.CanTalkToNPC)
{
K = "Activated!";
General.CanTalkToNPC = false;
}
World.SendMsgToAll("The Prize Npc For Find/PK Event Has Been Activated." + K, "NPCHandeler", 2005);
}
Code:
if (CurrentNPC == 63)
{
if (!General.CanTalkToNPC)
{
SendPacket(General.MyPackets.NPCSay("Hello PK Master! You win 2 DragonBalls for dominating the tournament!"));
SendPacket(General.MyPackets.NPCLink("Awesome! Give Me My Prize!", 1));
SendPacket(General.MyPackets.NPCSetFace(30));
SendPacket(General.MyPackets.NPCFinish());
}
else
{
SendPacket(General.MyPackets.NPCSay("The prize has been taken."));
SendPacket(General.MyPackets.NPCLink("Okay.", 255));
SendPacket(General.MyPackets.NPCSetFace(30));
SendPacket(General.MyPackets.NPCFinish());
}
}
Code:
if (CurrentNPC == 63)
{
if (Control == 1)
{
SendPacket(General.MyPackets.NPCSay("Here is your Prize."));
SendPacket(General.MyPackets.NPCLink("Thank You.", 5));
SendPacket(General.MyPackets.NPCSetFace(30));
SendPacket(General.MyPackets.NPCFinish());
}
if (Control == 5)
{
MyChar.AddItem("720028-0-0-0-0-0", 0, (uint)General.Rand.Next(346623472));//ConquestArmor
MyChar.AddItem("720028-0-0-0-0-0", 0, (uint)General.Rand.Next(346623472));//ConquestArmor
}
}
Type /announcepk to start the tourny, and it also activates the /joinpk command for normal players. after like 2-3 mins use /joinpkend so after someone dies they can't come bak. use /stopnpc BEFORE the tourny so no prize can randomly b claimed.
I believe thats it, if i left out something post her and ill add it. And please no Flaming, this is only my first release as a noob coder lol.






