error656
New Member
- Joined
- Aug 27, 2007
- Messages
- 60
- Reaction score
- 1
Hi everyone
Im testing The Forgotten Server (Crying Damson) - Old School v2 for Tibia version 7.6, and i have got a little problem with deathlist. When someones die nothing is written to database. Its my deathlist.lua
its my login.lua
Its my database stucture of player_deaths:
player_id int(11) Nie Brak
date bigint(20) UNSIGNED Nie Brak
level int(10) UNSIGNED Nie Brak
killed_by int(11) Nie Brak
its my config files of deathlist:
-- Deathlist
deathListEnabled = true
maxDeathRecords = 5
maybe someones know how to fix that, or is that engine problem??
Thx for help!
Im testing The Forgotten Server (Crying Damson) - Old School v2 for Tibia version 7.6, and i have got a little problem with deathlist. When someones die nothing is written to database. Its my deathlist.lua
local config = {
deathListEnabled = getConfigInfo('deathListEnabled'),
sqlType = getConfigInfo('sqlType'),
maxDeathRecords = getConfigInfo('maxDeathRecords')
}
function onDeath(cid, corpse, killer)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You are dead.")
if(config.deathListEnabled == "yes") then
if(killer ~= FALSE) then
if(isPlayer(killer) == TRUE) then
killerName = getPlayerGUID(killer)
else
killerName = getCreatureName(killer)
end
else
killerName = "field item"
end
db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `date`, `level`, `killed_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(killerName) .. ");")
local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
if(rows:getID() ~= -1) then
local deathRecords = rows:numRows(true)
if(config.sqlType == "sqlite") then
while(deathRecords > config.maxDeathRecords) do
db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `date` LIMIT 1);")
deathRecords = deathRecords - 1
end
else
while(deathRecords > config.maxDeathRecords) do
db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1;")
deathRecords = deathRecords - 1
end
end
end
end
end
its my login.lua
function onLogin(cid)
registerCreatureEvent(cid, "PlayerDeath")
return TRUE
end
Its my database stucture of player_deaths:
player_id int(11) Nie Brak
date bigint(20) UNSIGNED Nie Brak
level int(10) UNSIGNED Nie Brak
killed_by int(11) Nie Brak
its my config files of deathlist:
-- Deathlist
deathListEnabled = true
maxDeathRecords = 5
maybe someones know how to fix that, or is that engine problem??
Thx for help!