Ir para conteúdo

Featured Replies

Postado

fala galera blz boa noite.  bom eu possuo esse script de autoloot (apenas coleta gold) e queria deixar ele apenas para premmy account alguem pode me ajudar?

 

rep + ai pra quem conseguir obrigado.

 

Spoiler

function onSay(cid, words, param)     if getPlayerStorageValue(cid, AUTO_LOOT_STORAGE) == -1 then         registerCreatureEvent(cid, "AutoLootMoney")         setPlayerStorageValue(cid, AUTO_LOOT_STORAGE, 1)         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Auto Loot Money activated! There's a tax of "..AUTO_LOOT_TAX.."% of the collected money.")     else         unregisterCreatureEvent(cid, "AutoLootMoney")         setPlayerStorageValue(cid, AUTO_LOOT_STORAGE, -1)         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Auto Loot Money deactivated!")     end return true end

Spoiler

AUTO_LOOT_TAX = 25 -- Tax for using the service (in %) (min 0, max 100)
AUTO_LOOT_BANK = true -- Will the money go to the bank? If false, the money will go to the player
AUTO_LOOT_STORAGE = 38199 -- Storage of the status of the Auto Loot
 
function findItemsInContainer(ids, container)
    local items_found = {}
    local v_uids = {}
    for i = 0, getContainerSize(container)-1 do
        container_item = getContainerItem(container, i)
        if isContainer(container_item.uid) then
            local container_recursive = findItemsInContainer(ids, container_item.uid)
            for a, b in ipairs(container_recursive) do
                if not isInArray(v_uids, b.uid) then
                    table.insert(v_uids, container_item.uid)
                    table.insert(items_found, b)
                end
            end
        end
        if isInArray(ids, container_item.itemid) and not isInArray(v_uids, container_item.uid) then
            table.insert(v_uids, container_item.uid)
            table.insert(items_found, container_item)
        end
    end
    return items_found
end
 
function executeAutoLoot(cid, pos, target_name)
    AUTO_LOOT_TAX = AUTO_LOOT_TAX > 100 and 100 or AUTO_LOOT_TAX < 0 and 0 or AUTO_LOOT_TAX
    local corpse = getTileItemByType(pos, ITEM_TYPE_CONTAINER).uid
    local total_count = 0
    for a, b in ipairs(findItemsInContainer({ITEM_GOLD_COIN, ITEM_PLATINUM_COIN, ITEM_CRYSTAL_COIN}, corpse)) do
        if b.itemid == ITEM_CRYSTAL_COIN then
            total_count = total_count+b.type*10000
        elseif b.itemid == ITEM_PLATINUM_COIN then
            total_count = total_count+b.type*100
        elseif b.itemid == ITEM_GOLD_COIN then
            total_count = total_count+b.type
        end
        doRemoveItem(b.uid, b.type)
    end
    if AUTO_LOOT_BANK then
        doPlayerSetBalance(cid, getPlayerBalance(cid)+math.ceil(total_count*(1-AUTO_LOOT_TAX/100)))
    else
        doPlayerAddMoney(cid, math.ceil(total_count*(1-AUTO_LOOT_TAX/100)))
    end
    if total_count > 0 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Money collected from "..target_name..": "..total_count.." gold coins."..(AUTO_LOOT_TAX > 0 and " Tax ("..AUTO_LOOT_TAX.."%) discounted: "..math.floor(total_count*(AUTO_LOOT_TAX/100)).." gold coins." or " No tax."))
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Total collected: "..math.ceil(total_count*(1-AUTO_LOOT_TAX/100)).." gold coins.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "No money collected from "..target_name..".")
    end
    return true
end

 

Editado por xdwilliam (veja o histórico de edições)

  • Respostas 17
  • Visualizações 706
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Testa ai.. function onSay(cid, words, param) if not isPremium(cid) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Only Premium users can do that.") return true end if get

Postado

Bote ele em <code> e spoiler, não deixe em download.
De qualquer modo, se tu souber e quiser fazer pra agilizar, é só por no começo do script:

if isPremium(cid) then

e antes do último return true, acrescentar um:
 

