ScorpiOOn93
etherno.net
eh It's not working on Linux, what can I do ? :>
Last edited:
dofile(getDataDir() .. 'lib/disabled/index.lua')
--[[
Open Tibia Advanced Lib (Otal)
Made by: Mock
Tested in: TFS 0.3.(5,4,3,2,1)
Tested in: Open tibia SVN
All this functions was made by:
Mock, skyen hasus, nord, magus, dark billie,
colandus and shawak. And libs like luasocket
etc was made by other group of peoples.
Please report bugs on: http://otal.awardspace.info/
Contact: [email protected]
]]
--- Open config and set config vars at global vars.
dofile("config.lua")
---- Lib info table, please do not change it.
_LIBINFO = {
_VERSION = "1.0",
_NAME = "Open Tibia Advanced Lib (OTAL)",
_AUTHOR = "Mock",
_UPDATECHECK = "http://otal.awardspace.info/",
['mysql'] = {
vip="ALTER TABLE `accounts` ADD `vip_time` INT(15) NOT NULL",
storage="CREATE TABLE IF NOT EXISTS `"..(sqlDatabase or "").."`.`account_storage` (`id` INT( 11 ) NOT NULL ,`value` VARCHAR( 10 ) NOT NULL ,INDEX ( `id` ))",
},
['sqlite'] = {
vip = "ALTER TABLE `accounts` ADD `vip_time` INTEGER",
storage="CREATE TABLE IF NOT EXISTS `account_storage` (id INTEGER, value VARCHAR )",
},
}
--- Open constants and config
dofile(getDataDir() .. 'lib/disabled/constants_vars_and_config.lua')
--- check if this lib is already loaded
if _LIBINFO.LOADED == nil then
io.write(" Starting V".._LIBINFO._VERSION)
io.write(' Loading libs.')
--- Open all lua files
for i,b in pairs(_LIBINFO._LUAFILES) do
dofile(getDataDir() .. 'lib/disabled/'..b)
io.write('.')
end
--- Set path dir
package.path = package.path..";"..getDataDir().."/lib/disabled/lua/?.lua"
package.cpath = package.cpath..";"..getDataDir().."/lib/disabled/?.dll"
--- Open all libs
for i,b in pairs(_LIBINFO._LIBS) do
require(b)
io.write('.')
end
io.write('.')
--- Check if is nescessary instal lib.
local f_ = io.open('OTAL-REINSTALL','r')
if f_ then
f_:close()
f_ = nil
--- Check for updates
dofile('OTAL-REINSTALL')
if tonumber(da___)+_LIBINFO._UPDATEINTERVALDAYS <= tonumber(os.date("%d")) then
print('::Looking for updates!')
b, c, h = socket.http.request(_LIBINFO._UPDATECHECK.."ver.php")
if b and tonumber(b) then
if b > _LIBINFO._VERSION then
print("\n::\a[[--Please enter on ".._LIBINFO._UPDATECHECK.." and download new version "..b.."--]]")
io.write('.')
else
print("\n::\a[[Your lib is updated]]")
io.write('.')
end
else
print('::\a[[Cannot check]]')
io.write('.')
end
local f_ = io.open('OTAL-REINSTALL','w')
f_:write("ver___='".._LIBINFO._VERSION.."'\n da___='"..os.date("%d").."'")
f_:close()
end
else
io.write('.[Done]\n')
--- Start install.
printT("::Installing.",1)
local time = os.clock()
io.write('Please wait.')
io.write('.')
--- Instal dirs
local ff__ = io.open('data\\storage\\info.lua','r')
if ff__ == nil then
os.execute('md data\\storage')
io.open('data\\storage\\info.lua','w'):close()
else
ff__:close()
end
io.write('.')
if _LIBINFO[sqlType] == nil then
io.write('Please wait. FATAL ERROR! sqlType='..sqlType..' can be only: \'sqlite\' or \'mysql\'!')
os.sleep(10)
os.exit()
end
--- Install tables
if sqlType == "mysql" then
env = assert(luasql.mysql())
con = assert(env:connect(sql_db or sqlDatabase, sql_user or sqlUser, sql_pass or sqlPass, sql_host or sqlHost, sql_port or sqlPort))
else -- sqlite
env = assert(luasql.sqlite3())
con = assert(env:connect(sql_db or sqliteDatabase or sqlFile))
end
cur = con:execute(_LIBINFO[sqlType].vip)
io.write('.')
if(type(cur) ~= 'number') and cur ~= nil then
cur:close()
end
cur = con:execute(_LIBINFO[sqlType].storage)
io.write('.')
if(type(cur) ~= 'number') and cur ~= nil then
cur:close()
end
con:close()
env:close()
io.write('.')
local file_ = io.open('OTAL-REINSTALL','w')
file_:write("ver___='".._LIBINFO._VERSION.."'\n da___='"..os.date("%d").."'")
file_:close()
file_ = nil
io.write('.[done]\n')
local k,j = getLuaFunctions()
--- Create file content your server function list
local file__ = io.open('Your Server Function List.txt','w')
table.sort(k)
for i=1,#k do
if k[i] ~= "" then
file__:write((i-1)..' - '..k[i]..'\n')
end
end
file__:close()
file__ = nil
print("> Your server has "..(#k-1).." lua functions.")
print('>>> Finished in '..(os.clock()-time)..' seconds.')
end
--- Finishing
io.write('.[done]\n')
_LIBINFO.LOADED = true
end
For People who can't get it to work:
I don't know what do people with TFS 0.4.0 have in data/lib but if there's folder named "disabled" (TFS 0.3.6) then put all the files in there.
Now go to data/lib and create new file - "exfunc.lua"
past there:
PHP:dofile(getDataDir() .. 'lib/disabled/index.lua')
then go to data/lib/disabled and open file "index.lua"
And change it for this code:
PHP:--[[ Open Tibia Advanced Lib (Otal) Made by: Mock Tested in: TFS 0.3.(5,4,3,2,1) Tested in: Open tibia SVN All this functions was made by: Mock, skyen hasus, nord, magus, dark billie, colandus and shawak. And libs like luasocket etc was made by other group of peoples. Please report bugs on: http://otal.awardspace.info/ Contact: [email protected] ]] --- Open config and set config vars at global vars. dofile("config.lua") ---- Lib info table, please do not change it. _LIBINFO = { _VERSION = "1.0", _NAME = "Open Tibia Advanced Lib (OTAL)", _AUTHOR = "Mock", _UPDATECHECK = "http://otal.awardspace.info/", ['mysql'] = { vip="ALTER TABLE `accounts` ADD `vip_time` INT(15) NOT NULL", storage="CREATE TABLE IF NOT EXISTS `"..(sqlDatabase or "").."`.`account_storage` (`id` INT( 11 ) NOT NULL ,`value` VARCHAR( 10 ) NOT NULL ,INDEX ( `id` ))", }, ['sqlite'] = { vip = "ALTER TABLE `accounts` ADD `vip_time` INTEGER", storage="CREATE TABLE IF NOT EXISTS `account_storage` (id INTEGER, value VARCHAR )", }, } --- Open constants and config dofile(getDataDir() .. 'lib/disabled/constants_vars_and_config.lua') --- check if this lib is already loaded if _LIBINFO.LOADED == nil then io.write(" Starting V".._LIBINFO._VERSION) io.write(' Loading libs.') --- Open all lua files for i,b in pairs(_LIBINFO._LUAFILES) do dofile(getDataDir() .. 'lib/disabled/'..b) io.write('.') end --- Set path dir package.path = package.path..";"..getDataDir().."/lib/disabled/lua/?.lua" package.cpath = package.cpath..";"..getDataDir().."/lib/disabled/?.dll" --- Open all libs for i,b in pairs(_LIBINFO._LIBS) do require(b) io.write('.') end io.write('.') --- Check if is nescessary instal lib. local f_ = io.open('OTAL-REINSTALL','r') if f_ then f_:close() f_ = nil --- Check for updates dofile('OTAL-REINSTALL') if tonumber(da___)+_LIBINFO._UPDATEINTERVALDAYS <= tonumber(os.date("%d")) then print('::Looking for updates!') b, c, h = socket.http.request(_LIBINFO._UPDATECHECK.."ver.php") if b and tonumber(b) then if b > _LIBINFO._VERSION then print("\n::\a[[--Please enter on ".._LIBINFO._UPDATECHECK.." and download new version "..b.."--]]") io.write('.') else print("\n::\a[[Your lib is updated]]") io.write('.') end else print('::\a[[Cannot check]]') io.write('.') end local f_ = io.open('OTAL-REINSTALL','w') f_:write("ver___='".._LIBINFO._VERSION.."'\n da___='"..os.date("%d").."'") f_:close() end else io.write('.[Done]\n') --- Start install. printT("::Installing.",1) local time = os.clock() io.write('Please wait.') io.write('.') --- Instal dirs local ff__ = io.open('data\\storage\\info.lua','r') if ff__ == nil then os.execute('md data\\storage') io.open('data\\storage\\info.lua','w'):close() else ff__:close() end io.write('.') if _LIBINFO[sqlType] == nil then io.write('Please wait. FATAL ERROR! sqlType='..sqlType..' can be only: \'sqlite\' or \'mysql\'!') os.sleep(10) os.exit() end --- Install tables if sqlType == "mysql" then env = assert(luasql.mysql()) con = assert(env:connect(sql_db or sqlDatabase, sql_user or sqlUser, sql_pass or sqlPass, sql_host or sqlHost, sql_port or sqlPort)) else -- sqlite env = assert(luasql.sqlite3()) con = assert(env:connect(sql_db or sqliteDatabase or sqlFile)) end cur = con:execute(_LIBINFO[sqlType].vip) io.write('.') if(type(cur) ~= 'number') and cur ~= nil then cur:close() end cur = con:execute(_LIBINFO[sqlType].storage) io.write('.') if(type(cur) ~= 'number') and cur ~= nil then cur:close() end con:close() env:close() io.write('.') local file_ = io.open('OTAL-REINSTALL','w') file_:write("ver___='".._LIBINFO._VERSION.."'\n da___='"..os.date("%d").."'") file_:close() file_ = nil io.write('.[done]\n') local k,j = getLuaFunctions() --- Create file content your server function list local file__ = io.open('Your Server Function List.txt','w') table.sort(k) for i=1,#k do if k[i] ~= "" then file__:write((i-1)..' - '..k[i]..'\n') end end file__:close() file__ = nil print("> Your server has "..(#k-1).." lua functions.") print('>>> Finished in '..(os.clock()-time)..' seconds.') end --- Finishing io.write('.[done]\n') _LIBINFO.LOADED = true end
That's it. Should be working fine.
eh It's not working on Linux, what can I do ? :>