• 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!
 
On the lines:

Code:
        if(isPlayer(lastHitKiller) == TRUE) then
            hitKillerName = getPlayerGUID(lastHitKiller)
        else
            hitKillerName = getCreatureName(lastHitKiller)
        end
Try This
Code:
        if (isCreature(lastHitKiller) == TRUE) then
            if (isPlayer(lastHitKiller) == TRUE) then
                hitKillerName = getPlayerGUID(lastHitKiller)
            elseif  (isMonster(lastHitKiller) == TRUE) then
                hitKillerName = getCreatureName(lastHitKiller)
            end
        end

Or This

Code:
[CODE]     
        if isCreature(lastHitKiller) then
            if isPlayer(lastHitKiller) then
                hitKillerName = getPlayerGUID(lastHitKiller)
            elseif  isMonster(lastHitKiller) then
                hitKillerName = getCreatureName(lastHitKiller)
            end
        end
[/CODE]
 
Need check if is Creature On here TOO.. this error caused by not creature found...

if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
 
Code:
        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"
                and
            else
                mostDamageKiller = "mostDamageKiller no is Creature IS field"
            end
        else
            var = "(mostDamageKiller ~= FALSE) and (mostDamageKiller ~= lastHitKiller)  RETURNED FALSE"
        end
 
This is the code I have now.

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 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"
                and
            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

Theres no errors in the console but still no body nor dropped items.
 
rsrsrsrsr o_O

I don't use cryingdamson, more try this.
and edit my exemple vars pliz.. rsrsrsrs



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

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"
and
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
 
[24/11/2013 19:04:54] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/playerdeath.lua:34: 'then' expected near ')'
[24/11/2013 19:04:54] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/playerdeath.lua)
[24/11/2013 19:04:54] data/creaturescripts/scripts/playerdeath.lua:34: 'then' expected near ')'
 
Code:
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  -- <<<<<< Need This End
end
 
Add this:
ALTER TABLE player_deaths ADD killed_by varchar(255) NOT NULL;
ALTER TABLE player_deaths ADD altkilled_by varchar(255) NOT NULL;

and test your script again
 
Well when I use my own script (Posted in the top) I still get the same error! And if I use the script provided by "Mikii" I get this error :

Code:
[24/11/2013 20:08:06] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/playerdeath.lua:35: 'then' expected near ')'
[24/11/2013 20:08:06] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/playerdeath.lua)
[24/11/2013 20:08:06] data/creaturescripts/scripts/playerdeath.lua:35: 'then' expected near ')'
 
Code:
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"

change:
if getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
to
if (getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
or(I think its this one)
if getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller) then
 
Back
Top