- Joined
- Apr 22, 2007
- Messages
- 123
- Reaction score
- 0
It crashes the server at the interval time u set it at. And it doesnt save >.>
I like the !save command better
I like the !save command better
tyvm for this i know i folo the tut perfectly i guess i had a missing includehere is the whole script for those that can't get theirs to work:
MapleStoryServer.cpp
#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 <process.h>
#include <windows.h>
#include <stdio.h>
#include "PlayersPacket.h"
#include "Players.h"
void autoSave( void * );
void main(){
Initializing::initializing();
printf("Initializing Timers... ");
Timer::timer = new Timer();
Skills::startTimer();
Maps::startTimer();
printf("DONE\n");
printf("Initializing MySQL... ");
if(MySQL::connectToMySQL())
printf("DONE\n");
else{
printf("FAILED\n");
exit(1);
}
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());
}
int saveInterval = 150; // 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 successfully", 5);
printf("All progress saved by autosave\n");
Sleep(((INT_PTR)arg)*1000);
}
}
Doesn't work. If you want to put errors on your server, use this!