Ir para conteúdo

Featured Replies

Resolvido por Wakon

Ir para solução
Postado
  • Solução

Troque pelo seu createitem:

local items = {2160, 2161, 2162, 2163} -- Aqui você coloca os items permitidos.

function onSay(cid, words, param, channel)
    if getPlayerStorageValue(cid, 9909) < 1 then
        return doPlayerSendCancel(cid, "Você não tem permissão para usar este comando.") and true
    end
	
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
       return true
    end

    local t = string.explode(param, ",")
    local ret = RETURNVALUE_NOERROR
    local pos = getCreaturePosition(cid)

    if t[1] == "list" then    
        local str, n = "Items permitidos:\n\n", ""
        for v, k in pairs(items) do
            n = getItemNameById(k)
            str = str.."".. k .." - ".. n .."\n"
        end
       return doShowTextDialog(cid, 1950, str)
    end

    local id = tonumber(t[1])
    if(not id) then
        id = getItemIdByName(t[1], false)
        if(not id) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
           return true
        end
    end

    if not isInArray(items, id) then
        return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode criar este item, para ver a lista de items permitidos digite: /i list")
    end

    local amount = 100
    if(t[2]) then
        amount = t[2]
    end

    local item = doCreateItemEx(id, amount)
    if(t[3] and getBooleanFromString(t[3])) then
        if(t[4] and getBooleanFromString(t[4])) then
            pos = getCreatureLookPosition(cid)
        end
        ret = doTileAddItemEx(pos, item)
    else	
        ret = doPlayerAddItemEx(cid, item, true)
    end

    if(ret ~= RETURNVALUE_NOERROR) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1])
       return true
    end

    doDecayItem(item)
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
    end
   return true
end

Adicionei também uma lista dos items permitidos, basta digitar /i list.

Se der algum problema, me avise.

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.7k

Informação Importante

Confirmação de Termo