Ir para conteúdo
  • Cadastre-se

(Resolvido)Proibir adm criar x item no /i


Ir para solução Resolvido por Storm,

Posts Recomendados

bom dia galerinha do tk

 

gostaria de saber se tem como colocar restriçao de items no comando /i de adm

 

por exemplo proibir criar o item de id 11192 e 2090??

 

script 

function onSay(cid, words, param, channel)
    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)

    local id = tonumber(t[1])
    if(not id) then
        errors(false)
        id = getItemIdByName(t[1])
        errors(true)

        if(not id) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item with such name does not exists.")
            return true
        end
    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
 


 

 

 

Link para o post
Compartilhar em outros sites
  • Solução
local block = {11192, 2090} -- Coloque aqui os itens bloqueados

function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end
    
    if isInArray(block, tonumber(t[1])) then
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce não pode criar esses itens")
       return true
    end

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

    local id = tonumber(t[1])
    if(not id) then
        errors(false)
        id = getItemIdByName(t[1])
        errors(true)

        if(not id) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item with such name does not exists.")
            return true
        end
    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

 

Link para o post
Compartilhar em outros sites
  • 4 weeks later...
Em 01/06/2018 em 11:22, Sttorm disse:

local block = {11192, 2090} -- Coloque aqui os itens bloqueados

function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end
    
    if isInArray(block, tonumber(t[1])) then
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce não pode criar esses itens")
       return true
    end

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

    local id = tonumber(t[1])
    if(not id) then
        errors(false)
        id = getItemIdByName(t[1])
        errors(true)

        if(not id) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item with such name does not exists.")
            return true
        end
    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

 

[Error - TalkAction Interface]
data/talkactions/scripts/createitem.lua:onSay
Description:
data/talkactions/scripts/createitem.lua:9: attempt to index global 't' (a nil value)
stack traceback:
        data/talkactions/scripts/createitem.lua:9: in function <data/talkactions/scripts/createitem.lua:3>

 

deu esse erro pode ajudar @Sttorm

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Estatísticas dos Fóruns

    96830
    Tópicos
    519567
    Posts
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo