• 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!

[Gesior acc. maker][TFS 0.3]Powergamers and online time stats

Gesior.pl

Mega Noob&LOL 2012
Senator
Joined
Sep 18, 2007
Messages
2,967
Solutions
99
Reaction score
3,383
Location
Poland
GitHub
gesior
EDIT:
It work with TFS 0.2.13, but you must use version compiled with parameter -D__GLOBAL_STORAGE__
You can find TFS 0.2.13 for Tibia 8.21 compiled with this parameter in my thread in "Downloads" on forum.
If you use TFS 0.2.13 replace function "historyPage" from this thread with:
PHP:
function historyPage(parameters)
	dofile("./config.lua")
	env = assert(luasql.mysql())
	con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
    local historyPage = addEvent(historyPage, 60000, {})
    if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
        setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
        assert(con:execute("UPDATE `players` SET `onlinetime7`=players.onlinetime6, `onlinetime6`=players.onlinetime5, `onlinetime5`=players.onlinetime4, `onlinetime4`=players.onlinetime3, `onlinetime3`=players.onlinetime2, `onlinetime2`=players.onlinetime1, `onlinetime1`=players.onlinetimetoday, `onlinetimetoday`=0;"))
        assert(con:execute("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;"))
    end
    assert(con:execute("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;"))
con:close()
env:close()
end
If you don't know how to install it.. DON'T ASK ME! It's script for OTSes with admins who know anything about PHP and LUA!
------------------------------------------------
You must:
- use Gesior acc. maker
- use MySQL database
- use TFS 0.3 pre-alpha in version (rev.) 900 or higher EDIT: or 0.2.13 compiled with parameter "-D__GLOBAL_STORAGE__"
1. I made this script for my OTS. How it look?
http://debestia.hopto.org/index.php?subtopic=characters&name=Maxi+Rodriguez (players graphic statistics, colors and layout configurable)
http://debestia.hopto.org/index.php?subtopic=exphist (powergamers)
http://debestia.hopto.org/index.php?subtopic=onlinetime (no lifers - max. online time)
2. How to install?
1. In MySQL execute (phpmyadmin -> 'SQL'):
PHP:
ALTER TABLE `players` ADD `exphist_lastexp` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist1` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist2` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist3` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist4` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist5` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist6` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist7` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetimetoday` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime1` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime2` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime3` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime4` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime5` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime6` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime7` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetimeall` BIGINT( 255 ) NOT NULL DEFAULT '0';
and:
PHP:
UPDATE `players` SET `exphist_lastexp`=`players`.`experience`
2. If you use unmodifed login.lua file..
open TFS file .../data/creaturescripts/scripts/login.lua
delete all from this file and put:
PHP:
function onLogin(cid)
	if(InitHistory == 0) then
		local historyPage = addEvent(historyPage, 60000, {})
		InitHistory = historyPage
	end
	registerCreatureEvent(cid, "PlayerDeath")
	return TRUE
end

function historyPage(parameters)
	local historyPage = addEvent(historyPage, 60000, {})
	if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
		setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
		db.executeQuery("UPDATE `players` SET `onlinetime7`=players.onlinetime6, `onlinetime6`=players.onlinetime5, `onlinetime5`=players.onlinetime4, `onlinetime4`=players.onlinetime3, `onlinetime3`=players.onlinetime2, `onlinetime2`=players.onlinetime1, `onlinetime1`=players.onlinetimetoday, `onlinetimetoday`=0;")
		db.executeQuery("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;")
	end
	db.executeQuery("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;")
end
Open file:
.../data/global.lua
and add this line:
PHP:
InitHistory = 0
It will save exp of all players (every 24 hours) and online time (every minute and every 24 hours) in database.
3. In folder with acc. maker unpack file:
http://debestia.hopto.org/files/pro-stats.zip
4. Now you must only add buttons with links to new pages:
exphist - exphist.php
onlinetime - onlinetime.php
How to add new links in tibia.com layout?
http://otland.net/showpost.php?p=91979&postcount=541
Layout of graphic statistics is generated by charinfo.php(data + colors/effects) and charts.php (background color)
Other graphic layouts you can find:
http://www.maani.us/charts/index.php?menu=Gallery
 
Last edited:
OMG :X Very good script Gesior :D
Very usefull ^^, but if i like this system and shop script? can you make the login.lua plz ;D
 
If you dont like colors you dont know whats good dudes ;) thats 3 colors mean many things! ;]

I already use that script.
 
OMG :X Very good script Gesior :D
Very usefull ^^, but if i like this system and shop script? can you make the login.lua plz ;D
If you use login.lua with my shop script..
In place of:
PHP:
	if(InitShopComunication == 0) then
		local eventServ = addEvent(sql_communication, SQL_COMUNICATION_INTERVAL, {})
		InitShopComunication = eventServ
	end