end

 

De onde eu venho se dizia, que o chorar não é do homem, e o homem o que sente guarda bem no coração...
 

Postado
19 minutos atrás, xdwilliam disse:

a certo desculpe.

mais em qual dos dois arquivos eu coloco essa linha que voce mandou?

 

pronto ja coloquei em spoiler.

if isPremium(cid) then
AUTO_LOOT_TAX = 25 -- Tax for using the service (in %) (min 0, max 100)
AUTO_LOOT_BANK = true -- Will the money go to the bank? If false, the money will go to the player
AUTO_LOOT_STORAGE = 38199 -- Storage of the status of the Auto Loot
 
function findItemsInContainer(ids, container)
    local items_found = {}
    local v_uids = {}
    for i = 0, getContainerSize(container)-1 do
        container_item = getContainerItem(container, i)
        if isContainer(container_item.uid) then
            local container_recursive = findItemsInContainer(ids, container_item.uid)
            for a, b in ipairs(container_recursive) do
                if not isInArray(v_uids, b.uid) then
                    table.insert(v_uids, container_item.uid)
                    table.insert(items_found, b)
                end
            end
        end
        if isInArray(ids, container_item.itemid) and not isInArray(v_uids, container_item.uid) then
            table.insert(v_uids, container_item.uid)
            table.insert(items_found, container_item)
        end
    end
    return items_found
end
 
function executeAutoLoot(cid, pos, target_name)
    AUTO_LOOT_TAX = AUTO_LOOT_TAX > 100 and 100 or AUTO_LOOT_TAX < 0 and 0 or AUTO_LOOT_TAX
    local corpse = getTileItemByType(pos, ITEM_TYPE_CONTAINER).uid
    local total_count = 0
    for a, b in ipairs(findItemsInContainer({ITEM_GOLD_COIN, ITEM_PLATINUM_COIN, ITEM_CRYSTAL_COIN}, corpse)) do
        if b.itemid == ITEM_CRYSTAL_COIN then
            total_count = total_count+b.type*10000
        elseif b.itemid == ITEM_PLATINUM_COIN then
            total_count = total_count+b.type*100
        elseif b.itemid == ITEM_GOLD_COIN then
            total_count = total_count+b.type
        end
        doRemoveItem(b.uid, b.type)
    end
    if AUTO_LOOT_BANK then
        doPlayerSetBalance(cid, getPlayerBalance(cid)+math.ceil(total_count*(1-AUTO_LOOT_TAX/100)))
    else
        doPlayerAddMoney(cid, math.ceil(total_count*(1-AUTO_LOOT_TAX/100)))
    end
    if total_count > 0 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Money collected from "..target_name..": "..total_count.." gold coins."..(AUTO_LOOT_TAX > 0 and " Tax ("..AUTO_LOOT_TAX.."%) discounted: "..math.floor(total_count*(AUTO_LOOT_TAX/100)).." gold coins." or " No tax."))
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Total collected: "..math.ceil(total_count*(1-AUTO_LOOT_TAX/100)).." gold coins.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "No money collected from "..target_name..".")
    end
end
    return true
end

Tente ai e me avisa se funcionou.

                                          King is Back !                                  Está vendo esse coraçãozinho? Dar um Voto Positivo?                                                                                                                                                                                                       clica ali se eu te ajudei muito. Obrigado !

 

[Tutorial] Colocando sua senha no novo XAMPP

[Tutorial] Como compilar tfs 1.2 no Visual Studio 2015

------------------------------------------

  • Contato:

                    Discord: Lirosz#6563

                      Ts3: 104.154.235.159

 

 

Postado
  • Autor

se eu colocar isso da esse erro aqui

 

[Error - TalkAction Interface]
data/talkactions/scripts/autoloot_talk.lua:onSay
Description:
data/talkactions/scripts/autoloot_talk.lua:1: attempt to concatenate global 'AUTO_LOOT_TAX' (a nil value)
stack traceback:
    data/talkactions/scripts/autoloot_talk.lua:1: in function <data/talkactions/scripts/autoloot_talk.lua:1>

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo