Ir para conteúdo

Own Loot Backpack


heberpcl

Posts Recomendados

Hello,

remaker script for tfs 1.x.

 

talkactions.xml

<talkaction words="!ownbp" script="ownbp.lua"/>
ownbp.lua

 

local config = {
    cost = 1000, -- Cost (GP)
    ownTime = 24 * 60 * 60 * 1000, -- Time (24 horas)
    backpackId = 2000
}

function onSay(player, words, param)
    local playerID = player:getGuid()
    local owner = (playerID + 100)
    local ownerName = player:getName()

    local function noOwner(o)
        o:removeAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
        o:setActionId(0)
    end

    if (player:removeMoney(config.cost) == true) then
        local backpack = doPlayerAddItem(player:getId(), config.backpackId, 1)
        if (backpack ~= nil) then
            doSetItemSpecialDescription(backpack, ownerName..' owns this container.')
            doSetItemActionId(backpack, owner)
            addEvent(noOwner, 1000 * config.ownTime, backpack)
        end
    else
        doPlayerSendCancel(cid, "You do not have the amount of GP ("..config.cost..").")
    end
end
actions.xml

 

<action itemid="2000" script="ownbp.lua"/>
ownbp.lua

 

function onUse(cid, item, fromPosition, target, toPosition, isHotkey)
    local playerID = cid:getGuid() -- getPlayerGUID(cid)
    local owner = (item.actionid - 100)
    if (owner > 0) then
        if (owner ~= playerID) then
            doPlayerSendCancel(cid, "You aren\'t owner of this container.")
            return TRUE
        end
    end
end
by @@azi
Link para o comentário
Compartilhar em outros sites

  • 2 weeks later...
  • 6 months later...
×
×
  • Criar Novo...