Put:
PHP:
	if(InitShopComunication == 0) then
		local eventServ = addEvent(sql_communication, SQL_COMUNICATION_INTERVAL, {})
		local historyPage = addEvent(historyPage, 60000, {})
		InitShopComunication = eventServ
	end
And before:
PHP:
function sql_communication(parameters)
	dofile("./config.lua")
...
Add:
PHP:
function historyPage(parameters)
    local historyPage = addEvent(historyPage, 60000, {})
    if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
        setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
        db.executeQuery("UPDATE `players` SET `onlinetime7`=players.onlinetime6, `onlinetime6`=players.onlinetime5, `onlinetime5`=players.onlinetime4, `onlinetime4`=players.onlinetime3, `onlinetime3`=players.onlinetime2, `onlinetime2`=players.onlinetime1, `onlinetime1`=players.onlinetimetoday, `onlinetimetoday`=0;")
        db.executeQuery("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;")
    end
    db.executeQuery("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;")
end
@Yokozuna
You can't. You must actualize your server.
 
Scripts and functions are really great, Respect.

But i dont really like the layout :p
Is it then possible to change the layout somehow?
 
Tachi;94618[URL="http://xlash.no-ip.info/aac/index.php?subtopic=characters&name=Energex" said:
Xlash AAC Character powergame sript of Energex[/URL]
4. Now you must only add buttons with links to new pages:
exphist - exphist.php
onlinetime - onlinetime.php
How to add new links in tibia.com layout?
http://otland.net/showpost.php?p=91979&postcount=541
:)
 
i get a few errors when i try to open the exphist.php.. and the other one too..


Exphist.php
Code:
Fatal error: Call to a member function query() on a non-object in D:\xampp\htdocs\aac\exphist.php on line 21

Line 21 of Exphist.php
Code:
	$players = $SQL->query(' SELECT * FROM players ORDER BY `players`.`experience`-`players`.`exphist_lastexp` DESC LIMIT '.$limit)->fetchAll();

and Onlinetime.php
Code:
Fatal error: Call to a member function query() on a non-object in D:\xampp\htdocs\aac\onlinetime.php on line 20

Line 20 of onlinetime.php
Code:
	$players = $SQL->query(' SELECT * FROM players ORDER BY `onlinetimetoday` DESC LIMIT '.$limit)->fetchAll();

And i duno whats wrong.. is there something that my database dont like... because it doesnt look like theres anything to configure in it....


Any idea's? or did i not config something else right?

I folowed (copy and paste) the tutorial...
 
i think you havent tables


PHP:
ALTER TABLE `players` ADD `exphist_lastexp` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist1` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist2` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist3` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist4` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist5` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist6` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `exphist7` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetimetoday` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime1` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime2` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime3` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime4` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime5` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime6` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetime7` BIGINT( 255 ) NOT NULL DEFAULT '0',
ADD `onlinetimeall` BIGINT( 255 ) NOT NULL DEFAULT '0';


PHP:
UPDATE `players` SET `exphist_lastexp`=`players`.`experience`
 
Gesior this feature working on tfs 0.2.13 and your beautyfull account maker 0.3??:>
 
like i said i imported the sql queries... so i have them......

Cause i followed the tutorial exactly


Any other ideas?
 
Hi, Gesior i have a little question. I made my own template for your ACC. Can you tell me how to put login inputs to account management on your acc?

Sorry for my english. I think you now what i mean.

//chciałbym po prostu aby w menu znajdowały się pola input do logowania.

Greetings!
 
like i said i imported the sql queries... so i have them......
Cause i followed the tutorial exactly
Any other ideas?
You must have my acc. maker and after install open:
http://127.0.0.1/index.php?subtopic=exphist
NOT:
http://127.0.0.1/exphist.php
Hi, Gesior i have a little question. I made my own template for your ACC. Can you tell me how to put login inputs to account management on your acc?
Sorry for my english. I think you now what i mean.
//chciałbym po prostu aby w menu znajdowały się pola input do logowania.
Greetings!
PHP:
<form action="?subtopic=accountmanagement" method="post" >
<br />
Numer konta: <input type="password" name="account_login" SIZE="10" maxlength="10" >
<br />
Haslo: <input type="password" name="password_login" size="30" maxlength="29" ></form>
 
Thanks Gesior. Now it looks better. www.waldoria.com

Hmm but how to make it invisible for already loged user ?

PHP:
<?PHP
if(!$logged)
{
echo '<form action="?subtopic=accountmanagement" method="post" >
<br />
Numer konta: <input type="password" name="account_login" SIZE="10" maxlength="10" >
<br />
Haslo: <input type="password" name="password_login" size="30" maxlength="29" ></form>'; 
}
else
{
echo 'komunikat dla zalogowanych lub puste miejsce';
}
?>
 
Back
Top