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

upgrade scripts

Xapuur

New Member
Joined
Sep 15, 2009
Messages
157
Reaction score
0
Location
Chile
somebody can "UPGRADE" this scripts to TFS 8.5 ? (TFS 0.3.5)

this one: this scripts SHOULD do when the player dead drops his heart's, and it's automatically withdraw for the player who do the last hit.. but it doesn't works :S

creaturescripts\scripts\playerdeath
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 isPlayer(lastHitKiller) == TRUE then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "OWN3D!.")
        item = doPlayerAddItem(lastHitKiller,5943,1)
        setItemName(item,""..getPlayerName(cid).."'s hearth")
        doSetItemSpecialDescription(item, 'Este es el corazon de '..getPlayerName(cid)..' por morir a manos de '..getPlayerName(lastHitKiller)..'')
        doBroadcastMessage(""..getPlayerName(cid).." ["..getPlayerLevel(cid).."] Murio por "..getCreatureName(lastHitKiller).." ["..getPlayerLevel(lastHitKiller).."]!!",20)
        else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "OWN3D!.")
        doBroadcastMessage(""..getPlayerName(cid).." ["..getPlayerLevel(cid).."] Murio por "..getCreatureName(lastHitKiller).."!!",20)
end
    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

second: and this works.. (is fixed) but i can't do that the hearth of the dead man, is automatically pick up for the man who do the last hit.. the heart's appears in the dead body.. not in the backpack of the man who do the last hit :S (this is more important than the first :) )

http://otland.net/f82/heart-frag-reward-v1-1-a-55883/
Code:
  function onKill(cid, target, lastHitKiller)
        if(isPlayer(lastHitKiller)) then
            local values = { KILLER_NAME = getCreatureName(lastHitKiller), KILLER_LEVEL = getPlayerLevel(lastHitKiller), TARGET_NAME = getCreatureName(target), TARGET_LEVEL = getPlayerLevel(target) }
            local reward = doPlayerAddItem(lastHitKiller, 5943, 1)
            doSendMagicEffect(getCreaturePosition(lastHitKiller), CONST_ME_GIFT_WRAPS)
            doSetItemSpecialDescription(reward, isPlayer(lastHitKiller) and "Este es el corazon de ".. values.TARGET_NAME ..". Asesinado en level ".. values.TARGET_LEVEL .." por ".. values.KILLER_NAME .." quien tenia level ".. values.KILLER_LEVEL .." en el momento. " .. (getCreatureSkullType(target) <= SKULL_GREEN and "[Injustificado]" or "[Justificado]") or "Este es el corazon de ".. values.TARGET_NAME ..". Asesinado en level ".. values.TARGET_LEVEL .." por ".. values.KILLER_NAME ..".")
            setItemName(reward, "".. values.TARGET_NAME .."'s Heart.")
        end
        return true
end

and if you wanna i will +rep for you :)
and of course:
THX :)
and sorry for me bad english :)
 
Back
Top