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

Experience problem/reset ?

Fakaa

New Member
Joined
Oct 31, 2008
Messages
102
Reaction score
0
Hello, i got a server up and running but now when players get high like almost 300 them levels change to 1 when they die I think, or maybe when they logout but thats not sure.

I looked already in forum with search but cant help me further then i'm now.

So i need some guesses mates xD!


Thnx for advance

This is my playerdeath.lua located in creaturescripts/scripts


PHP:
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 ~= 0) then
            if(isPlayer(lastHitKiller) == TRUE) then
                hitKillerName = getPlayerGUID(lastHitKiller)
            else
                hitKillerName = getCreatureName(lastHitKiller)
            end

            if(mostDamageKiller ~= 0 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 == "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
 
Last edited by a moderator:
Maybe you made the deathLoss really high or 100%.
Maybe there was some error with importing the MySQL to PHPMyAdmin.
 
I had the same problem, and for me it helped changing the promotion npc script lol.

when they wasnt promoted they didnt loose all levels, but when promoted they did.

So ;)
 
Back
Top