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

Lua [OTX2] [TFS0.3.6] (LuaInterface::internalGetPlayerInfo) Player not found when requesting player info #29

Rankret

New Member
Joined
Apr 14, 2023
Messages
13
Reaction score
0
Lua:
[Error - CreatureScript Interface]
data/creaturescripts/scripts/heart.lua:onDeath
Description:
(LuaInterface::internalGetPlayerInfo) Player not found when requesting player info #29

Lua:
function onDeath(cid, corpse, deathList)

if getPlayerIp(cid) == getPlayerIp(deathList[1]) then return true end

function getHeartFromNivel(cid)

local t = {

[{60,99}] = 2519, -- Brave Heart

[{100,math.huge}] = 2520 -- Glorious Heart

}


for var, ret in pairs(t) do


if getPlayerLevel(cid) >= var[1] and getPlayerLevel(cid) <= var[2] then

k  = ret

end

end

return k

end


if isPlayer(cid) and getPlayerLevel(cid) >= 60 and isPlayer(deathList[1]) then

local item = getHeartFromNivel(cid)

doItemSetAttribute(doPlayerAddItem(deathList[1],item, 1), "description", "Cora��o do Shinobi "..getPlayerName(cid).." assassinado no level "..getPlayerLevel(cid).." por "..getPlayerName(deathList[1])..".")

if getPlayerLevel(cid) >= 100 and getPlayerLevel(cid) <= 1000 then

doBroadcastMessage("".. getCreatureName(deathList[1]) .. " [" .. getPlayerLevel(deathList[1]) .. "] Assassinou Lindamente o Glorioso Shinobi " .. getCreatureName(cid) .. " [" .. getPlayerLevel(cid) .. "]",18)

end

doSendMagicEffect(getPlayerPosition(deathList[1]), 12)

end

return true

end
 
try here:

Lua:
function onDeath(cid, corpse, deathList)
    if getPlayerIp(cid) == getPlayerIp(deathList[1]) then
        return true
    end

    local function getHeartFromNivel(cid)
        local t = {
            [60] = 2519, -- Brave Heart
            [100] = 2520 -- Glorious Heart
        }

        for nivel, itemID in pairs(t) do
            if getPlayerLevel(cid) >= nivel then
                return itemID
            end
        end

        return nil
    end

    if isPlayer(cid) and getPlayerLevel(cid) >= 60 and isPlayer(deathList[1]) then
        local item = getHeartFromNivel(cid)

        if item then
            local playerName = getPlayerName(cid)
            local playerLevel = getPlayerLevel(cid)
            local killerName = getPlayerName(deathList[1])

            local description = "Coração do Shinobi " .. playerName ..
                                " assassinado no level " .. playerLevel ..
                                " por " .. killerName .. "."

            local itemAdded = doPlayerAddItem(deathList[1], item, 1)
            if itemAdded then
                doItemSetAttribute(itemAdded, "description", description)

                if playerLevel >= 100 and playerLevel <= 1000 then
                    doBroadcastMessage(
                        killerName .. " [" .. getPlayerLevel(deathList[1]) ..
                        "] Assassinou Lindamente o Glorioso Shinobi " ..
                        playerName .. " [" .. playerLevel .. "]", 18
                    )
                end

                doSendMagicEffect(getPlayerPosition(deathList[1]), 12)
            end
        end
    end

    return true
end
 
try here:

