• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[7.4] Avesta

In ioplayer.cpp:

After this function
Code:
void IOPlayer::loadItems(ItemMap& itemMap, DBResult* result)

Add this:
Code:
void IOPlayer::updateLoginInfo(Player* player)
{
	Database* db = Database::instance();
	DBQuery query;

	query << "UPDATE `players` SET `status` = 1"
			<< " WHERE `id` = " << player->getGUID();

	db->executeQuery(query.str());
}

void IOPlayer::updateLogoutInfo(Player* player)
{
	Database* db = Database::instance();
	DBQuery query;

	query << "UPDATE `players` SET `status` = 0"
			<< " WHERE `id` = " << player->getGUID();

	db->executeQuery(query.str());
}

bool IOPlayer::cleanOnlineInfo()
{
	Database* db = Database::instance();
	DBQuery query;
	return db->executeQuery("UPDATE `players` SET `status` = 0");
}

In ioplayer.h

After this:
Code:
uint32_t getAccessByName(std::string name);

Add this:

Code:
void updateLoginInfo(Player* player);
void updateLogoutInfo(Player* player);
bool cleanOnlineInfo();

------------------------------------------------------------------

Now in protocolgame.cpp

In function:
Code:
bool ProtocolGame::login(const std::string& name)

After this:
Code:
player->lastLoginSaved = std::max(time(NULL), player->lastLoginSaved + 1);

Add this:
Code:
IOPlayer::instance()->updateLoginInfo(player);

Now in function
Code:
bool ProtocolGame::connect(uint32_t playerId)

After this:
Code:
player->lastip = player->getIP();

Add this:
Code:
IOPlayer::instance()->updateLoginInfo(player);

------------------------------------------------------------------

Now in player.cpp

In function void Player::eek:nCreatureDisappear(const Creature* creature, uint32_t stackpos, bool isLogout)

After this:
Code:
g_chat.removeUserFromAllChannels(this);

Add this:
Code:
IOPlayer::instance()->updateLogoutInfo(this);

------------------------------------------------------------------

Now in otserv.cpp

After this:
Code:
#include "status.h"

Add this:
Code:
#include "ioplayer.h"

Now search for that line:
Code:
std::cout << ":: Worldtype: " << asUpperCaseString(worldType) << std::endl;

And after that line, add this:
Code:
std::cout << ":: Cleaning online players info... " << std::flush;
if(!IOPlayer::instance()->cleanOnlineInfo()){
std::stringstream errormsg;
errormsg << "Unable to execute query for cleaning online status!";
ErrorMessage(errormsg.str().c_str());
exit(-1);
}
std::cout << "[done]" << std::endl;

/\
/\
/\

This will set all players status to 0 = player offline in website

Hope you enjoyed!

- - - Updated - - -

But if you want it in LUA, you'll need that function:
http://otland.net/f35/mysqlquery-otserv-57412/

In login.lua, add this:
Lua:
mysqlQuery("UPDATE `players` SET `status` = '1' WHERE `name` = \"" .. getPlayerName(cid) .. "\"", "SET")

In logout.lua or die.lua
Lua:
mysqlQuery("UPDATE `players` SET `status` = '0' WHERE `name` = \"" .. getPlayerName(cid) .. "\"", "SET")

That is a lot of editing for such small matter
 
Just completed the source editing that you posted, works flawlessly! A thousand times thanks. As I said, I rep++ you for it. Godly support! Thanks ^^
 
@ond

Tell why ??

Here's just a proof ...
View attachment 19468

Because you do not program anything yourself, you just edit small values and then copy code from other branches and call it "my own server/code ;]". Sure you could release a server code filled with features, but don't forget to give ALL the credit for the actual codes to its makers as you never do.
 
Guys i got a problem while compiling it. im using TFS DevCpp, but it seems i need some files:
PHP:
Kompilator: Default compiler
Building Makefile: "C:\Documents and Settings\Administrator\Pulpit\Avesta\Dev-Cpp\test\Makefile.win"
Wykonywanie  make...
make.exe -f "C:\Documents and Settings\Administrator\Pulpit\Avesta\Dev-Cpp\test\Makefile.win" all
g++.exe -c src/actions.cpp -o src/actions.o -I"include"  -DSVN  -D__USE_MYSQL__  -D_THREAD_SAFE  -D_REENTRANT  

In file included from src/definitions.h:68,
                 from src/otpch.h:9,
                 from src/actions.cpp:20:
src/compiler/gcc.h:81:27: warning: no newline at end of file
In file included from src/definitions.h:82,
                 from src/otpch.h:9,
                 from src/actions.cpp:20:
src/compiler/workarounds.h:78:35: warning: no newline at end of file

