• 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!

Problem With Players Who Die

swordtheChoki

Mapper
Joined
Dec 4, 2010
Messages
71
Reaction score
0
Location
The Netherlands
I Use TFS 0.2.9 protocol 8.7 But There problems if someone die The Skills Become again lvl 10 :S
This the problem!!!

[24/05/2011 16:25:11] Lua Script Error: [CreatureScript Interface]
[24/05/2011 16:25:11] data/creaturescripts/scripts/playerdeath.lua:eek:nDeath
[24/05/2011 16:25:11] data/creaturescripts/scripts/playerdeath.lua:22: attempt to concatenate local 'byPlayer' (a boolean value)
[24/05/2011 16:25:11] stack traceback:
[24/05/2011 16:25:11] [C]: in function '__concat'
[24/05/2011 16:25:11] data/creaturescripts/scripts/playerdeath.lua:22: in function <data/creaturescripts/scripts/playerdeath.lua:3>
 
i have already fix it

This the Script:

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 = luasql.mysql()
sql = env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort)
else -- sqlite
env = luasql.sqlite3()
sql = env:connect(sqliteDatabase)
end
local byPlayer = 0
if not killer or killer == 0 then
killerName = "field item"
else
if isPlayer(killer) == TRUE then
byPlayer = 1
end
killerName = getCreatureName(killer)
end
sql:execute("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", '" .. escapeString(killerName) .. "', " .. byPlayer .. ");")
local result = sql:execute("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
local deathRecords = numRows(result)
if sqlType == "mysql" then
while deathRecords > maxDeathRecords do
delete = sql: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 = sql: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
sql:close()
env:close()
end
end
 
Back
Top