You last visited: Today at 09:30
Advertisement
Why is this not working?
Discussion on Why is this not working? within the CO2 Private Server forum part of the Conquer Online 2 category.
04/25/2020, 03:04
#1
elite*gold: 0
Join Date: Aug 2010
Posts: 952
Received Thanks: 76
Why is this not working?
Yes I tried using breakpoints and it doesn't seem to get past the MySql part?
Code:
public static bool CreateEntity(Network.GamePackets.EnitityCreate eC, Client.GameClient client,
ref string message)
{
if (eC.Name.Length > 16)
eC.Name = eC.Name.Substring(0, 16);
if (eC.Name == "")
return false;
if (InvalidCharacters(eC.Name))
{
message = "Invalid characters inside the name.";
return false;
}
using (
var rdr =
new MySqlReader(new MySqlCommand(MySqlCommandType.SELECT).Select("entities").Where("name", eC.Name))
)
{
if (rdr.Read())
{
message = "The chosen name is already in use.";
return false;
}
}
client.Entity = new Game.Entity(Game.EntityFlag.Player, false);
client.Entity.Name = eC.Name;
if (eC.Class == 1 || eC.Class == 0)
{
client.Entity.Class = 100;
DataHolder.GetStats(100, 1, client);
}
if (eC.Class == 5 || eC.Class == 4)
{
client.Entity.Class = 40;
DataHolder.GetStats(40, 1, client);
}
if (eC.Class == 12 || eC.Class == 13)
{
client.Entity.Class = 70;
DataHolder.GetStats(70, 1, client);
}
if (eC.Class == 2 || eC.Class == 3)
{
client.Entity.Class = 10;
DataHolder.GetStats(10, 1, client);
}
if (eC.Class == 14 || eC.Class == 15)
{
client.Entity.Class = 80;
DataHolder.GetStats(80, 1, client);
}
if (eC.Class == 10 || eC.Class == 11)
{
client.Entity.Class = 60;
DataHolder.GetStats(60, 1, client);
}
if (eC.Class == 8 || eC.Class == 9)
{
client.Entity.Class = 50;
DataHolder.GetStats(50, 1, client);
}
if (eC.Class == 6 || eC.Class == 7)
{
client.Entity.Class = 20;
DataHolder.GetStats(20, 1, client);
}
client.CalculateStatBonus();
client.CalculateHPBonus();
client.Entity.Hitpoints = client.Entity.MaxHitpoints;
client.Entity.Mana = (ushort)(client.Entity.Spirit * 5);
client.Entity.Body = eC.Body;
if (eC.Body == 1003 || eC.Body == 1004)
client.Entity.Face = (ushort)Kernel.Random.Next(1, 50);
else
client.Entity.Face = (ushort)Kernel.Random.Next(201, 250);
byte Color = (byte)Kernel.Random.Next(4, 8);
client.Entity.HairStyle = (ushort)(Color * 100 + 10 + (byte)Kernel.Random.Next(4, 9));
client.Entity.UID = Database.EntityTable.EntityUID.Next;
client.JustCreated = true;
while (true)
{
using (
var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("entities")
.Where("uid", client.Entity.UID))
using (var reader = cmd.CreateReader())
{
if (reader.Read())
client.Entity.UID = Database.EntityTable.EntityUID.Next;
else
break;
}
}
while (true)
{
try
{
using (var cmd = new MySqlCommand(MySqlCommandType.INSERT))
cmd.Insert("entities")
.Insert("Name", eC.Name)
.Insert("Owner", client.Account.Username)
.Insert("Class", client.Entity.Class)
.Insert("UID", client.Entity.UID)
.Insert("Hitpoints", client.Entity.Hitpoints)
.Insert("Mana", client.Entity.Mana)
.Insert("Body", client.Entity.Body)
.Insert("Face", client.Entity.Face)
.Insert("HairStyle", client.Entity.HairStyle)
.Insert("Strength", client.Entity.Strength)
.Insert("WarehousePW", "")
.Insert("Agility", client.Entity.Agility)
.Insert("Vitality", client.Entity.Vitality)
.Insert("Spirit", client.Entity.Spirit)
.Execute();
message = "ANSWER_OK";
break;
}
catch
{
client.Entity.UID = EntityUID.Next;
}
}
using (
var cmd =
new MySqlCommand(MySqlCommandType.UPDATE).Update("configuration")
.Set("EntityID", client.Entity.UID)
.Where("ServerPort", 0, true))
cmd.Execute();
client.Account.EntityID = client.Entity.UID;
client.Account.Save(client);
return true;
}
Here is part of the sql itself
Code:
-- ----------------------------
-- Table structure for `entities`
-- ----------------------------
DROP TABLE IF EXISTS `entities`;
CREATE TABLE `entities` (
`Name` varchar(16) NOT NULL default '',
`UID` bigint(18) unsigned NOT NULL default '0',
`Owner` varchar(45) NOT NULL default '',
`HairStyle` smallint(12) unsigned default '215',
`Class` tinyint(5) unsigned NOT NULL default '10',
`Money` bigint(18) unsigned default '100',
`ConquerPoints` bigint(18) unsigned default '0',
`Body` smallint(12) unsigned NOT NULL default '0',
`Face` smallint(12) unsigned NOT NULL default '0',
`Level` tinyint(5) unsigned default '1',
`Strength` smallint(12) unsigned default '1',
`Agility` smallint(12) unsigned default '1',
`Vitality` smallint(12) unsigned default '1',
`Spirit` smallint(12) unsigned default '0',
`Atributes` smallint(12) unsigned default '0',
`Hitpoints` mediumint(16) unsigned NOT NULL default '93',
`Mana` mediumint(16) unsigned default '0',
`MapID` smallint(12) unsigned default '1002',
`X` smallint(12) unsigned default '0',
`Y` smallint(12) unsigned default '0',
`PKPoints` smallint(12) unsigned default '0',
`Experience` bigint(255) unsigned default '0',
`QuizPoints` bigint(18) NOT NULL default '0',
`PreviousMapID` smallint(12) unsigned default '1002',
`Spouse` varchar(16) default 'None',
`WarehousePW` bigint(16) default NULL,
`MoneySave` bigint(18) unsigned default '0',
`FirstRebornClass` tinyint(5) unsigned default '0',
`SecondRebornClass` tinyint(5) unsigned default '0',
`FirstRebornLevel` tinyint(5) unsigned default '0',
`SecondRebornLevel` tinyint(5) unsigned default '0',
`Online` tinyint(2) unsigned default '0',
`EnlightenPoints` bigint(18) unsigned default '0',
`DoubleExpTime` bigint(18) unsigned default '0',
`HeavenBlessingTime` bigint(255) unsigned default '0',
`BlessTime` bigint(18) unsigned default '0',
`LastDragonBallUse` bigint(255) default '0',
`LastResetTime` bigint(255) default '0',
`EnlightsReceived` tinyint(5) unsigned default '0',
`EnlightmentWait` mediumint(100) unsigned default '0',
`DoubleExpToday` tinyint(5) unsigned default '0',
`GuildID` bigint(18) unsigned default '0',
`GuildRank` bigint(18) unsigned default '0',
`GuildSilverDonation` bigint(255) unsigned default '0',
`GuildConquerPointDonation` bigint(255) unsigned default '0',
`VIPLevel` tinyint(5) unsigned default '0',
`VirtuePoints` bigint(255) unsigned default '0',
`LotteryEntries` mediumint(10) default '0',
`PreviousX` mediumint(10) default '0',
`PreviousY` mediumint(10) default '0',
`OfflineTGEnterTime` bigint(255) default '0',
`ExpBalls` mediumint(10) default '0',
`ClanId` int(36) unsigned default '0',
`ClanDonation` bigint(64) unsigned default '0',
`ClanRank` int(36) unsigned default '0',
`SubClass` int(36) unsigned NOT NULL default '0',
`SubClassLevel` int(36) unsigned NOT NULL default '0',
`StudyPoints` int(36) unsigned default '0',
`My_Title` int(36) NOT NULL default '0',
`EditNameTimes` bigint(255) unsigned NOT NULL default '5',
`CountryID` smallint(4) default '0',
`Achievement` varchar(255) default NULL,
`CTFCpsReward` bigint(255) default NULL,
`CTFSilverReward` bigint(255) default NULL,
`RacePoints` bigint(18) NOT NULL default '0',
`BoundCPs` int(30) unsigned default '0',
`GuildArsenalDonation` bigint(16) default NULL,
`GuildLastLogin` bigint(16) default NULL,
`ExtraInventory` bigint(255) unsigned default '0',
`Exploits` bigint(255) unsigned default '0',
`GLCTF` int(255) unsigned NOT NULL default '0',
`OnlineTrainning` bigint(18) default NULL,
`HuntingExp` bigint(18) NOT NULL default '0',
`FirstCredit` tinyint(6) NOT NULL default '0',
`AnsweredKingdomQuiz` tinyint(6) unsigned NOT NULL default '0',
`StarterPackLevel` tinyint(5) unsigned NOT NULL default '0',
`NormalGems` bigint(18) unsigned NOT NULL default '0',
`UnionID` bigint(10) unsigned NOT NULL default '0',
`Harem` bigint(10) unsigned NOT NULL default '0',
`Offical` bigint(10) unsigned NOT NULL default '0',
`Guards` bigint(10) unsigned NOT NULL default '0',
`UnionExploits` bigint(10) unsigned NOT NULL default '0',
`Merchant` bigint(255) unsigned NOT NULL default '0',
`DidBrightFortune` bigint(255) unsigned NOT NULL default '0',
`TotalPerfectionScore` bigint(255) unsigned NOT NULL default '0',
`BlackList` longtext NOT NULL,
`DailySignedDays` longtext NOT NULL,
`DailySignRewards` bigint(255) unsigned NOT NULL default '0',
`Wardrobe` varchar(255) default NULL,
`DailySignVIPChances` bigint(255) unsigned NOT NULL default '10',
`SwordSoul` bigint(32) NOT NULL,
`BansheeSpirit` bigint(32) NOT NULL,
PRIMARY KEY (`UID`),
UNIQUE KEY `myIndex` (`UID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
04/25/2020, 08:53
#2
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
You are going to have to be more specific. The "Sql part" begins on line 16, again at line 19 and then basically the last third of your snippet.
04/25/2020, 09:35
#3
elite*gold: 12
Join Date: Jul 2011
Posts: 8,288
Received Thanks: 4,196
Honestly... I find it easier to just ignore his posts...
04/25/2020, 11:09
#4
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
while (true) around mysql statement, yeah really good idea to **** up your system.
Maybe you should use transactions instead.
04/25/2020, 21:15
#5
elite*gold: 0
Join Date: Aug 2010
Posts: 952
Received Thanks: 76
Thanks Super Aids
So it turns out the reason I've been getting all kinds of issues and errors was because of a setting in MySql ffs
Similar Threads
Why why why?
09/07/2019 - Rohan - 1 Replies
Help me! Why cannot find item?
http://epvpimg.com/CHchdab
Why do not you help me why why
01/21/2011 - Metin2 Private Server - 8 Replies
hi
Why don't you help me maybe this topic five me I didn't get even one response why why I hesitate on this forum more than one year for help but I don't get it
--
O I want create server server server for mt2 like standard now but all I get it explained to build local I local surfer o I don't want to run a server on your server ip but rather marginal ...
--
Have you bought hosting space or bought a server script to install FreeBSD what hey friends I hope help me one time
Why speed hack is not working .. but the wall hack is working?
11/24/2010 - Soldier Front Hacks, Bots, Cheats & Exploits - 3 Replies
Why speed hack is not working .. but the wall hack is working?
All times are GMT +2. The time now is 09:31 .