In file included from src/player.h:25,
                 from src/actions.cpp:23:
src/otsystem.h:60:24: sys/socket.h: No such file or directory
src/otsystem.h:61:24: netinet/in.h: No such file or directory
src/otsystem.h:62:23: arpa/inet.h: No such file or directory
src/otsystem.h:63:19: netdb.h: No such file or directory

make.exe: *** [src/actions.o] Error 1

Wykonanie zakończone

What does it mean theres no such file or directory? i must download it from somewhere or what?
 
Guys i got a problem while compiling it. im using TFS DevCpp, but it seems i need some files:
PHP:
Kompilator: Default compiler
Building Makefile: "C:\Documents and Settings\Administrator\Pulpit\Avesta\Dev-Cpp\test\Makefile.win"
Wykonywanie  make...
make.exe -f "C:\Documents and Settings\Administrator\Pulpit\Avesta\Dev-Cpp\test\Makefile.win" all
g++.exe -c src/actions.cpp -o src/actions.o -I"include"  -DSVN  -D__USE_MYSQL__  -D_THREAD_SAFE  -D_REENTRANT  

In file included from src/definitions.h:68,
                 from src/otpch.h:9,
                 from src/actions.cpp:20:
src/compiler/gcc.h:81:27: warning: no newline at end of file
In file included from src/definitions.h:82,
                 from src/otpch.h:9,
                 from src/actions.cpp:20:
src/compiler/workarounds.h:78:35: warning: no newline at end of file

In file included from src/player.h:25,
                 from src/actions.cpp:23:
src/otsystem.h:60:24: sys/socket.h: No such file or directory
src/otsystem.h:61:24: netinet/in.h: No such file or directory
src/otsystem.h:62:23: arpa/inet.h: No such file or directory
src/otsystem.h:63:19: netdb.h: No such file or directory

make.exe: *** [src/actions.o] Error 1

Wykonanie zakończone

What does it mean theres no such file or directory? i must download it from somewhere or what?

Where's 'no new line..' just open this file and add a new line (by enter).

And try to define in project:
-D__WINDOWS__
 
Not hard to see.... But how can i get these files? Please enlighten me. some libraries?

- - - Updated - - -

Gosh i cant edit posts.
Anyway, Jakkes thx, i added -D__WINDOWS__ and it moved. now i have some problems with libraries:
PHP:
Kompilator: Default compiler
Building Makefile: "C:\Documents and Settings\Administrator\Pulpit\Avesta\Dev-Cpp\test\Makefile.win"
Wykonywanie  make clean
rm -f src/account.o src/actions.o src/allocator.o src/ban.o src/baseevents.o src/beds.o src/chat.o src/combat.o src/commands.o src/condition.o src/configmanager.o src/connection.o src/container.o src/creature.o src/creatureevent.o src/cylinder.o src/database.o src/databasemysql.o src/databasesqlite.o src/depot.o src/exception.o src/fileloader.o src/game.o src/globalevent.o src/house.o src/housetile.o src/ioaccount.o src/iomapotbm.o src/iomapserialize.o src/iomapxml.o src/ioplayer.o src/item.o src/items.o src/logger.o src/luascript.o src/mailbox.o src/map.o src/md5.o src/monster.o src/monsters.o src/movement.o src/networkmessage.o src/npc.o src/otpch.o src/otserv.o src/outfit.o src/outputmessage.o src/party.o src/player.o src/position.o src/protocol.o src/protocolgame.o src/protocollogin.o src/raids.o src/rsa.o src/scheduler.o src/scriptmanager.o src/server.o src/sha1.o src/spawn.o src/spells.o src/status.o src/talkaction.o src/tasks.o src/teleport.o src/thing.o src/tile.o src/tools.o src/trashholder.o src/vocation.o src/waitlist.o src/weapons.o  Projekt1.exe

g++.exe -c src/account.cpp -o src/account.o -I"include"  -DSVN  -D__USE_MYSQL__  -D_THREAD_SAFE  -D_REENTRANT -D__WINDOWS__  

In file included from src/definitions.h:68,
                 from src/otpch.h:9,
                 from src/account.cpp:21:
src/compiler/gcc.h:81:27: warning: no newline at end of file
In file included from src/definitions.h:82,
                 from src/otpch.h:9,
                 from src/account.cpp:21:
src/compiler/workarounds.h:78:35: warning: no newline at end of file

g++.exe -c src/actions.cpp -o src/actions.o -I"include"  -DSVN  -D__USE_MYSQL__  -D_THREAD_SAFE  -D_REENTRANT -D__WINDOWS__  

In file included from src/definitions.h:68,
                 from src/otpch.h:9,
                 from src/actions.cpp:20:
