Postado Maio 24, 2015 10 anos 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
Postado Maio 24, 2015 10 anos 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 [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#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.