Hello.
I have the TFS 0.2.2+ and a problem with playerdeath.lua
Since the begining of my server I had an error in "sqlite3". When I fixed this problem, after player's death there aren't any reactions in the Database.
I used many scripts (from this forum as well) and none is good.
Can someone help me fix it?
Or downloadin the newest distro version is the only thing that can help me ?
It is my script:
Thanks from above for helping me.
Yours,
Over'
I have the TFS 0.2.2+ and a problem with playerdeath.lua
Since the begining of my server I had an error in "sqlite3". When I fixed this problem, after player's death there aren't any reactions in the Database.
I used many scripts (from this forum as well) and none is good.
Can someone help me fix it?
Or downloadin the newest distro version is the only thing that can help me ?
It is my script:
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))
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) .. ", '" .. db.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
end
Thanks from above for helping me.
Yours,
Over'
Last edited: