[Release] auto save function [FIXED!] Fix 

Status
Not open for further replies.
oh geez dont give me all this noob talk please. it does work =.= just cos it doesnt for you doesnt mean it doesnt for others.
 
oh i got this code working and did some crazy mods with too, if 2 ppl save at once itll overflow the server and crash it with that 242 crash thats what that error is. its based off saving to mysql. the code for the sql saving is BAD. teh whole thing has to be remade, the sql part.

so dont even call me the noob i can dance circles around u
 
oh geez dont give me all this noob talk please. it does work =.= just cos it doesnt for you doesnt mean it doesnt for others.

2azn4u,
Please ignore them, you're doing a great job <3
 
pm me with your player.h player.cpp and maplestoryserver.cpp file

and i suggest if you're hosting, you have a duo core processor otherwise you'll crash frequently
 
I copied and pasted your maplestoryserver.cpp and I still crash everytime I relog in after gaining some exp or level. Is that the code's problem or the database problem?
 
which rev files are you using?

I never understood what a rev file is, is it the same as the source code?

well I'm using Kryptical's v9 source code.

and this is my database code.

create table users(ID int auto_increment primary key, username varchar(20), password varchar(20), pin int default 0, gender int default 0, gm int default 0);

create table characters(ID int auto_increment primary key, name varchar(12), userid int, level tinyint unsigned default 1, job smallint default 0, str smallint, dex smallint, intt smallint, luk smallint, chp smallint default 50, mhp smallint default 50, cmp smallint default 50, mmp smallint default 50, ap smallint default 0, sp smallint default 0, exp int default 0, fame smallint default 80, map int default 0, pos smallint default 0, gender tinyint, skin tinyint, eyes int, hair int, mesos int default 0);

create table equip(equipid int, type tinyint, charid int, pos smallint default 0, slots tinyint default 7, scrolls smallint default 0, istr smallint default 0, idex smallint default 0, iint smallint default 0, iluk smallint default 0, ihp smallint default 0, imp smallint default 0, iwatk smallint default 0, imatk smallint default 0, iwdef smallint default 0, imdef smallint default 0, iacc smallint default 0, iavo smallint default 0, ihand smallint default 0, ispeed smallint default 0, ijump smallint default 0);

create table items(itemid int, charid int, inv tinyint, pos smallint, amount smallint);

create table keymap(charid int, pos0 int default 0, pos1 int default 0, pos2 int default 2564, pos3 int default 3076, pos4 int default 3332, pos5 int default 4612, pos6 int default 5380, pos7 int default 0, pos8 int default 0, pos9 int default 0, pos10 int default 0, pos11 int default 0, pos12 int default 0, pos13 int default 0, pos14 int default 0, pos15 int default 0, pos16 int default 2052, pos17 int default 1284, pos18 int default 4, pos19 int default 1028, pos20 int default 0, pos21 int default 0, pos22 int default 0, pos23 int default 260, pos24 int default 0, pos25 int default 4868, pos26 int default 3588, pos27 int default 3844, pos28 int default 0, pos29 int default 13317, pos30 int default 0, pos31 int default 516, pos32 int default 0, pos33 int default 0, pos34 int default 3456, pos35 int default 2820, pos36 int default 0, pos37 int default 772, pos38 int default 0, pos39 int default 5124, pos40 int default 4100, pos41 int default 0, pos42 int default 0, pos43 int default 2308, pos44 int default 12805, pos45 int default 13061, pos46 int default 1540, pos47 int default 0, pos48 int default 0, pos49 int default 0, pos50 int default 1796, pos51 int default 0, pos52 int default 0, pos53 int default 0, pos54 int default 0, pos55 int default 0, pos56 int default 13573, pos57 int default 0, pos58 int default 0, pos59 int default 25606, pos60 int default 25862, pos61 int default 26118, pos62 int default 26374, pos63 int default 26630, pos64 int default 26886, pos65 int default 27142, pos66 int default 0, pos67 int default 0, pos68 int default 0, pos69 int default 0, pos70 int default 0, pos71 int default 0, pos72 int default 0, pos73 int default 0, pos74 int default 0, pos75 int default 0, pos76 int default 0, pos77 int default 0, pos78 int default 0, pos79 int default 0, pos80 int default 0, pos81 int default 0, pos82 int default 0, pos83 int default 0, pos84 int default 0, pos85 int default 0, pos86 int default 0, pos87 int default 0, pos88 int default 0, pos89 int default 0);

create table skills(charid int, skillid int, points int);

alter table characters change exp exp int default 0;