src/compiler/gcc.h:81:27: warning: no newline at end of file
In file included from src/definitions.h:82,
                 from src/otpch.h:9,
                 from src/actions.cpp:20:
src/compiler/workarounds.h:78:35: warning: no newline at end of file

g++.exe -c src/allocator.cpp -o src/allocator.o -I"include"  -DSVN  -D__USE_MYSQL__  -D_THREAD_SAFE  -D_REENTRANT -D__WINDOWS__  

In file included from src/definitions.h:68,
                 from src/otpch.h:9,
                 from src/allocator.cpp:20:

src/compiler/gcc.h:81:27: warning: no newline at end of file
In file included from src/definitions.h:82,
                 from src/otpch.h:9,
                 from src/allocator.cpp:20:
src/compiler/workarounds.h:78:35: warning: no newline at end of file

g++.exe -c src/ban.cpp -o src/ban.o -I"include"  -DSVN  -D__USE_MYSQL__  -D_THREAD_SAFE  -D_REENTRANT -D__WINDOWS__  

In file included from src/definitions.h:68,
                 from src/otpch.h:9,
                 from src/ban.cpp:21:
src/compiler/gcc.h:81:27: warning: no newline at end of file
In file included from src/definitions.h:82,
                 from src/otpch.h:9,
                 from src/ban.cpp:21:
src/compiler/workarounds.h:78:35: warning: no newline at end of file

g++.exe -c src/baseevents.cpp -o src/baseevents.o -I"include"  -DSVN  -D__USE_MYSQL__  -D_THREAD_SAFE  -D_REENTRANT -D__WINDOWS__  

In file included from src/definitions.h:68,
                 from src/otpch.h:9,
                 from src/baseevents.cpp:20:
src/compiler/gcc.h:81:27: warning: no newline at end of file
In file included from src/definitions.h:82,
                 from src/otpch.h:9,
                 from src/baseevents.cpp:20:

src/compiler/workarounds.h:78:35: warning: no newline at end of file
In file included from C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/mysql/mysql.h:72,
                 from src/databasemysql.h:33,
                 from src/database.h:311,
                 from src/luascript.h:26,

                 from src/baseevents.h:26,
                 from src/baseevents.cpp:26:
C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/mysql/mysql_com.h:183: error: `SOCKET' does not name a type
C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/mysql/mysql_com.h:358: error: `SOCKET' was not declared in this scope
C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/mysql/mysql_com.h:358: error: expected primary-expression before "const"
C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/mysql/mysql_com.h:358: error: expected primary-expression before "unsigned"
C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/mysql/mysql_com.h:359: error: expected primary-expression before "unsigned"
C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/mysql/mysql_com.h:359: error: initializer expression list treated as compound expression

make.exe: *** [src/baseevents.o] Error 1

Wykonanie zakończone
 
I would if i could.... I cant install Visual C+ 2010 express, because while installation is preparing error appears. its saying that Visual C++ needs Windows Installer 4.5 and my computer has ver3.1... but i upgraded it, even if i execute command msiexec in start>run it shows that my Windows Installer is:V 4.5.6001.22159

- - - Updated - - -

Anyway i cant install visual c++ because it keeps saying i must upgrade Windows Installer....
 
Yup, its 100 legit. I know its weird, i cand find fix anywhere.
 
Because you do not program anything yourself, you just edit small values and then copy code from other branches and call it "my own server/code ;]". Sure you could release a server code filled with features, but don't forget to give ALL the credit for the actual codes to its makers as you never do.

It's kinda funny you're sayin' somethin' like that!
How can you say things that you don't know ?
Are you saw my source code or what ?
What's your prooves ?

In internet, everybody is STRONG!
 
It's kinda funny you're sayin' somethin' like that!
How can you say things that you don't know ?
Are you saw my source code or what ?
What's your prooves ?

In internet, everybody is STRONG!

Matter of fact is that, yes, I have seen "your" code. For instance, "your" server save system was ripped from TFS 0.2 - fun thing is that you know it's true, yet you're denying it.

In internet, everybody is STRONG!

And some are stealing work others have done and claiming credits for it
 
@ond

Ripped from TFS 0.2 ??
No, you're totally wrong!

Stealing work from who ???

A long time ago, Ferrus released the Avesta (as I remember, it was 8.0) converted to 7.6, based in OTServ_SVN 0.6.3 in OTFans, right ?
But it was full of bugs...
What I decided to do was, get a clean OTServ_SVN 0.6.3, and converting to 7.6 too, but with MY fixes!

- - - Updated - - -

Let's stop there, that discussion is useless ;]

- - - Updated - - -

Oooohh... it's Let's stop here and not there like I said!
Can't edit my posts
 
Back
Top