Lua:
function onDeath(cid, corpse, deathList)
    if getPlayerIp(cid) == getPlayerIp(deathList[1]) then
        return true
    end

    local function getHeartFromNivel(cid)
        local t = {
            [60] = 2519, -- Brave Heart
            [100] = 2520 -- Glorious Heart
        }

        for nivel, itemID in pairs(t) do
            if getPlayerLevel(cid) >= nivel then
                return itemID
            end
        end

        return nil
    end

    if isPlayer(cid) and getPlayerLevel(cid) >= 60 and isPlayer(deathList[1]) then
        local item = getHeartFromNivel(cid)

        if item then
            local playerName = getPlayerName(cid)
            local playerLevel = getPlayerLevel(cid)
            local killerName = getPlayerName(deathList[1])

            local description = "Coração do Shinobi " .. playerName ..
                                " assassinado no level " .. playerLevel ..
                                " por " .. killerName .. "."

            local itemAdded = doPlayerAddItem(deathList[1], item, 1)
            if itemAdded then
                doItemSetAttribute(itemAdded, "description", description)

                if playerLevel >= 100 and playerLevel <= 1000 then
                    doBroadcastMessage(
                        killerName .. " [" .. getPlayerLevel(deathList[1]) ..
                        "] Assassinou Lindamente o Glorioso Shinobi " ..
                        playerName .. " [" .. playerLevel .. "]", 18
                    )
                end

                doSendMagicEffect(getPlayerPosition(deathList[1]), 12)
            end
        end
    end

    return true
end
It gives me the error when I die with a creature, which function would I put so that it doesn't work on creatures?
 
Lua:
function onDeath(cid, corpse, deathList)
    if not isPlayer(cid) then
        return false
    end


    if getPlayerIp(cid) == getPlayerIp(deathList[1]) then
        return true
    end

    local function getHeartFromNivel(cid)
        local t = {
            [60] = 2519, -- Brave Heart
            [100] = 2520 -- Glorious Heart
        }

        for nivel, itemID in pairs(t) do
            if getPlayerLevel(cid) >= nivel then
                return itemID
            end
        end

        return nil
    end

    if isPlayer(cid) and getPlayerLevel(cid) >= 60 and isPlayer(deathList[1]) then
        local item = getHeartFromNivel(cid)

        if item then
            local playerName = getPlayerName(cid)
            local playerLevel = getPlayerLevel(cid)
            local killerName = getPlayerName(deathList[1])

            local description = "Coração do Shinobi " .. playerName ..
                                " assassinado no level " .. playerLevel ..
                                " por " .. killerName .. "."

            local itemAdded = doPlayerAddItem(deathList[1], item, 1)
            if itemAdded then
                doItemSetAttribute(itemAdded, "description", description)

                if playerLevel >= 100 and playerLevel <= 1000 then
                    doBroadcastMessage(
                        killerName .. " [" .. getPlayerLevel(deathList[1]) ..
                        "] Assassinou Lindamente o Glorioso Shinobi " ..
                        playerName .. " [" .. playerLevel .. "]", 18
                    )
                end

                doSendMagicEffect(getPlayerPosition(deathList[1]), 12)
            end
        end
    end

    return true
end
 
Lua:
function onDeath(cid, corpse, deathList)
    if not isPlayer(cid) then
        return false
    end


    if getPlayerIp(cid) == getPlayerIp(deathList[1]) then
        return true
    end

    local function getHeartFromNivel(cid)
        local t = {
            [60] = 2519, -- Brave Heart
            [100] = 2520 -- Glorious Heart
        }

        for nivel, itemID in pairs(t) do
            if getPlayerLevel(cid) >= nivel then
                return itemID
            end
        end

        return nil
    end

    if isPlayer(cid) and getPlayerLevel(cid) >= 60 and isPlayer(deathList[1]) then
        local item = getHeartFromNivel(cid)

        if item then
            local playerName = getPlayerName(cid)
            local playerLevel = getPlayerLevel(cid)
            local killerName = getPlayerName(deathList[1])

            local description = "Coração do Shinobi " .. playerName ..
                                " assassinado no level " .. playerLevel ..
                                " por " .. killerName .. "."

            local itemAdded = doPlayerAddItem(deathList[1], item, 1)
            if itemAdded then
                doItemSetAttribute(itemAdded, "description", description)

                if playerLevel >= 100 and playerLevel <= 1000 then
                    doBroadcastMessage(
                        killerName .. " [" .. getPlayerLevel(deathList[1]) ..
                        "] Assassinou Lindamente o Glorioso Shinobi " ..
                        playerName .. " [" .. playerLevel .. "]", 18
                    )
                end

                doSendMagicEffect(getPlayerPosition(deathList[1]), 12)
            end
        end
    end

    return true
end
error :(
 
Back
Top