ALTER TABLE `characters` ADD `online` INT( 1 ) NOT NULL DEFAULT '0';

ALTER TABLE characters ADD origin INT DEFAULT 0 AFTER map;

ALTER TABLE `users` ADD `ban_expire` DATETIME NOT NULL DEFAULT 0, ADD `ban_reason` TINYINT( 2 ) UNSIGNED NOT NULL DEFAULT '0';

ALTER TABLE users ADD banned INT DEFAULT 0;

alter table characters add gotpack int default 0;

CREATE TABLE `pqkerning` (
`id` int(1) NOT NULL,
`aplayers` int(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `pqkerning` VALUES ('0', '0');
INSERT INTO `pqkerning` VALUES ('1', '0');

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;

ALTER TABLE `characters` ADD `Fm` INT( 1 ) NOT NULL DEFAULT '0';

CREATE TABLE `famedata` (
`id` int(1) NOT NULL,
`userid` int(1) NOT NULL default '0',
PRIMARY KEY (`ID` , `userid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `famedata` VALUES ('0', '0');
INSERT INTO `famedata` VALUES ('1', '0');

DROP TABLE IF EXISTS `events`;
CREATE TABLE `events` (
`type` int(1) NOT NULL,
`ID` int(1) NOT NULL,
`start` int(1) NOT NULL,
`town` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `events` VALUES ('0', '1', '0', '0');

ALTER TABLE characters CHANGE level level int not null;
 
Can someone post a MaplestoryServer.ccp that has a auto save for me pls? ( Kryt 9 )
 
Do you need autosave.ccp for it? and autosave.h?
 
i don't think it works, i've followed all the instructions carefully

Code:
#include "../Connection/Acceptor.h"
#include "PlayerLogin.h"
#include "Player.h"
#include "MySQLM.h"
#include <stdlib.h>
#include "Initializing.h"
#include "Timer.h"
#include "Skills.h"
#include "Maps.h"
#include "Server.h"
#include "ShipEvent.h"
#include <time.h>
#include "PlayersPacket.h"
#include <iostream>  
#include <process.h>
#include <windows.h>
#include <stdio.h>
#include "Players.h"

void autoSave( void * );
void main(){

	Initializing::initializing();
	printf("Timers    :: ");
	Timer::timer = new Timer();
	Skills::startTimer();
	Maps::startTimer();
	printf("Success\n");
	printf("Database  :: ");
	if(MySQL::connectToMySQL())
		printf("Complete!\n");
	else{
		printf("Failed Start up\n");
		exit(1);
	}
	MySQL::setOffline();
	Server::initialize();
	WSADATA wsaData;
	int iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
	if (iResult != NO_ERROR)  printf("Error at WSAStartup()\n");

	srand((unsigned char)time(0));

	Selector* selector = new Selector();
	Acceptor::Acceptor(8484, selector, new PlayerLoginFactory());
	for(int i=0; i<5; i++){
		Acceptor::Acceptor(8888+i, selector, new PlayerFactory());
	}
char* next_token;
char ain[90] = "";
do {
cin.getline(ain, 90);
strcpy_s(ain, 90, strtok_s(ain, "", &next_token));
strcat_s(ain, next_token);
PlayersPacket::showMassage(ain, 0);
printf("Console: %s\n", ain);
}
while(ain != "");

	int saveInterval = 20; // save interval in seconds
	_beginthread( autoSave, 0, (void*)saveInterval);
	while(getchar()){}
}
void autoSave( void *arg ) {
	while(true) {
		for (hash_map <int, Player*>::iterator iter = Players::players.begin(); iter != Players::players.end(); iter++)
        iter->second->save();
        PlayersPacket::showMassage("All progress has been saved!", 5);
		printf("All progress has been sabed!\n");
		Sleep(((INT_PTR)arg)*1000);
	}
}
 
Last edited:
What's your source?
(The guy who wrote the script azn xD)
And rev, because it goes by rev and source more then anything.

For some people they can be using a old one, causing all those errors,
while others can be using a newer/different one causing thecrashes,
while somone could be using the same as you.

As for me the source im using witht his script is krytical 11.3
 
Do you guys get character rollbacks using this? My character's items/equips gets wiped when it crashes sometimes amd also to my players.
 
Ok so I installed it all correctly, and the Autosave DOES work.

BUT!

When others log in it crashes the server. I get an error in the black debugging box, and in my C++ is says that whole "Break or Continue" thing in MySQL.cpp.
 
Last edited:
Status
Not open for further replies.
Back