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

loot msg when kill player

Nerevr back

Member
Joined
Nov 7, 2014
Messages
269
Reaction score
7
i ask for this script

when player kill othere player the player die lost items the killer get msg
loot creaturename {dead} : name of items player losse

tfs 0.4
 
Last edited by a moderator:
Code:
registerCreatureEvent(cid, "playerLoot")
Code:
<event type="death" name="playerLoot" event="script" value="playerLoot.lua"/>
Code:
function getTopItem(p)
    p.stackpos = 0
    local v = getThingFromPos(p)
    repeat
        p.stackpos = p.stackpos + 1
        v = getThingFromPos(p)
    until v.itemid == 0
    p.stackpos = p.stackpos - 1
    return getThingFromPos(p)
end

function getContentDescription(uid, comma)
    local ret, i, containers = '', 0, {}
    while i < getContainerSize(uid) do
        local v, s = getContainerItem(uid, i), ''
        local k = getItemInfo(v.itemid) 
        if k.name ~= '' then
            if v.type > 1 and k.stackable and k.showCount then
                s = v.type .. ' ' .. getItemInfo(v.itemid).plural
            else
                local article = k.article
                s = (article == '' and '' or article .. ' ') .. k.name
            end
            ret = ret .. (i == 0 and not comma and '' or ', ') .. s
            if isContainer(v.uid) and getContainerSize(v.uid) > 0 then
                table.insert(containers, v.uid)
            end
        else
            ret = ret .. (i == 0 and not comma and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster'
        end
        i = i + 1
    end
    for i = 1, #containers do
        ret = ret .. getContentDescription(containers[i], true)
    end
    return ret
end

function broadcastLoot(name, position, killers)
    local corpse = getTopItem(position).uid
    local str = 'Loot of ' .. name .. ': ' .. getContentDescription(corpse) .. '.'
    for _, pid in ipairs(killers) do
        if isPlayer(pid) then
            doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, str)
        end
    end
end

function onDeath(cid, corpse, deathList)   
    addEvent(broadcastLoot, 100, getCreatureName(cid), getThingPos(cid), deathList)
    return true
end
 
Code:
registerCreatureEvent(cid, "playerLoot")
Code:
<event type="death" name="playerLoot" event="script" value="playerLoot.lua"/>
Code:
function getTopItem(p)
    p.stackpos = 0
    local v = getThingFromPos(p)
    repeat
        p.stackpos = p.stackpos + 1
        v = getThingFromPos(p)
    until v.itemid == 0
    p.stackpos = p.stackpos - 1
    return getThingFromPos(p)
end

function getContentDescription(uid, comma)
    local ret, i, containers = '', 0, {}
    while i < getContainerSize(uid) do
        local v, s = getContainerItem(uid, i), ''
        local k = getItemInfo(v.itemid)
        if k.name ~= '' then
            if v.type > 1 and k.stackable and k.showCount then
                s = v.type .. ' ' .. getItemInfo(v.itemid).plural
            else
                local article = k.article
                s = (article == '' and '' or article .. ' ') .. k.name
            end
            ret = ret .. (i == 0 and not comma and '' or ', ') .. s
            if isContainer(v.uid) and getContainerSize(v.uid) > 0 then
                table.insert(containers, v.uid)
            end
        else
            ret = ret .. (i == 0 and not comma and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster'
        end
        i = i + 1
    end
    for i = 1, #containers do
        ret = ret .. getContentDescription(containers[i], true)
    end
    return ret
end

function broadcastLoot(name, position, killers)
    local corpse = getTopItem(position).uid
    local str = 'Loot of ' .. name .. ': ' .. getContentDescription(corpse) .. '.'
    for _, pid in ipairs(killers) do
        if isPlayer(pid) then
            doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, str)
        end
    end
end

function onDeath(cid, corpse, deathList) 
    addEvent(broadcastLoot, 100, getCreatureName(cid), getThingPos(cid), deathList)
    return true
end
player don't losse any items and always get this msg { i kill player without blessing and aol}
18:28 Loot of Hoytbs: .
i think this script need c++ i work in it for him but all my turned failed :S
 
I tested this perfectly on Printer's tfs crying damson 8.6, I don't see what much difference these could have with the creaturescripts.
 
Back
Top