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

When somebody dies theres no body

Kurre Kurrson

New Member
Joined
Aug 11, 2010
Messages
125
Reaction score
3
Hey guys, im running cryingdamson 0.3.6 (8.60) V8.2 atm.

When somebody dies theres like a "green wind" for a few seconds but there is no body and ofcourse the killed player dident drop any loot.

I got a few errors in my console which you can see below:

gege.png



My playerdeath.lua:

Code:
local config = {
    deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
    sqlType = getConfigInfo('sqlType'),
    maxDeathRecords = getConfigInfo('maxDeathRecords')
}

config.sqlType = config.sqlType == "sqlite" and DATABASE_ENGINE_SQLITE or DATABASE_ENGINE_MYSQL

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
    if(config.deathListEnabled ~= TRUE) then
        return
    end

    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:getRows(true) - config.maxDeathRecords
        if(amount > 0) then
            if(config.sqlType == DATABASE_ENGINE_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

Is there any other information you need to have just let me know, thanks in advance!
 
[24/11/2013 20:28:23] [Error - LuaScriptInterface::loadFile] data/npc/scripts/advanceTaskSystem.lua:49: unexpected symbol near ','
[24/11/2013 20:28:23] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/advanceTaskSystem.lua
[24/11/2013 20:28:23] data/npc/scripts/advanceTaskSystem.lua:49: unexpected symbol near ','
 
@Last World Nice eyes ~~~~ And my bad hands and eyes. :)
The error said it ;)

[24/11/2013 20:28:23] [Error - LuaScriptInterface::loadFile] data/npc/scripts/advanceTaskSystem.lua:49: unexpected symbol near ','
[24/11/2013 20:28:23] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/advanceTaskSystem.lua
[24/11/2013 20:28:23] data/npc/scripts/advanceTaskSystem.lua:49: unexpected symbol near ','

This has nothing to do with the playersdeath script... lol :p
 
Hah copied the wrong one but they look the same ! :)

[24/11/2013 20:28:17] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/playerdeath.lua:44: unexpected symbol near 'else'
[24/11/2013 20:28:17] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/playerdeath.lua)
[24/11/2013 20:28:17] data/creaturescripts/scripts/playerdeath.lua:44: unexpected symbol near 'else'
 
[24/11/2013 20:28:23] [Error - LuaScriptInterface::loadFile] data/npc/scripts/advanceTaskSystem.lua:49: unexpected symbol near ','
[24/11/2013 20:28:23] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/advanceTaskSystem.lua
[24/11/2013 20:28:23] data/npc/scripts/advanceTaskSystem.lua:49: unexpected symbol near ','
:O Ho my god... You server is very bugged. :)

Post you advanceTaskSystem.lua



The error said it ;)
More i don't find this... rsrsrs
 
Remove this an try:


Code:
else
var = "(mostDamageKiller ~= FALSE) and (mostDamageKiller ~= lastHitKiller) RETURNED FALSE"

And post Your ALL code here now.
 
Code:
if(isPlayer(mostDamageKiller) == TRUE) then
damageKillerName = getPlayerGUID(mostDamageKiller)
else
damageKillerName = getCreatureName(mostDamageKiller)
end
else
lastHitKiller = "lastHitKiller no is Creature IS field"
and
else
mostDamageKiller = "mostDamageKiller no is Creature IS field"
end
else

You sure it has to be "and"? lol
replace it with "end" instead of "and" xD
 
[24/11/2013 20:35:33] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/playerdeath.lua:64: 'end' expected (to close 'if' at line 24) near '<eof>'
[24/11/2013 20:35:33] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/playerdeath.lua)
[24/11/2013 20:35:33] data/creaturescripts/scripts/playerdeath.lua:64: 'end' expected (to close 'if' at line 24) near '<eof>'
 
What it looks like now! Thanks for helping me guys, I do really appriciate it!

Code:
local config = {
deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
sqlType = getConfigInfo('sqlType'),
maxDeathRecords = getConfigInfo('maxDeathRecords')
}
config.sqlType = config.sqlType == "sqlite" and DATABASE_ENGINE_SQLITE or DATABASE_ENGINE_MYSQL
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
if isPlayer(cid) == TRUE then
if (getPlayerSlotItem(cid, 2).itemid == 2173) and getPlayerSkullType(cid) >= 1 then
doPlayerRemoveItem(cid, 2173, 1)
doCreatureSetDropLoot(cid, false)
doPlayerSetLossSkill(cid, false)
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 10)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
return TRUE
end
end

if(config.deathListEnabled ~= TRUE) then
return
end
local hitKillerName = "field item"
local damageKillerName = ""
if(lastHitKiller ~= FALSE) then
if isCreature(lastHitKiller) then
if (isPlayer(lastHitKiller) == TRUE) then
hitKillerName = getPlayerGUID(lastHitKiller)
elseif isMonster(lastHitKiller) then
hitKillerName = getCreatureName(lastHitKiller)
end
end
if(mostDamageKiller ~= FALSE) and (mostDamageKiller ~= lastHitKiller) then
if isCreature(mostDamageKiller) then
if isCreature(lastHitKiller) then
if (getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
if(isPlayer(mostDamageKiller) == TRUE) then
damageKillerName = getPlayerGUID(mostDamageKiller)
else
damageKillerName = getCreatureName(mostDamageKiller)
end
else
lastHitKiller = "lastHitKiller no is Creature IS field"
end
else
mostDamageKiller = "mostDamageKiller no is Creature IS field"
end
else
var = "(mostDamageKiller ~= FALSE) and (mostDamageKiller ~= lastHitKiller) RETURNED FALSE"
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:getRows(true) - config.maxDeathRecords
if(amount > 0) then
if(config.sqlType == DATABASE_ENGINE_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
 
Haha well I am learning c++,html,php,mysql in school right now... but need some time to get more experienced before dealing with these problems I'd say haha!

I deleted one end and I still got this error :

[24/11/2013 20:41:11] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/playerdeath.lua)
[24/11/2013 20:41:11] data/creaturescripts/scripts/playerdeath.lua:63: 'end' expected (to close 'if' at line 32) near '<eof>'
 
Nope, still no bodies nor any errors.. Could this has something to do with a script that I use? When I kill some1 theres like a "green wind" over the sqm where the player died and a text with "owned" also the killer recieves marijuana..
 
No idea, I got no clue bout 7.72+ Server or ID or what ever :p
That script might wrong then...try the one you had and check the errors..
 
The no body problem is caused by the missing return true above the last end.
Every main function should return true (except from parts where it's supposed to return false), if it doesn't it won't do the things it's supposed to do.
For example missing return true with function onDeath won't create a body, with function onKill the target won't die, with function onPrepareDeath the player won't die, etc.

If you have problems with missing or to much ends, tab your script, this way it's easy to see which end is missing or which end should be removed.
http://otland.net/threads/how-to-tab-lua-scripts.203763/
 
Back
Top