• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

help deathlist

lord anthor

New Member
Joined
Oct 4, 2008
Messages
17
Reaction score
0
wen aplayer death
in the window of TFS shwo this

Lua Script Error: [CreatureScript Interface]
[22/02/2009 22:49:49] data/creaturescripts/scripts/playerdeath.lua:eek:nDeath

[22/02/2009 22:49:49] data/creaturescripts/scripts/playerdeath.lua:10: attempt to call field 'sqlite3' (a nil value)
[22/02/2009 22:49:49] stack traceback:
[22/02/2009 22:49:49] data/creaturescripts/scripts/playerdeath.lua:10: in function <data/creaturescripts/scripts/playerdeath.lua:3>

help!

srry for my english xD
 
local config = {
deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
sqlType = getConfigInfo('sqlType'),
maxDeathRecords = getConfigInfo('maxDeathRecords')
}

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
if(config.deathListEnabled == TRUE) then
local hitKillerName = "field item"
local damageKillerName = ""
if(lastHitKiller ~= FALSE) then
if(isPlayer(lastHitKiller) == TRUE) then
hitKillerName = getPlayerGUID(lastHitKiller)
else
hitKillerName = getCreatureName(lastHitKiller)
end

if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
if(isPlayer(mostDamageKiller) == TRUE) then
damageKillerName = getPlayerGUID(mostDamageKiller)
else
damageKillerName = getCreatureName(mostDamageKiller)
end
end
end

db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")
local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
if(rows:getID() ~= -1) then
local amount = (rows:numRows(true) - config.maxDeathRecords)
if(amount > 0) then
if(config.sqlType == "sqlite") then
for i = 1, amount do
db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
end
else
db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")
end
end
end
end
end
 
open your server folder go to data go to creaturescript and go to script make a lua file open it copy the code paste and save if u already got a playerdeath.lua just replace with the old one
 
Back
Top