Ir para conteúdo

Featured Replies

Postado
  • Autor

Obrigado !! Poderia me ajudar tbm nesse script... ele só cria item pelo id, pelo nome não cria dá erro

 

function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você deve digitar /i nome do item, quantidade(opcional, se for stackable criara 100).")
return true
end
 
local t = string.explode(param, ",")
local ret = RETURNVALUE_NOERROR
local pos = getCreaturePosition(cid)
local allowedPlayers = {"[ADM] Castiel", "[GOD] Dean"}
local blockedIds = {2150, 2159}
local arq = 'createItemLogs.txt'
local file = io.open("data/logs/".. arq, "a")
 
 
 
local id = tonumber(t[1])
if(not id) then
id = getItemIdByName(t[1], false)
if(not id) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Esse item não existe.")
return true
end
end
 
if isInArray(blockedIds, tonumber(t[1])) and not isInArray(allowedPlayers, getCreatureName(cid)) then
doPlayerSendTextMessage(cid, 27, "Você não pode criar este item um registro foi mandado para o hoster.")
file:write("[" .. os.date("%d %B %Y %X ", os.time()) .. "] " .. getCreatureName(cid) .. " tentou criar um item proibido ID(" .. t[1] .. ")\n") return true
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, "Não foi possível adicionar o 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:
(LuaInterface::luaGetItemIdByName) Item not found
  • Respostas 11
  • Visualizações 854
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local items = {{itemid, count}, {itemid, count}, {itemid, count}, ...}     --{{ID_do_item, quantia_requerida}, {ID_do_item, quantia_requerida}, ...} function onSay(cid)     local str = ""     for _, i

  • local items = {{itemid, count}, {itemid, count}, {itemid, count}, ...}     --{{ID_do_item, quantia_requerida}, {ID_do_item, quantia_requerida}, ...} function onSay(cid)     local str = ""     for _, i

  • function ExistItemByName(name) -- by vodka local items = io.open("data/items/items.xml", "r"):read("*all") local get = items:match('name="' .. name ..'"') if get == nil or get == "" then return false

Postado

function ExistItemByName(name) -- by vodka
local items = io.open("data/items/items.xml", "r"):read("*all")
local get = items:match('name="' .. name ..'"')
if get == nil or get == "" then
return false
end
return true
end 
function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você deve digitar /i nome do item, quantidade(opcional, se for stackable criara 100).")
return true
end
local t = string.explode(param, ",")
local ret = RETURNVALUE_NOERROR
local pos = getCreaturePosition(cid)
local allowedPlayers = {"[ADM] Castiel", "[GOD] Dean"}
local blockedIds = {2150, 2159}
local arq = 'createItemLogs.txt'
local file = io.open("data/logs/".. arq, "a")
local id = tonumber(t[1])
if(not id) then
if not ExistItemByName(t[1]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Esse item não existe.")
return true
end
end 
if isInArray(blockedIds, tonumber(t[1])) and not isInArray(allowedPlayers, getCreatureName(cid)) then
doPlayerSendTextMessage(cid, 27, "Você não pode criar este item um registro foi mandado para o hoster.")
file:write("[" .. os.date("%d %B %Y %X ", os.time()) .. "] " .. getCreatureName(cid) .. " tentou criar um item proibido ID(" .. t[1] .. ")\n") return true
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, "Não foi possível adicionar o item: " .. t[1])
return true
end
 
doDecayItem(item)
if(not isPlayerGhost(cid)) then
doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
end
 
return true
end

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

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