• 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

How to install it on 0.3 then? There is no global.lua ;o (latest version)
 
Last edited:

I heard you have to put these things to constant.lua instead of global.lua ;p but that's not what Gesior said, so I will w8 for him, because he said somewhere that he is going to release it for 0.3 "soon". :D
 
Version for TFS 0.3
In data/globalevents/globalevents.xml add new event:
PHP:
<globalevent name="history" interval="60" script="history.lua"/>
In data/globalevents/history.lua paste:
PHP:
function onThink(interval, lastExecution)
    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;")
	return TRUE
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 UNNAMED acc. maker
- use MySQL database
- use TFS 0.3 or 0.2
1. I made this script for my OTS. How it look?
Debestia 1 - Characters (players graphic statistics, colors and layout configurable)
Debestia 1 - Najszybciej Expiacy (powergamers)
Debestia 1 - Najwiecej Grajacy (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`
IF YOU USE TFS 0.2
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)
	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
Open file:
.../data/global.lua
and add this line:
PHP:
InitHistory = 0
IF YOU USE TFS 0.3
2. In data/globalevents/globalevents.xml add new event:
PHP:
<globalevent name="history" interval="60" script="history.lua"/>
In data/globalevents/history.lua paste:
PHP:
function onThink(interval, lastExecution)
    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;")
	return TRUE
end
------------- REST SAME FOR 0.3 AND 0.2 ------------
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?
OtLand - View Single Post - Gesior acc. maker for TFS
Layout of graphic statistics is generated by charinfo.php(data + colors/effects) and charts.php (background color)
Other graphic layouts you can find:
PHP/SWF Charts > Introduction
 
Back
Top