Hermes
dziwki kola gramy w lola
Hi there! I have a problem... Every time any character dies, the error appears:
I don't know how to fix it, but here is my file /creaturescripts/scripts/playerdeath.lua:
I'm using The Forgotten Server 0.3a2 from OTland repository (newest rev 8.22)
Regards,
Hermes
Code:
[08/10/2008 20:37:21] Lua Script Error: [CreatureScript Interface]
[08/10/2008 20:37:21] data/creaturescripts/scripts/playerdeath.lua:onDeath
[08/10/2008 20:37:21] data/creaturescripts/scripts/playerdeath.lua:7: attempt to index global 'luasql' (a nil value)
[08/10/2008 20:37:21] stack traceback:
[08/10/2008 20:37:21] data/creaturescripts/scripts/playerdeath.lua:7: in function <data/creaturescripts/scripts/playerdeath.lua:3>
I don't know how to fix it, but here is my file /creaturescripts/scripts/playerdeath.lua:
Code:
dofile("./config.lua")
function onDeath(cid, corpse, killer)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You are dead.")
if deathListEnabled == "yes" then
if sqlType == "mysql" then
env = assert(luasql.mysql())
con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
else -- sqlite
env = assert(luasql.sqlite3())
con = assert(env:connect(sqliteDatabase))
end
local byPlayer = FALSE
if killer == FALSE then
killerName = "field item"
else
if isPlayer(killer) == TRUE then
byPlayer = TRUE
end
killerName = getCreatureName(killer)
end
assert(con:execute("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", '" .. escapeString(killerName) .. "', " .. byPlayer .. ");"))
local cursor = assert(con:execute("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";"))
local deathRecords = numRows(cursor)
if sqlType == "mysql" then
while deathRecords > maxDeathRecords do
delete = assert(con:execute("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1;"))
deathRecords = deathRecords - 1
end
else
while deathRecords > maxDeathRecords do
delete = assert(con:execute("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);"))
deathRecords = deathRecords - 1
end
end
con:close()
env:close()
end
end
I'm using The Forgotten Server 0.3a2 from OTland repository (newest rev 8.22)
Regards,
Hermes