Well, iam very noob in scripts and i really need this script:
Error message:
What is wrong with this?
Empty say: luasql isn't used in 0.3 - I haven't worked with either lusql or the new system
So? i need help
Thanks...
P.S.: Sorry for my english
Code:
function onLogin(cid)
if(InitHistory == 0) then
local historyPage = addEvent(historyPage, 60000, {})
InitHistory = historyPage
end
end
function historyPage(parameters)
dofile("./config.lua")
env = assert(luasql.mysql())
con = assert(env:connect(sqlDatabase, sqlUser, sqlPass, sqlHost, sqlPort))
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
Error message:
Code:
[18/12/2008 19:26:37] Lua Script Error: [CreatureScript Interface]
[18/12/2008 19:26:37] in a timer event called from:
[18/12/2008 19:26:37] data/creaturescripts/scripts/login2.lua:onLogin
[18/12/2008 19:26:37] data/creaturescripts/scripts/login2.lua:10: attempt to index global 'luasql' (a nil value)
[18/12/2008 19:26:37] stack traceback:
[18/12/2008 19:26:37] data/creaturescripts/scripts/login2.lua:10: in function <data/creaturescripts/scripts/login2.lua:8>
What is wrong with this?
Empty say: luasql isn't used in 0.3 - I haven't worked with either lusql or the new system
So? i need help
Thanks...
P.S.: Sorry for my english