Postado Dezembro 14, 2018 6 anos Autor 1 hora atrás, Vodkart disse: entendi, faltou o "i" do for... vocês copiam o código e não colocam no code box, ai induz ao erro mesmo. function onSay(cid, words, param) if param == '' or tonumber(param) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "/find item name") return true end local item_id = tonumber(param) if(not item_id) then item_id = getItemIdByName(tostring(param), false) if(not item_id) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.") return true end end local str, player_depotitems, players_items, tile_items = "",{},{},{} local dp = db.getResult("SELECT `player_id`, `count` FROM `player_depotitems` WHERE `itemtype` = "..item_id),{} if (dp:getID() ~= -1) then repeat player_depotitems[#player_depotitems+1] = {dp:getDataInt("player_id"), dp:getDataInt("count") } until not(dp:next()) dp:free() end local pi = db.getResult("SELECT `player_id`, `count` FROM `player_items` WHERE `itemtype` = "..item_id),{} if (pi:getID() ~= -1) then repeat players_items[#players_items+1] = {pi:getDataInt("player_id"), pi:getDataInt("count") } until not(pi:next()) pi:free() end local hi = db.getResult("SELECT `tile_id`, `count` FROM `tile_items` WHERE `itemtype` = "..item_id),{} if (hi:getID() ~= -1) then repeat local tile = db.getResult("SELECT `house_id`, `x`, `y`, `z` FROM `tiles` WHERE `id` = "..hi:getDataInt("tile_id")),{} tile_items[#tile_items+1] = {tile:getDataInt("house_id"),tile:getDataInt("x"),tile:getDataInt("y"),tile:getDataInt("z")} until not(hi:next()) hi:free() end if #player_depotitems > 0 then str = str .. "#DEPOT ITEMS#\nQuantidade - Jogador\n" for i = 1, table.maxn(player_depotitems) do local name = getPlayerNameByGUID(player_depotitems[i][1]) local target_online = getPlayerByNameWildcard(name) str = str .. player_depotitems[i][2] .. ' ' .. name ..' | '..(not isPlayer(target_online) and 'Offline' or 'Online')..'\n' end end if #players_items > 0 then str = str .. (str ~= "" and "--------------//-------------\n\n#PLAYER ITEMS#\nQuantidade - Jogador\n" or "#PLAYER ITEMS#\nQuantidade - Jogador\n") for i = 1, table.maxn(players_items) do local name = getPlayerNameByGUID(players_items[i][1]) local target_online = getPlayerByNameWildcard(name) str = str .. players_items[i][2] .. ' ' .. name ..' | '..(not isPlayer(target_online) and 'Offline' or 'Online')..'\n' end end if #tile_items > 0 then str = str .. (str ~= "" and "--------------//-------------\n\n#TILE ITEMS#\nHouse ID - Tile Position\n" or "#TILE ITEMS#\nHouse ID -Tile Position\n") for i = 1, table.maxn(tile_items) do str = str .. tile_items[i][1] .. ' - {x = ' .. tile_items[i][2] ..', y = ' .. tile_items[i][3] ..', z = ' .. tile_items[i][4] ..'} \n' end end return doShowTextDialog(cid,item_id, str) end Agora funcionou show. so faltou funcionar com o ID tbm. ta so pelo nome
Postado Dezembro 14, 2018 6 anos 4 horas atrás, Matheuus disse: Agora funcionou show. so faltou funcionar com o ID tbm. ta so pelo nome Spoiler function onSay(cid, words, param) if param == '' then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "/find item name") return true end local item_id = tonumber(param) if(not item_id) then item_id = getItemIdByName(tostring(param), false) if(not item_id) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.") return true end end local str, player_depotitems, players_items, tile_items = "",{},{},{} local dp = db.getResult("SELECT `player_id`, `count` FROM `player_depotitems` WHERE `itemtype` = "..item_id),{} if (dp:getID() ~= -1) then repeat player_depotitems[#player_depotitems+1] = {dp:getDataInt("player_id"), dp:getDataInt("count") } until not(dp:next()) dp:free() end local pi = db.getResult("SELECT `player_id`, `count` FROM `player_items` WHERE `itemtype` = "..item_id),{} if (pi:getID() ~= -1) then repeat players_items[#players_items+1] = {pi:getDataInt("player_id"), pi:getDataInt("count") } until not(pi:next()) pi:free() end local hi = db.getResult("SELECT `tile_id`, `count` FROM `tile_items` WHERE `itemtype` = "..item_id),{} if (hi:getID() ~= -1) then repeat local tile = db.getResult("SELECT `house_id`, `x`, `y`, `z` FROM `tiles` WHERE `id` = "..hi:getDataInt("tile_id")),{} tile_items[#tile_items+1] = {tile:getDataInt("house_id"),tile:getDataInt("x"),tile:getDataInt("y"),tile:getDataInt("z")} until not(hi:next()) hi:free() end if #player_depotitems > 0 then str = str .. "#DEPOT ITEMS#\nQuantidade - Jogador\n" for i = 1, table.maxn(player_depotitems) do local name = getPlayerNameByGUID(player_depotitems[i][1]) local target_online = getPlayerByNameWildcard(name) str = str .. player_depotitems[i][2] .. ' ' .. name ..' | '..(not isPlayer(target_online) and 'Offline' or 'Online')..'\n' end end if #players_items > 0 then str = str .. (str ~= "" and "--------------//-------------\n\n#PLAYER ITEMS#\nQuantidade - Jogador\n" or "#PLAYER ITEMS#\nQuantidade - Jogador\n") for i = 1, table.maxn(players_items) do local name = getPlayerNameByGUID(players_items[i][1]) local target_online = getPlayerByNameWildcard(name) str = str .. players_items[i][2] .. ' ' .. name ..' | '..(not isPlayer(target_online) and 'Offline' or 'Online')..'\n' end end if #tile_items > 0 then str = str .. (str ~= "" and "--------------//-------------\n\n#TILE ITEMS#\nHouse ID - Tile Position\n" or "#TILE ITEMS#\nHouse ID -Tile Position\n") for i = 1, table.maxn(tile_items) do str = str .. tile_items[i][1] .. ' - {x = ' .. tile_items[i][2] ..', y = ' .. tile_items[i][3] ..', z = ' .. tile_items[i][4] ..'} \n' end else str = str .. (str ~= "" and "" or "O item não foi encontrado em nenhum jogador.") end return doShowTextDialog(cid,item_id, str) end Acho que agora vai! Como o Vodkart teve que pegar o script original por causa do code box ele esqueceu de alterar uma parte. Aproveitei e adicionei a msg caso o item não seja encontrado. Editado Dezembro 14, 2018 6 anos por Yan Liima (veja o histórico de edições) ╔══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ══════════════════════════╗ Te Ajudei? Rep + e ficamos Quits Precisando de ajuda? Discord: Yan Liima #3702 Programador Júnior de LUA, PHP e JavaScript Juntos somos lendas, separados somos Mitos! ╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝
Postado Dezembro 14, 2018 6 anos 17 minutos atrás, Matheuus disse: Agora funcionou show. so faltou funcionar com o ID tbm. ta so pelo nome Já está pelo ID também, olha: local item_id = tonumber(param) if(not item_id) then item_id = getItemIdByName(tostring(param), false) if(not item_id) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.") return true end end o seu servidor é otx? [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Dezembro 14, 2018 6 anos Autor 1 minuto atrás, Vodkart disse: Já está pelo ID também, olha: local item_id = tonumber(param) if(not item_id) then item_id = getItemIdByName(tostring(param), false) if(not item_id) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.") return true end end Nao estava indo, mas nem dava erro tbm 6 minutos atrás, Yan Liima disse: Mostrar conteúdo oculto function onSay(cid, words, param) if param == '' then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "/find item name") return true end local item_id = tonumber(param) if(not item_id) then item_id = getItemIdByName(tostring(param), false) if(not item_id) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.") return true end end local str, player_depotitems, players_items, tile_items = "",{},{},{} local dp = db.getResult("SELECT `player_id`, `count` FROM `player_depotitems` WHERE `itemtype` = "..item_id),{} if (dp:getID() ~= -1) then repeat player_depotitems[#player_depotitems+1] = {dp:getDataInt("player_id"), dp:getDataInt("count") } until not(dp:next()) dp:free() end local pi = db.getResult("SELECT `player_id`, `count` FROM `player_items` WHERE `itemtype` = "..item_id),{} if (pi:getID() ~= -1) then repeat players_items[#players_items+1] = {pi:getDataInt("player_id"), pi:getDataInt("count") } until not(pi:next()) pi:free() end local hi = db.getResult("SELECT `tile_id`, `count` FROM `tile_items` WHERE `itemtype` = "..item_id),{} if (hi:getID() ~= -1) then repeat local tile = db.getResult("SELECT `house_id`, `x`, `y`, `z` FROM `tiles` WHERE `id` = "..hi:getDataInt("tile_id")),{} tile_items[#tile_items+1] = {tile:getDataInt("house_id"),tile:getDataInt("x"),tile:getDataInt("y"),tile:getDataInt("z")} until not(hi:next()) hi:free() end if #player_depotitems > 0 then str = str .. "#DEPOT ITEMS#\nQuantidade - Jogador\n" for i = 1, table.maxn(player_depotitems) do local name = getPlayerNameByGUID(player_depotitems[i][1]) local target_online = getPlayerByNameWildcard(name) str = str .. player_depotitems[i][2] .. ' ' .. name ..' | '..(not isPlayer(target_online) and 'Offline' or 'Online')..'\n' end end if #players_items > 0 then str = str .. (str ~= "" and "--------------//-------------\n\n#PLAYER ITEMS#\nQuantidade - Jogador\n" or "#PLAYER ITEMS#\nQuantidade - Jogador\n") for i = 1, table.maxn(players_items) do local name = getPlayerNameByGUID(players_items[i][1]) local target_online = getPlayerByNameWildcard(name) str = str .. players_items[i][2] .. ' ' .. name ..' | '..(not isPlayer(target_online) and 'Offline' or 'Online')..'\n' end else str = str .. "O item não foi encontrado em nenhum jogador." end if #tile_items > 0 then str = str .. (str ~= "" and "--------------//-------------\n\n#TILE ITEMS#\nHouse ID - Tile Position\n" or "#TILE ITEMS#\nHouse ID -Tile Position\n") for i = 1, table.maxn(tile_items) do str = str .. tile_items[i][1] .. ' - {x = ' .. tile_items[i][2] ..', y = ' .. tile_items[i][3] ..', z = ' .. tile_items[i][4] ..'} \n' end end return doShowTextDialog(cid,item_id, str) end Acho que agora vai! Como o Vodkart teve que pegar o script original por causa do code box ele esqueceu de alterar uma parte. Aproveitei e adicionei a msg caso o item não seja encontrado. Deu certooo vlwwws vcs sao de mais. Pra quem dou melhor resposta?
Postado Dezembro 14, 2018 6 anos Agora, Matheuus disse: Nao estava indo, mas nem dava erro tbm Deu certooo vlwwws vcs sao de mais. Pra quem dou melhor resposta? Pro Vod né irmão, o merito é dele kkkk Aproveitando aqui, @Vodkart responde mensagem. ╔══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ══════════════════════════╗ Te Ajudei? Rep + e ficamos Quits Precisando de ajuda? Discord: Yan Liima #3702 Programador Júnior de LUA, PHP e JavaScript Juntos somos lendas, separados somos Mitos! ╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝
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.