|
You last visited: Today at 15:43
Advertisement
[Request]Organized chat.cs?
Discussion on [Request]Organized chat.cs? within the CO2 Private Server forum part of the Conquer Online 2 category.
03/06/2013, 19:45
|
#16
|
elite*gold: 0
Join Date: Jun 2005
Posts: 692
Received Thanks: 353
|
Quote:
Originally Posted by pro4never
One cannot be 'both' a GM and a PM.
|
You simply add both tags to your name: [GM]Pro4Never[PM]. Common sense.
|
|
|
03/06/2013, 19:54
|
#17
|
elite*gold: 0
Join Date: Mar 2013
Posts: 44
Received Thanks: 2
|
Quote:
Originally Posted by nTL3fTy
You simply add both tags to your name: [GM]Pro4Never[PM]. Common sense. 
|
Correct me if i'm wrong, but Pro4Never is right! You can't be both GM and PM...
If your in game name was [GM]Pro4Never[PM], the [PM] would be the status "tag?", and the first [GM] would just be a part of your character name. :-)
|
|
|
03/07/2013, 00:29
|
#18
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,379
|
Quote:
Originally Posted by xScylez
Correct me if i'm wrong, but Pro4Never is right! You can't be both GM and PM...
If your in game name was [GM]Pro4Never[PM], the [PM] would be the status "tag?", and the first [GM] would just be a part of your character name. :-)
|
He's just joking around.
It's in reference to horribly written sources that check your permission based on a tag in your name versus a proper enumerated value to handle player permissions (banned, player, moderator, gm, pm, donator, etcetc). You can then handle all commands, features and such through a single value.
|
|
|
03/07/2013, 00:40
|
#19
|
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
|
you should check players Depending on their Account state not their Name
|
|
|
03/07/2013, 09:34
|
#20
|
elite*gold: 0
Join Date: Mar 2013
Posts: 44
Received Thanks: 2
|
Well, anyways... I still haven't figured out this error
Code:
The name "Cmd" does not exist in the current context
Here is an example where the error comes:
Code:
case "/robot":
{
string Account = "";
string Name = Cmd[1];
if (Game.World.CharacterFromName(Name) == null)
{
Game.Robot R = Database.LoadAsRobot(Name, ref Account);
if (R != null)
R.Init(Account);
}
return true;
}
On the
Code:
string Name = Cmd[1];
, i have the error on "Cmd" does not exist..
Could someone please help me out? :-)
|
|
|
03/07/2013, 14:33
|
#21
|
elite*gold: 0
Join Date: Feb 2013
Posts: 51
Received Thanks: 22
|
Quote:
Originally Posted by xScylez
Well, anyways... I still haven't figured out this error
Code:
The name "Cmd" does not exist in the current context
On the
Code:
string Name = Cmd[1];
, i have the error on "Cmd" does not exist..
Could someone please help me out? :-)
|
string[] Cmd = Message.Split(' ');
|
|
|
03/07/2013, 18:47
|
#22
|
elite*gold: 0
Join Date: Mar 2013
Posts: 44
Received Thanks: 2
|
Quote:
Originally Posted by EgyptianMano
string[] Cmd = Message.Split(' ');
|
Thanks! Well, it removes the Cmd error, but then i get a error:
Code:
The name 'Message' does not exist in the current context
|
|
|
03/07/2013, 19:14
|
#23
|
elite*gold: 0
Join Date: Jun 2005
Posts: 692
Received Thanks: 353
|
It's obvious you don't have a clue what you're doing and should not be trying to modify whatever source this is. You need to start a lot smaller than a Conquer server and learn the basics of programming.
|
|
|
03/07/2013, 19:51
|
#24
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,379
|
Quote:
Originally Posted by nTL3fTy
It's obvious you don't have a clue what you're doing and should not be trying to modify whatever source this is. You need to start a lot smaller than a Conquer server and learn the basics of programming.
|
+1
I already explained this all to him via PM. Learn the absolute basics of programming before anything else.
|
|
|
03/07/2013, 20:02
|
#25
|
elite*gold: 0
Join Date: Mar 2013
Posts: 44
Received Thanks: 2
|
well, it may be that is true! But anyways, i am making this for having fun with friends, and see how coding works and stuff..
Had 94 errors, stuck with 4 left, and all of them are this code:
Code:
string[] Cmd = Message.Split(' ');
Code:
The name 'Message' does not exist in the current context
|
|
|
03/07/2013, 22:26
|
#26
|
elite*gold: 0
Join Date: May 2005
Posts: 1,892
Received Thanks: 920
|
Quote:
Originally Posted by xScylez
well, it may be that is true! But anyways, i am making this for having fun with friends, and see how coding works and stuff..
Had 94 errors, stuck with 4 left, and all of them are this code:
Code:
string[] Cmd = Message.Split(' ');
Code:
The name 'Message' does not exist in the current context
|
You aren't really seeing how code works at all, because fixing this teeters on common sense.
You don't have a variable named Message in the scope of where you're using it.
|
|
|
03/07/2013, 23:32
|
#27
|
elite*gold: 0
Join Date: Mar 2013
Posts: 44
Received Thanks: 2
|
Quote:
Originally Posted by Lateralus
You aren't really seeing how code works at all, because fixing this teeters on common sense.
You don't have a variable named Message in the scope of where you're using it.
|
Hmm, so in this case:
Code:
case "/robot":
{
string Account = "";
string Name = Cmd[1];
if (Game.World.CharacterFromName(Name) == null)
{
Game.Robot R = Database.LoadAsRobot(Name, ref Account);
if (R != null)
R.Init(Account);
}
return true;
}
The error is at Cmd, when i add the code, i get error at message..
Should it be like this then:
Code:
case "/robot":
{
string[] Cmd;
string Account = "";
string Name = Cmd[1];
if (Game.World.CharacterFromName(Name) == null)
{
Game.Robot R = Database.LoadAsRobot(Name, ref Account);
if (R != null)
R.Init(Account);
}
return true;
}
or will the code ruin it?
|
|
|
03/07/2013, 23:57
|
#28
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,379
|
Quote:
Originally Posted by xScylez
Hmm, so in this case:
Code:
case "/robot":
{
string Account = "";
string Name = Cmd[1];
if (Game.World.CharacterFromName(Name) == null)
{
Game.Robot R = Database.LoadAsRobot(Name, ref Account);
if (R != null)
R.Init(Account);
}
return true;
}
The error is at Cmd, when i add the code, i get error at message..
Should it be like this then:
Code:
case "/robot":
{
string[] Cmd;
string Account = "";
string Name = Cmd[1];
if (Game.World.CharacterFromName(Name) == null)
{
Game.Robot R = Database.LoadAsRobot(Name, ref Account);
if (R != null)
R.Init(Account);
}
return true;
}
or will the code ruin it?
|
We've answered this for you like 5 times...
In the context of this thread, Message is a string (text) variable holding a chat message that the player has sent.
Msg is referring to a .Split version of the Message string (stored as an array of strings)
your errors are literally saying that "You never declared a variable called Msg and now you're trying to use it. What is it, what does it contain!?"
So yes... look at the very top of your switch statement and you'll see what your source calls the chat command being processed (split or otherwise)
You now know what the variable is called and can fix your broken-ass code to reference the right variable. 0 errors as they are all the same problem..
|
|
|
03/08/2013, 00:26
|
#29
|
elite*gold: 0
Join Date: Mar 2013
Posts: 44
Received Thanks: 2
|
Quote:
Originally Posted by pro4never
We've answered this for you like 5 times...
In the context of this thread, Message is a string (text) variable holding a chat message that the player has sent.
Msg is referring to a .Split version of the Message string (stored as an array of strings)
your errors are literally saying that "You never declared a variable called Msg and now you're trying to use it. What is it, what does it contain!?"
So yes... look at the very top of your switch statement and you'll see what your source calls the chat command being processed (split or otherwise)
You now know what the variable is called and can fix your broken-ass code to reference the right variable. 0 errors as they are all the same problem..
|
WOOOAAH! I don't understand what i'm doing wrong 
Have been trying to remove the "Message" error for an hour now :/
Code:
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.IO;
namespace NewestCOServer.PacketHandling
{
public class Chat
{
public static void Handle(Main.GameClient GC, byte[] Data)
{
MemoryStream MS = new MemoryStream(Data);
BinaryReader BR = new BinaryReader(MS);
BR.ReadBytes(8);
ushort ChatType = (ushort)BR.ReadUInt32();
BR.ReadBytes(13);
string From = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
string To = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
BR.ReadByte();
string Message = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
BR.Close();
MS.Close();
#region BadWords
Message = Message.Replace("damn", "****");
Message = Message.Replace("fuck", "****");
Message = Message.Replace("shit", "****");
Message = Message.Replace("stupid", "******");
Message = Message.Replace("wtf", "***");
Message = Message.Replace("idiot", "*****");
Message = Message.Replace("fucker", "******");
#endregion
if (ChatType == 2104 && GC.MyChar.MyShop != null)
GC.MyChar.MyShop.Hawk = Message;
try
{
if (Message[0] == '/')
{
string[] Cmd = Message.Split(' ');
if (!PMCommand(GC, Cmd) && !GMCommand(GC, Cmd) && !PlayerCommand(GC, Cmd))
Game.World.Chat(GC.MyChar, ChatType, From, To, Message);
//you can ofcourse use the && to merge that three conditions in one statement but i prefer it like that
}
else
Game.World.Chat(GC.MyChar, ChatType, From, To, Message);
}
catch { }
}
#region PM and GM Commands
public static bool PmandGMCommand(Main.GameClient GC, string[] Msg)
{
string[] Cmd = Message.Split(' ');
if (GC.AuthInfo.Status != "[GM]" && GC.AuthInfo.Status != "[PM]") return false;
switch (Msg[0])
{
case "/lucky":
{
GC.LocalMessage(2000, "Lucky time: " + GC.MyChar.LuckyTime);
return true;
}
case "/robot":
{
string Account = "";
string Name = Cmd[1];
if (Game.World.CharacterFromName(Name) == null)
{
Game.Robot R = Database.LoadAsRobot(Name, ref Account);
if (R != null)
R.Init(Account);
}
return true;
}
case "/robot1":
{
string Account = "";
string Name = Cmd[1];
Game.Robot R = Database.LoadAsRobot(Name, ref Account);
if (R != null)
R.Init(Account);
return true;
}
case "/reborn":
{
GC.MyChar.Reborns = byte.Parse(Cmd[1]);
return true;
}
case "/gems":
{
if (GC.MyChar.Inventory.Count <= 32)
{
GC.MyChar.AddItem(700001);
GC.MyChar.AddItem(700011);
GC.MyChar.AddItem(700021);
GC.MyChar.AddItem(700031);
GC.MyChar.AddItem(700041);
GC.MyChar.AddItem(700051);
GC.MyChar.AddItem(700061);
GC.MyChar.AddItem(700071);
GC.MyChar.AddItem(700101);
GC.MyChar.AddItem(700121);
}
return true;
}
case "/eqlow":
{
for (byte i = 1; i < 9; i++)
if (i != 7)
{
Game.Item I = GC.MyChar.Equips.Get(i);
if (I.ID != 0)
{
Game.ItemIDManipulation IDM = new NewestCOServer.Game.ItemIDManipulation(I.ID);
IDM.LowestLevel(i);
I.ID = IDM.ToID();
GC.AddSend(Packets.AddItem(I, i));
}
}
return true;
}
case "/appr":
{
GC.AddSend(Packets.MentorApprenticePacket(GC.MyChar.EntityID, (uint)Program.Rnd.Next(1000001, 19999999), Cmd[1], byte.Parse(Cmd[2]), 1));
return true;
}
case "/protect":
{
GC.MyChar.Protection = !GC.MyChar.Protection;
return true;
}
case "/effect":
{
GC.AddSend(Packets.String(GC.MyChar.EntityID, 10, Cmd[1]));
return true;
}
case "/exp":
{
GC.MyChar.Experience = ulong.Parse(Cmd[1]);
return true;
}
case "/pkp":
{
GC.MyChar.PKPoints = ushort.Parse(Cmd[1]);
return true;
}
case "/atk":
{
GC.AddSend(Packets.AttackPacket(GC.MyChar.EntityID, GC.MyChar.EntityID, GC.MyChar.Loc.X, GC.MyChar.Loc.Y, 9999, byte.Parse(Cmd[1])));
return true;
}
/*case "/c":
{
Game.World.SendMsgToAll(GC.MyChar.Name, GC.MyChar.Name + ": " + Message.Remove(0, 3), 2011, 0);
return true;
}*/
case "/try":
{
GC.AddSend(Packets.GeneralData(GC.MyChar.EntityID, 1, GC.MyChar.Loc.X, GC.MyChar.Loc.Y, byte.Parse(Cmd[1])));
return true;
}
case "/steed":
{
Game.Item I = new NewestCOServer.Game.Item();
I.ID = 300000;
I.Plus = byte.Parse(Cmd[1]);
I.MaxDur = I.DBInfo.Durability;
I.CurDur = I.MaxDur;
I.Effect = NewestCOServer.Game.Item.RebornEffect.Horsie;
I.TalismanProgress = BitConverter.ToUInt32(new byte[4] { byte.Parse(Cmd[4]), byte.Parse(Cmd[3]), byte.Parse(Cmd[2]), 0 }, 0);
I.UID = (uint)Program.Rnd.Next(10000000);
GC.MyChar.AddItem(I);
return true;
}
case "/ctele":
{
Game.Character C = Game.World.CharacterFromName(Cmd[1]);
if (C != null)
GC.MyChar.Teleport(C.Loc.Map, C.Loc.X, C.Loc.Y);
return true;
}
case "/seff":
{
GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.Effect, ulong.Parse(Cmd[1])));
return true;
}
case "/vip":
{
GC.MyChar.VipLevel = byte.Parse(Cmd[1]);
GC.AddSend(Packets.ChatMessage(0, "SYSTEM", GC.MyChar.Name, "Congratulations! Your vip level is " + GC.MyChar.VipLevel + ". Thank you for donating.", 2001, 0));
return true;
}
case "/try1":
{
GC.AddSend(Packets.GeneralData(GC.MyChar.EntityID, 0, 0, 0, byte.Parse(Cmd[1])));
return true;
}
case "/shopflag":
{
Game.NPC N = new NewestCOServer.Game.NPC(1234.ToString() + ' ' + 1080 + ' ' + 16 + ' ' + 6 + ' ' + 0 + ' ' + GC.MyChar.Loc.Map + ' ' + GC.MyChar.Loc.X + ' ' + GC.MyChar.Loc.Y);
Game.World.Spawn(N);
return true;
}
case "/mb":
{
GC.MyChar.AddItem(721080);
return true;
}
case "/status":
{
GC.AddSend(Packets.Status(GC.MyChar.EntityID, (NewestCOServer.Game.Status)byte.Parse(Cmd[1]), ulong.Parse(Cmd[2])));
return true;
}
case "/xp":
{
GC.MyChar.StatEff.Add(NewestCOServer.Game.StatusEffectEn.XPStart);
GC.MyChar.Buffs.Add(new Game.Buff() { StEff = NewestCOServer.Game.StatusEffectEn.XPStart, Lasts = 20, Started = DateTime.Now, Eff = NewestCOServer.Features.SkillsClass.ExtraEffect.None });
return true;
}
case "/life":
{
GC.MyChar.CurMP = (ushort)GC.MyChar.MaxMP;
GC.MyChar.CurHP = (ushort)GC.MyChar.MaxHP;
return true;
}
case "/scroll":
{
if (Cmd[1] == "tc")
GC.MyChar.Teleport(1002, 432, 380);
if (Cmd[1] == "bi")
GC.MyChar.Teleport(1015, 716, 575);
if (Cmd[1] == "pc")
GC.MyChar.Teleport(1011, 193, 261);
if (Cmd[1] == "dc")
GC.MyChar.Teleport(1000, 500, 650);
if (Cmd[1] == "ac")
GC.MyChar.Teleport(1020, 565, 562);
if (Cmd[1] == "ma")
GC.MyChar.Teleport(1036, 211, 196);
if (Cmd[1] == "pka")
GC.MyChar.Teleport(1005, 50, 50);
if (Cmd[1] == "house")
GC.MyChar.Teleport(1099, 44, 40);
if (Cmd[1] == "ship")
//This works only if you have the ship map
GC.MyChar.Teleport(9999, 67, 52);
return true;
}
case "/newguild":
{
if (GC.MyChar.MyGuild == null)
{
try
{
ushort NewGuildID = (ushort)Program.Rnd.Next(ushort.MaxValue);
while (Features.Guilds.AllTheGuilds.Contains(NewGuildID))
NewGuildID = (ushort)Program.Rnd.Next(ushort.MaxValue);
Features.Guilds.CreateNewGuild(Cmd[1], NewGuildID, GC.MyChar);
Game.World.Spawn(GC.MyChar, false);
GC.AddSend(Packets.GuildInfo(GC.MyChar.MyGuild, GC.MyChar));
GC.AddSend(Packets.String(GC.MyChar.MyGuild.GuildID, (byte)Game.StringType.GuildName, GC.MyChar.MyGuild.GuildName));
}
catch (Exception Exc) { Program.WriteLine(Exc); }
}
return true;
}
case "/tryatk":
{
GC.AddSend(Packets.AttackPacket(GC.MyChar.EntityID, GC.MyChar.EntityID, GC.MyChar.Loc.X, GC.MyChar.Loc.Y, 300, byte.Parse(Cmd[1])));
return true;
}
case "/skill":
{
GC.MyChar.RWSkill(new Game.Skill() { ID = ushort.Parse(Cmd[1]), Lvl = byte.Parse(Cmd[2]), Exp = 0 });
return true;
}
case "/prof":
{
GC.MyChar.RWProf(new Game.Prof() { ID = ushort.Parse(Cmd[1]), Lvl = byte.Parse(Cmd[2]), Exp = 0 });
return true;
}
case "/blue":
{
GC.MyChar.BlueName = !GC.MyChar.BlueName;
return true;
}
case "/kick":
{
Game.Character C = Game.World.CharacterFromName(Cmd[1]);
if (C != null)
C.MyClient.Disconnect();
return true;
}
case "/k":
{
Game.Character C = Game.World.CharacterFromName(Cmd[1]);
if (C != null)
C.MyClient.Disconnect();
return true;
}
case "/vp":
{
GC.LocalMessage(2000, "You have " + GC.MyChar.VP + " virtue points.");
return true;
}
case "/map":
{
GC.LocalMessage(2000, "The ID of the map you are on is " + GC.MyChar.Loc.Map);
return true;
}
case "/job":
{
GC.MyChar.Job = byte.Parse(Cmd[1]);
return true;
}
case "/silvers":
{
GC.MyChar.Silvers = uint.Parse(Cmd[1]);
return true;
}
case "/cps":
{
GC.MyChar.CPs = uint.Parse(Cmd[1]);
return true;
}
case "/tele":
{
GC.MyChar.Teleport(ushort.Parse(Cmd[1]), ushort.Parse(Cmd[2]), ushort.Parse(Cmd[3]));
return true;
}
case "/item":
{
uint ID = 0;
foreach (DatabaseItem DI in Database.DatabaseItems.Values)
if (DI.Name == Cmd[1])
{
ID = DI.ID;
Game.ItemIDManipulation e = new Game.ItemIDManipulation(ID);
Game.Item.ItemQuality Quality = e.Quality;
if (Cmd[2].ToLower() == "refined") Quality = Game.Item.ItemQuality.Refined;
else if (Cmd[2].ToLower() == "unique") Quality = Game.Item.ItemQuality.Unique;
else if (Cmd[2].ToLower() == "elite") Quality = Game.Item.ItemQuality.Elite;
else if (Cmd[2].ToLower() == "super") Quality = Game.Item.ItemQuality.Super;
else if (Cmd[2].ToLower() == "simple") Quality = Game.Item.ItemQuality.Simple;
else if (Cmd[2].ToLower() == "fixed") Quality = Game.Item.ItemQuality.Fixed;
else if (Cmd[2].ToLower() == "poor") Quality = Game.Item.ItemQuality.Poor;
else if (Cmd[2].ToLower() == "normal") Quality = Game.Item.ItemQuality.Normal;
if (e.Quality == Quality)
break;
}
if (ID != 0 && GC.MyChar.Inventory.Count < 40)
{
Game.ItemIDManipulation e = new Game.ItemIDManipulation(ID);
Game.Item.ItemQuality Quality = e.Quality;
bool change = true;
if (Cmd[2].ToLower() == "refined") Quality = Game.Item.ItemQuality.Refined;
else if (Cmd[2].ToLower() == "unique") Quality = Game.Item.ItemQuality.Unique;
else if (Cmd[2].ToLower() == "elite") Quality = Game.Item.ItemQuality.Elite;
else if (Cmd[2].ToLower() == "super") Quality = Game.Item.ItemQuality.Super;
else if (Cmd[2].ToLower() == "simple") Quality = Game.Item.ItemQuality.Simple;
else if (Cmd[2].ToLower() == "fixed") Quality = Game.Item.ItemQuality.Fixed;
else if (Cmd[2].ToLower() == "poor") Quality = Game.Item.ItemQuality.Poor;
else if (Cmd[2].ToLower() == "normal") Quality = Game.Item.ItemQuality.Normal;
else change = false;
if (change)
e.QualityChange(Quality);
ID = e.ToID();
if (!Database.DatabaseItems.ContainsKey(ID))
{
return true;
}
Game.Item I = new NewestCOServer.Game.Item();
if (e.Part(0, 2) == 11 || e.Part(0, 2) == 13 || e.Part(0, 3) == 123 || e.Part(0, 3) == 141 || e.Part(0, 3) == 142)
I.Color = NewestCOServer.Game.Item.ArmorColor.Orange;
//I.FreeItem = true;
I.ID = ID;
I.UID = (uint)Program.Rnd.Next(10000000);
try
{
I.MaxDur = I.DBInfo.Durability;
I.CurDur = I.MaxDur;
}
catch (Exception Exc) { Program.WriteLine(Exc); }
try
{
I.Plus = byte.Parse(Cmd[3]);
}
catch { }
try
{
I.Bless = byte.Parse(Cmd[4]);
}
catch { }
try
{
I.Enchant = byte.Parse(Cmd[5]);
}
catch { }
try
{
I.Soc1 = (Game.Item.Gem)byte.Parse(Cmd[6]);
}
catch { }
try
{
I.Soc2 = (Game.Item.Gem)byte.Parse(Cmd[7]);
}
catch { }
I.Effect = NewestCOServer.Game.Item.RebornEffect.None;
GC.MyChar.AddItem(I);
}
return true;
}
/*case "/map":
{
//do ur codes here
return true;
}*/
return false;
}
}
#endregion
#region PM Commands
public static bool PMCommand(Main.GameClient GC, string[] Msg)
{
string[] Cmd = Message.Split(' ');
if (GC.AuthInfo.Status != "[PM]") return false;
switch (Msg[0])
{
case "/day":
{
Game.World.ScreenColor = 0;
foreach (Game.Character C in Game.World.H_Chars.Values)
try
{
C.MyClient.AddSend(Packets.GeneralData(C.EntityID, Game.World.ScreenColor, 0, 0, 104));
GC.LocalMessage(2011, "Haa day has arrived good morning everyone");
}
catch { }
return true;
}
case "/night":
{
Game.World.ScreenColor = 5855577;
foreach (Game.Character C in Game.World.H_Chars.Values)
try
{
C.MyClient.AddSend(Packets.GeneralData(C.EntityID, Game.World.ScreenColor, 0, 0, 104));
GC.LocalMessage(2011, "Haa night has arrived good night everyone ");
}
catch { }
return true;
}
case "/night1":
{
Game.World.ScreenColor = 5355577;
foreach (Game.Character C in Game.World.H_Chars.Values)
try
{
C.MyClient.AddSend(Packets.GeneralData(C.EntityID, Game.World.ScreenColor, 0, 0, 104));
}
catch { }
return true;
}
case "/night2":
{
Game.World.ScreenColor = 6908265;
foreach (Game.Character C in Game.World.H_Chars.Values)
try
{
C.MyClient.AddSend(Packets.GeneralData(C.EntityID, Game.World.ScreenColor, 0, 0, 104));
}
catch { }
return true;
}
case "/stats":
{
GC.MyChar.Str = 500;
GC.MyChar.Agi = 500;
GC.MyChar.Vit = 500;
GC.MyChar.Spi = 500;
return true;
}
case "/closeserver": //Only works on the server PC
{
foreach (Game.Character C in Game.World.H_Chars.Values)
try
{
C.MyClient.LogOff(true);
}
catch { continue; }
Database.SaveKOs();
Features.Guilds.SaveGuilds();
Features.SkillsClass.Save();
Environment.Exit(0);
System.Diagnostics.Process.Start("NewestCOServer.exe");
return true;
}
case "/restart": //Only works on the server PC
{
NewestCOServer.Main.AuthWorker.Listener.Close();
NewestCOServer.Main.GameWorker.Listener.Close();
try
{
foreach (Game.Character C in Game.World.H_Chars.Values)
{
try
{
C.MyClient.Disconnect();
Console.WriteLine(C.Name + " has logged off successfuly.");
}
catch { continue; }
}
}
catch { }
Database.SaveKOs();
Console.WriteLine("KOs saved.");
Database.SaveEmpire();
Console.WriteLine("Empire saved.");
Features.Guilds.SaveGuilds();
Console.WriteLine("Guilds saved.");
Features.SkillsClass.Save();
Console.WriteLine("Skills saved.");
Console.WriteLine("Database disposed.");
Console.WriteLine("Write /exit or click X to close the window.");
System.Diagnostics.Process.Start("NewestCOServer.exe");
Environment.Exit(0);
return true;
}
case "/dropevent":
{
try
{
if (Program.DropEventTimer == null)
{
bool start = true;
if (Cmd[1].ToLower() == "dragonball")
{
Program.DropEventType = "dragonball";
Program.SaveOldRate = DropRates.DragonBall;
DropRates.DragonBall = (DropRates.DragonBall * int.Parse(Cmd[3]));
}
else if (Cmd[1].ToLower() == "meteor")
{
Program.DropEventType = "meteor";
Program.SaveOldRate = DropRates.Meteor;
DropRates.Meteor = (DropRates.Meteor * int.Parse(Cmd[3]));
}
else if (Cmd[1].ToLower() == "minicpbag")
{
Program.DropEventType = "minicpbag";
Program.SaveOldRate = DropRates.CPMiniBag;
DropRates.CPMiniBag = (DropRates.CPMiniBag == 0 ? 1 : DropRates.CPMiniBag * int.Parse(Cmd[3]));
}
else if (Cmd[1].ToLower() == "cpbag")
{
Program.DropEventType = "cpbag";
Program.SaveOldRate = DropRates.CPBag;
DropRates.CPBag = (DropRates.CPBag == 0 ? 1 : DropRates.CPBag * int.Parse(Cmd[3]));
}
else
start = false;
if (start)
{
Program.DropEventTimer = new System.Timers.Timer();
Program.DropEventTimer.Interval = (int.Parse(Cmd[2]) * 60000);
Program.DropEventTimer.Elapsed += new System.Timers.ElapsedEventHandler(Program.QuestDropDone);
Program.DropEventTimer.Start();
Game.World.SendMsgToAll("Server", "[Event] Server will drop " + Cmd[1] + "s " + Cmd[3] + "x for " + Cmd[2] + " minutes.", 2011, 0);
}
else
GC.LocalMessage(2001, "Item name is not a dropevent!");
}
else
GC.LocalMessage(2001, "There is a running event, you must wait it end to start a new!");
}
catch { GC.LocalMessage(2001, "Wrongs values!"); GC.LocalMessage(2001, "Format: /questdrop ItemName Minutes Timers"); GC.LocalMessage(2001, "Example: /questdrop dragonball 15 1000 its in up the rates to 1000x in 15 minutos."); }
return true;
}
case "/itemtest":
{
Game.Item I = new NewestCOServer.Game.Item();
I.Effect = NewestCOServer.Game.Item.RebornEffect.Shield;
I.ID = 410329;
I.Plus = 12;
I.Soc1 = NewestCOServer.Game.Item.Gem.SuperDragonGem;
I.Soc2 = NewestCOServer.Game.Item.Gem.SuperRainbowGem;
I.Bless = 5;
I.Enchant = 200;
I.UID = (uint)Program.Rnd.Next(10000000);
GC.AddSend(Packets.AddItem(I, 0));
return true;
}
case "/drop":
{
uint DropID = 0;
Random Rnd = new Random();
string DropWhat = Cmd[1].ToLower();
byte HowMany = (byte)Math.Min(ushort.Parse(Cmd[2]), (ushort)255);
switch (DropWhat)
{
case "dragonball": DropID = 1088000; break;
case "meteor": DropID = 1088001; break;
case "pointcard": DropID = 780000; break;
case "moonbox": DropID = 721080; break;
case "bag": DropID = 729910; break;
case "ball": DropID = 723834; break;
}
Game.DroppedItem DI = new Game.DroppedItem();
DI.DropTime = DateTime.Now;
DI.UID = (uint)Rnd.Next(10000000);
DI.Loc = new Game.Location();
DI.Loc.Map = GC.MyChar.Loc.Map;
DI.Info = new Game.Item();
DI.Info.ID = DropID;
DI.Info.UID = (uint)Rnd.Next(10000000);
for (int x = 0; x < HowMany; x++)
{
DI.Loc.X = (ushort)(GC.MyChar.Loc.X + Rnd.Next(15) - Rnd.Next(15));
DI.Loc.Y = (ushort)(GC.MyChar.Loc.Y + Rnd.Next(15) - Rnd.Next(15));
if (!DI.FindPlace((Hashtable)Game.World.H_Items[GC.MyChar.Loc.Map])) continue;
DI.Drop();
}
return true;
}
case "/startgw":
{
Features.GuildWars.StartWar();
return true;
}
case "/recall":
{
if (Cmd[1] != "all")
{
Game.Character C = Game.World.CharacterFromName(Cmd[1]);
if (C != null && C != GC.MyChar)
C.Teleport(GC.MyChar.Loc.Map, GC.MyChar.Loc.X, GC.MyChar.Loc.Y);
}
return true;
}
case "/spawn":
{
if (Cmd.Length == 3)
{
GC.SpawnOnHold = !GC.SpawnOnHold;
if (GC.SpawnOnHold)
{
GC.SpawnXStart = GC.MyChar.Loc.X;
GC.SpawnYStart = GC.MyChar.Loc.Y;
GC.LocalMessage(2000, "Starting to create spawn; Spawn starts: " + GC.SpawnXStart + ", " + GC.SpawnYStart);
}
else
{
GC.LocalMessage(2000, "Ending the spawn.");
StreamWriter SW = new StreamWriter(@"C:\OldCODB\MobSpawns.txt", true);
SW.WriteLine(Cmd[1] + " " + Cmd[2] + " " + GC.MyChar.Loc.Map + " " + GC.SpawnXStart + " " + GC.SpawnYStart + " " + GC.MyChar.Loc.X + " " + GC.MyChar.Loc.Y);
SW.Flush();
SW.Close();
}
}
return true;
}
case "/guard":
{
StreamWriter SW = new StreamWriter(@"C:\OldCODB\MobSpawns.txt", true);
SW.WriteLine(97 + " " + 1 + " " + GC.MyChar.Loc.Map + " " + GC.MyChar.Loc.X + " " + GC.MyChar.Loc.Y + " " + GC.MyChar.Loc.X + " " + GC.MyChar.Loc.Y);
SW.Flush();
SW.Close();
return true;
}
case "/startquiz":
{
if (!Features.QuizShow.QuizON)
Features.QuizShow.Start();
return true;
}
case "/level":
{
GC.MyChar.Experience = 0;
GC.MyChar.Level = byte.Parse(Cmd[1]);
return true;
}
/*case "/map":
{
//do ur codes here
return true;
}*/
}
return false;
}
#endregion
#region GM Commands
public static bool GMCommand(Main.GameClient GC, string[] Msg)
{
string[] Cmd = Message.Split(' ');
if (GC.AuthInfo.Status != "[GM]") return false;
switch (Msg[0])
{
case "/level":
{
if (GC.MyChar.Level <= 140)
{
GC.MyChar.Experience = 0;
GC.MyChar.Level = byte.Parse(Cmd[1]);
}
else
{
GC.LocalMessage(2001, "Since you are GM, your max level can be 140!");
}
return true;
}
/*case "/map":
{
//do ur codes here
return true;
}*/
}
return false;
}
#endregion
#region Player Commands
public static bool PlayerCommand(Main.GameClient GC, string[] Msg)
{
string[] Cmd = Message.Split(' ');
switch (Msg[0])
{
case "/players":
{
GC.LocalMessage(2000, "Players Online: " + Game.World.H_Chars.Count);
string eMsg = "";
foreach (Game.Character C in Game.World.H_Chars.Values)
eMsg += C.Name + ", ";
if (eMsg.Length > 1)
eMsg = eMsg.Remove(eMsg.Length - 2, 2);
GC.LocalMessage(2000, eMsg);
return true;
}
case "/dc":
{
GC.Disconnect();
return true;
}
case "/revive":
{
Game.Character C = Game.World.CharacterFromName(Cmd[1]);
if (C != null && C != GC.MyChar)
C.Ghost = false;
C.BlueName = false;
C.CurHP = (ushort)GC.MyChar.MaxHP;
C.CurMP = (ushort)GC.MyChar.MaxMP;
C.Alive = true;
C.StatEff.Remove(NewestCOServer.Game.StatusEffectEn.Dead);
C.StatEff.Remove(NewestCOServer.Game.StatusEffectEn.BlueName);
C.Body = GC.MyChar.Body;
C.Hair = GC.MyChar.Hair;
C.Equips.Send(GC, false);
return true;
}
case "/forcerevive":
{
if (!GC.MyChar.Alive)
{
if (DateTime.Now > GC.MyChar.DeathHit.AddSeconds(20))
{
GC.MyChar.Ghost = false;
GC.MyChar.BlueName = false;
GC.MyChar.CurHP = (ushort)GC.MyChar.MaxHP;
GC.MyChar.Alive = true;
GC.MyChar.StatEff.Remove(NewestCOServer.Game.StatusEffectEn.Dead);
GC.MyChar.StatEff.Remove(NewestCOServer.Game.StatusEffectEn.BlueName);
GC.MyChar.Body = GC.MyChar.Body;
GC.MyChar.Hair = GC.MyChar.Hair;
GC.MyChar.Equips.Send(GC, false);
if (GC.MyChar.Loc.Map == 1038 && Features.GuildWars.War)
GC.MyChar.Teleport(6001, 32, 72);
else
{
if (GC.MyChar.PKPoints >= 100)
GC.MyChar.Teleport(6000, 32, 72);
else
{
foreach (ushort[] Point in Database.RevPoints)
if (Point[0] == GC.MyChar.Loc.Map)
{
GC.MyChar.Teleport(Point[1], Point[2], Point[3]);
break;
}
}
}
}
}
return true;
}
case "/revivehere":
{
if (!GC.MyChar.Alive)
{
if (DateTime.Now > GC.MyChar.DeathHit.AddSeconds(20))
{
if (GC.MyChar.BlessingLasts > 0)
{
GC.MyChar.Ghost = false;
GC.MyChar.BlueName = false;
GC.MyChar.CurHP = (ushort)GC.MyChar.MaxHP;
GC.MyChar.Alive = true;
GC.MyChar.StatEff.Remove(NewestCOServer.Game.StatusEffectEn.Dead);
GC.MyChar.StatEff.Remove(NewestCOServer.Game.StatusEffectEn.BlueName);
GC.MyChar.Body = GC.MyChar.Body;
GC.MyChar.Hair = GC.MyChar.Hair;
GC.MyChar.Equips.Send(GC, false);
if (GC.MyChar.Loc.Map == 1038)
if (Features.GuildWars.War)
{
GC.LocalMessage(2005, "You cant revive here while guild war is on.");
}
else
{
GC.MyChar.Teleport(GC.MyChar.Loc.Map, GC.MyChar.Loc.X, GC.MyChar.Loc.Y);
}
}
}
}
return true;
}
case "/rh":
{
if (!GC.MyChar.Alive)
{
if (DateTime.Now > GC.MyChar.DeathHit.AddSeconds(20))
{
if (GC.MyChar.BlessingLasts > 0)
{
GC.MyChar.Ghost = false;
GC.MyChar.BlueName = false;
GC.MyChar.CurHP = (ushort)GC.MyChar.MaxHP;
GC.MyChar.Alive = true;
GC.MyChar.StatEff.Remove(NewestCOServer.Game.StatusEffectEn.Dead);
GC.MyChar.StatEff.Remove(NewestCOServer.Game.StatusEffectEn.BlueName);
GC.MyChar.Body = GC.MyChar.Body;
GC.MyChar.Hair = GC.MyChar.Hair;
GC.MyChar.Equips.Send(GC, false);
if (GC.MyChar.Loc.Map == 1038)
if (Features.GuildWars.War)
{
GC.LocalMessage(2005, "You cant revive here while guild war is on.");
}
else
{
GC.MyChar.Teleport(GC.MyChar.Loc.Map, GC.MyChar.Loc.X, GC.MyChar.Loc.Y);
}
}
}
}
return true;
}
/*case "/map":
{
//do ur codes here
return true;
}*/
}
return false;
}
#endregion
}
}
|
|
|
03/08/2013, 05:12
|
#30
|
elite*gold: 20
Join Date: Jan 2006
Posts: 890
Received Thanks: 241
|
Quote:
Originally Posted by xScylez
WOOOAAH! I don't understand what i'm doing wrong 
Have been trying to remove the "Message" error for an hour now :/
|
public static bool PmandGMCommand(Main.GameClient GC, string[] Msg)
{
string[] Cmd = Message.Split(' ');
Message is undeclared you're using Msg in your bool...
|
|
|
 |
|
Similar Threads
|
Get the Section organized.
07/14/2013 - Need for Speed World - 37 Replies
Hello everyone.
I would like to ask you all, what do you think about getting the section divided in two; so that we could have a Main section, to discuss about the game, have general questions and so on, and a Hacks sub-section in which we can have just releases there?
I have been thinking about this, to get everything even more centralized, as well, we could avoid double posts/malware/spam in general.
So any comments, leave them below, and definitely, vote.
|
Elo boost service the best, fast and most organized
01/29/2013 - League of Legends Trading - 5 Replies
Hi, we are 3 players from 2.3 , 2.1, and 2,05k elo we are starting to boost we already boosted not for money, just a few friends it worked now they are at 1600 elo.
First of all this are our prices are all negociable
0 -1250 10 € per 100 elo
1250-1400 15 € per 100 elo
1400-1600 20 € per 100 elo
|
(request) chat filter
12/01/2009 - GunZ - 0 Replies
i've looked all over and all i want it just the chat filter. does anyone have just the chat filter?
|
All times are GMT +1. The time now is 15:46.
|
|