Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Release] find command fix

Status
Not open for further replies.
Newbie Spellweaver
Joined
Nov 13, 2006
Messages
17
Reaction score
0
Requirements: [Release] !find

Use the following on your MySQL database:
Code:
DROP TABLE IF EXISTS `maps`;
CREATE TABLE  `maps` (
  `id` int(10) unsigned NOT NULL default '999999999',
  `name` varchar(55) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Then run this SQL script:


Then, in Players.cpp add:
Code:
#include "MySQLM.h"
Delete
Code:
switch(mapid){
...
}
Change
Code:
char mapname[999];
To (What moron wasted memory on all those chars?)
Code:
char mapname[60];
Change
Code:
char text[999];
To (It really didn't take very long to find the longest mapname and add 13 to it to get this number)
Code:
char text[100];
Change
Code:
sprintf_s(text, 999, "%s is currently located at \"%s\"", iter->second->getName(), mapname);
To
Code:
sprintf_s(text, 100, "%s is currently located at \"%s\"", iter->second->getName(), mapname);
Insert
Code:
MySQL::getStringI("maps", "id", mapid, "name", mapname);
After
Code:
char mapname[60];

You'll also need to change a line in MySQLM.cpp
Change (in getStringI)
Code:
strcpy_s(string, 13, (char*)mrow[0]);
To
Code:
strcpy_s(string, 60, (char*)mrow[0]);

You may also want to change the case of the name being searched for to all uppercase or all lowercase, repeating the process for the name you're currently checking against. (ie. convert name to upper and assign iter->second->getName() to upper, then do a strcmp() on them)

Problem solved.
 
Last edited:
Newbie Spellweaver
Joined
Apr 6, 2008
Messages
55
Reaction score
0
Woah, thanks for this!
I hated that huge gap. -.-
 
Newbie Spellweaver
Joined
Nov 13, 2006
Messages
17
Reaction score
0
So this should work like /find in real maple?

Only if you have the !find command already placed in your Players.cpp. It was released a few days ago, and it's also included in Krytical's repack.
 
Newbie Spellweaver
Joined
Apr 6, 2008
Messages
55
Reaction score
0
Broken, this was just basically a fix so you don't use alot of energy, lmao.

This uses way less usage.
 
Newbie Spellweaver
Joined
Feb 19, 2008
Messages
33
Reaction score
0
Yeah, i already did, this is nice thanks man!
Edit: When i type !find BrokenxG the server crashes
and points to this if(mysql_num_rows(mres) > 0){
strcpy_s(string, 13, (char*)mrow[0]);
}

inside the void MySQL::getStringI(char* table, char* whr, int wht, char* value, char* string){
function
 
Newbie Spellweaver
Joined
Apr 5, 2008
Messages
84
Reaction score
0
NOTE: Untested, I don't see any reason why this shouldn't work, but until I can get Hamachi up so I can test it...

Use the following on your MySQL database:
Code:
DROP TABLE IF EXISTS `maps`;
CREATE TABLE  `maps` (
  `id` int(10) unsigned NOT NULL default '999999999',
  `name` varchar(55) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Then run this SQL script:


Then, in Players.cpp add:
Code:
#include "MySQLM.h"
Delete
Code:
switch(mapid){
...
}
Change
Code:
char mapname[999];
To (What moron wasted memory on all those chars?)
Code:
char mapname[55];
Change
Code:
char text[999];
To (It really didn't take very long to find the longest mapname and add 13 to it to get this number)
Code:
char text[94];
Change
Code:
sprintf_s(text, 999, "%s is currently located at \"%s\"", iter->second->getName(), mapname);
To
Code:
sprintf_s(text, 94, "%s is currently located at \"%s\"", iter->second->getName(), mapname);
Insert
Code:
MySQL::getStringI("maps", "id", mapid, "name", mapname);
After
Code:
char mapname[55];

Problem solved.

Uhh... guys... I hope you do know that /whisper and /find has been released. (0x58,0x05 | 0x06)
 
Newbie Spellweaver
Joined
Jul 9, 2007
Messages
47
Reaction score
0
hm . what exactly was wrong with the first one released ? i added that and its working fine
 
Newbie Spellweaver
Joined
Apr 6, 2008
Messages
55
Reaction score
0
hm . what exactly was wrong with the first one released ? i added that and its working fine

The first one takes up way to much room, guess this is for OCD Freaks XD

Also, tanjiajun_34

just search for
Code:
 switch(mapid){

the ' ... ' 's mean everything in between

switch(mapid){
and
}
 
Newbie Spellweaver
Joined
Nov 13, 2006
Messages
17
Reaction score
0
hm . what exactly was wrong with the first one released ? i added that and its working fine

The problem with the first release of it is that it's extremely crude. Not to mention the fact that whoever wrote it used 999-character arrays when the most needed is 100. But it saves space, and it really just boils down to acceptable coding practices. 1100+ cases is just a little too stupid. No one should ever hard-code that much data into their code.

@chiasoft
I actually hadn't seen that it was released, but I was just trying to alter the code that most people are going to be using for a while anyway.
 
Newbie Spellweaver
Joined
Nov 13, 2006
Messages
17
Reaction score
0
Have you installed the find command yet? If you haven't that would explain why you can't find it. That's why I said "find command FIX".

@BrokenxG
You might want to check out the last 2 code boxes in my post. I added them after I was getting the same error. That one change should fix the problem.
 
Junior Spellweaver
Joined
Oct 10, 2007
Messages
101
Reaction score
0
i get a error when i try to login if i change
strcpy_s(string, 13, (char*)mrow[0]);
):

Edit :
fixed. u should mention its getStringI :p i changed getString
 
Last edited:
Newbie Spellweaver
Joined
Apr 3, 2008
Messages
17
Reaction score
0
Sooo.....
im getting an error >__< like always XD
anyways;

Code:
1>------ Build started: Project: MapleStoryServer, Configuration: Release Win32 ------
1>Compiling...
1>Players.cpp
1>.\Players.cpp(282) : error C2653: 'MySQL' : is not a class or namespace name
1>.\Players.cpp(282) : error C3861: 'getStringI': identifier not found
1>Build log was saved at "file://c:\Users\Vi3tSheezy\Desktop\krytical\MapleStoryServer\Release\BuildLog.htm"
1>MapleStoryServer - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========

the lines:

Code:
		char mapname[60];
								MySQL::getStringI("maps", "id", mapid, "name", mapname);							
								char text[100];
 
Infraction Baɴɴed
Loyal Member
Joined
Apr 9, 2008
Messages
1,416
Reaction score
169
Nub stop Ducking bumping old butt threads
 
Status
Not open for further replies.
Back
Top