Postado Outubro 1, 2017 7 anos Testado com o Geisor ACC 2012 + TFS 0.4(8.6) funcionou perfeitamente, porem só tive que omitir o case do index.php: case "tradeoff"; $topic = "Trade Off"; $subtopic = "tradeoff"; include("tradeoff.php"); break; para isso: //case "tradeoff"; $topic = "Trade Off"; $subtopic = "tradeoff"; include("tradeoff.php"); break; Muito Obrigado por compartilhar isso!
Postado Março 23, 2018 7 anos Ôtimo script do King Natan, para os que não conseguiram por imagem é simples, basta alocar no script para a pasta images/items/ do seu site.
Postado Abril 16, 2018 7 anos Em 25/05/2014 em 20:44, Natanael Beckman disse: CREATE TABLE `auction_system` ( `id` int(11) NOT NULL auto_increment, `player` int(11), `item_id` int(11), `item_name` varchar(255), `count` int(11), `cost` int(11), `date` int(11), PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; Esse código aqui está dando erro ao executar no bando de dados. Parece que essa última linha não passa. Alguma sugestão de como resolver?
Postado Julho 21, 2019 5 anos Fala galera tudo certinho? Eu sei que estou um pouco atrasado, e nem sei se posso estar ressuscitando esse tópico, mas eu notei que no 8.6 existem alguns pontos que podiam ser melhorados no script então eu dei uma atualizada aqui no meu e trouxe para compartilhar aqui com vocês. Citar local config = { levelRequiredToAdd = 1, maxOffersPerPlayer = 5, SendOffersOnlyInPZ = true, blocked_items = {2165, 2152, 2148, 2160, 2166, 2167, 2168, 2169, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2343, 2433, 2640, 6132, 6300, 6301, 9932, 9933} } function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este comando requer parametros.") return true end local t = string.explode(param, ",") if(t[1] == "add") then if((not t[2]) or (not t[3]) or (not t[4])) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este comando requer parametros.") return true end if(not tonumber(t[3]) or (not tonumber(t[4]))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce inseriu um preco ou uma quantidade de itens invalida.") return true end if(string.len(t[3]) > 9 or (string.len(t[4]) > 3)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O preco ou quantidade deste itens sao muito altos, o preco maximo pelo item eh de 999999999, e a quantidade maxima inserida eh de 3.") return true end local item = getItemIdByName(t[2]) if(not item) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O item com esse nome não existe.") return true end if(getPlayerLevel(cid) < config.levelRequiredToAdd) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem o level requerido (" .. config.levelRequiredToAdd .. ").") return true end if(isInArray(config.blocked_items, item)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este item eh bloqueado.") return true end if(getPlayerItemCount(cid, item) < (tonumber(t[4]))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem esse item.") return true end local check = db.getResult("SELECT `id` FROM `auction_system` WHERE `player` = " .. getPlayerGUID(cid) .. ";") if(check:getID() == -1) then elseif(check:getRows(true) >= config.maxOffersPerPlayer) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode adicionar mais ofertas, maximo de: " .. config.maxOffersPerPlayer) return true end if(config.SendOffersOnlyInPZ) then if(not getTilePzInfo(getPlayerPosition(cid))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Precisa estar em Zona de Protecao (PZ) para fazer oferta.") return true end end if(tonumber(t[4]) < 1 or (tonumber(t[3]) < 1)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O preco ou numero tem que ser maiores que 0.") return true end local itemcount, costgp = math.floor(t[4]), math.floor(t[3]) doPlayerRemoveItem(cid, item, itemcount) db.executeQuery("INSERT INTO `auction_system` (`player`, `item_name`, `item_id`, `count`, `cost`, `date`) VALUES (" .. getPlayerGUID(cid) .. ", \"" .. t[2] .. "\", " .. getItemIdByName(t[2]) .. ", " .. itemcount .. ", " .. costgp ..", " .. os.time() .. ")") doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce adcionou " .. itemcount .." " .. t[2] ..", por " .. costgp .. " Gps.") end if(t[1] == "buy") then if(not tonumber(t[2])) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "ID invalido. Para verificar os ID's digite !offer list ou !offer list, nome do item.") return true end local buy = db.getResult("SELECT * FROM `auction_system` WHERE `id` = " .. (tonumber(t[2])) .. ";") if(buy:getID() ~= -1) then if(getPlayerMoney(cid) < buy:getDataInt("cost")) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao tem Gps suficientes.") buy:free() return true end if(getPlayerName(cid) == getPlayerNameByGUID(buy:getDataInt("player"))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce nao pode comprar seus proprios itens, mas pode remove-los digitando !offer remove, ID.") buy:free() return true end if(getPlayerFreeCap(cid) < getItemWeightById(buy:getDataInt("item_id"), buy:getDataInt("count")))then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce tentou comprar um " .. buy:getDataString("item_name") .. ". Que pesa " .. getItemWeightById(buy:getDataInt("item_id"), buy:getDataInt("count")) .. "oz. E voce tem apenas " .. getPlayerFreeCap(cid) .. "oz. Livre, alivie o peso antes de comprar.") buy:free() return true end if(isItemStackable((buy:getDataString("item_id")))) then doPlayerAddItem(cid, buy:getDataString("item_id"), buy:getDataInt("count")) else for i = 1, buy:getDataInt("count") do doPlayerAddItem(cid, buy:getDataString("item_id"), 1) end end doPlayerRemoveMoney(cid, buy:getDataInt("cost")) db.executeQuery("DELETE FROM `auction_system` WHERE `id` = " .. t[2] .. ";") doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce comprou " .. buy:getDataInt("count") .. " ".. buy:getDataString("item_name") .. " por " .. buy:getDataInt("cost") .. " Gps! Legal.") db.executeQuery("UPDATE `players` SET `auction_balance` = `auction_balance` + " .. buy:getDataInt("cost") .. " WHERE `id` = " .. buy:getDataInt("player") .. ";") buy:free() else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "ID invalido.") end end if(t[1] == "remove") then if((not tonumber(t[2]))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "ID invalido.") return true end if(config.SendOffersOnlyInPZ) then if(not getTilePzInfo(getPlayerPosition(cid))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce deve estar em Zona de Protecao (PZ) quando for remover seus itens.") return true end end local delete = db.getResult("SELECT * FROM `auction_system` WHERE `id` = " .. (tonumber(t[2])) .. ";") if(delete:getID() ~= -1) then if(getPlayerGUID(cid) == delete:getDataInt("player")) then db.executeQuery("DELETE FROM `auction_system` WHERE `id` = " .. t[2] .. ";") if(isItemStackable(delete:getDataString("item_id"))) then doPlayerAddItem(cid, delete:getDataString("item_id"), delete:getDataInt("count")) else for i = 1, delete:getDataInt("count") do doPlayerAddItem(cid, delete:getDataString("item_id"), 1) end end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce removeu sua oferta.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Esta oferta nao eh sua.") end delete:free() else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "ID invalido.") end end if(t[1] == "withdraw") then local balance = db.getResult("SELECT `auction_balance` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. ";") if(balance:getDataInt("auction_balance") < 1) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao tem dinheiro para retirar.") balance:free() return true end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce recebeu " .. balance:getDataInt("auction_balance") .. " gps do Trade Offline!") doPlayerAddMoney(cid, balance:getDataInt("auction_balance")) db.executeQuery("UPDATE `players` SET `auction_balance` = '0' WHERE `id` = " .. getPlayerGUID(cid) .. ";") balance:free() end --[[ Tentativa de listar os itens sem o gesior ]] if(t[1] == "list" and (not t[2])) then local result = db.getResult("SELECT * FROM `auction_system` ORDER BY `auction_system`.`id` DESC") if result:getID() == -1 then return true end --[[local msg = "+-----------+\n" .. "| Trade Offline: |\n" .. "+-----------+\n\n" ]] local msg = "" local counter = 0 while true do local id = result:getDataString("id") local name = getPlayerNameByGUID(result:getDataString("player")) local item_name = getItemNameById(result:getDataString("item_id")) local count = result:getDataString("count") local custo = result:getDataString("cost")/1000 local custo2 = result:getDataString("cost") --[[if isPlayer(cid) then msg = ""..msg.."ID: "..id.." -Item: "..item_name.." -Quantidade: "..count.." -Preco: "..custo.."k("..custo2.."GP) -Dono: "..name.."\n" end ]] if isPlayer(cid) then msg = "" ..msg.. "ID: " ..id.. " " ..item_name.. " Preco: " ..custo2.. "GP\n" end if not result:next() then break end if(counter==39) then break end counter = counter + 1; end --doPlayerPopupFYI(cid, msg) return true doShowTextDialog(cid, 2175, msg) end if(t[1] == "list" and t[2] ~= nil) then local item = getItemIdByName(t[2]) if(not item) then doMutePlayer(cid, 10) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O item com esse nome nao existe, voce sera mutado por 10 segundos. Tenha atencao ao digitar o nome do item.") return true end local result = db.getResult("SELECT * FROM `auction_system` where `auction_system`.`item_id`=" ..item.. " ORDER BY `auction_system`.`cost` ASC") if result:getID() == -1 then return true end local msg = "+-----------+\n" .. "| Trade Offline: |\n" .. "+-----------+\n\n" local msg = "" local counter = 0 while true do local id = result:getDataString("id") local name = getPlayerNameByGUID(result:getDataString("player")) local item_name = getItemNameById(result:getDataString("item_id")) local count = result:getDataString("count") local custo = result:getDataString("cost")/1000 local custo2 = result:getDataString("cost") if isPlayer(cid) then msg = ""..msg.."ID: "..id.." -Item: "..item_name.." -Quantidade: "..count.." -Preco: "..custo.."k("..custo2.."GP) -Dono: "..name.."\n" end --[[ if isPlayer(cid) then msg = "" ..msg.. "ID: " ..id.. " " ..item_name.. " Preco: " ..custo2.. "GP\n" end ]] if not result:next() then break end if(counter==9) then break end counter = counter + 1; end doPlayerPopupFYI(cid, msg) return true end --[[ Fim da listagem sem o Gesior ]] if(t[1] == "my") then local result = db.getResult("SELECT `auction_system`.* FROM `auction_system` JOIN `players` WHERE `auction_system`.`player` = `players`.`id` AND `players`.`name` = '"..getPlayerName(cid).."'") if result:getID() == -1 then doPlayerPopupFYI(cid, getPlayerName(cid)) return true end local msg = "+----------------+\n" .. "| Suas ofertas no trade: |\n" .. "+----------------+\n\n" local counter = 0 while true do local id = result:getDataString("id") local name = getPlayerNameByGUID(result:getDataString("player")) local item_name = getItemNameById(result:getDataString("item_id")) local count = result:getDataString("count") local custo = result:getDataString("cost") if isPlayer(cid) then msg = ""..msg.."ID: "..id.." -Item: "..item_name.." -Quantidade: "..count.." -Preco: "..custo.." GP\n" end --[[ if isPlayer(cid) then msg = "" ..msg.. "ID: " ..id.. " " ..item_name.. " Preco: " ..custo2.. "GP\n" end ]] if not result:next() then break end if(counter==9) then break end counter = counter + 1; end doPlayerPopupFYI(cid, msg) return true end if(t[1] == "info") then local msg = "+--------------------------------------------------+\n" .. "| !offer buy, ID - Compra uma oferta pelo ID\n" .. "| !offer remove, ID - Remove sua oferta pelo ID\m" .. "| !offer my - Lista suas ofertas atuais no Trade\n".. "| !offer add, NomeItem, PrecoItem, QuantidadeItem\n" .. "| !offer withdraw - Retira todo o dinheiro do Trade Offline\n" .. "| !offer list -- Mostra os ultimos 40 itens do Trade Offline\n" .. "| !offer list, NomeItem -- Mostra os 10 itens mais baratos pelo nome\n" .. "+--------------------------------------------------+\n" doPlayerPopupFYI(cid, msg) return true end return true end Agora quando o player disser: !offer my - Vai ser listado somente as coisas que ele colocou para negociar, assim fica mais fácil de remover. !offer info - Vai mostrar as opções e como utilizar os comandos. !offer list, NomeItem - Vai mostrar os 10 itens mais baratos pelo nome que foi procurado. Lembrando que essa alteração no Script é válida apenas para pessoas que como eu não vão usar Web Site. Todos os avisos de retorno em caso de erro foram traduzidos para português também, fiz isso pensando na galera que ainda não ta fera no inglês. Bom sem mais, só gostaria de pedir uma ajuda com o método: getItemNameById() Alguém saberia me dizer como evitar que ele retorne um erro no Console do Ot server caso alguém digite o nome de um item errado? A solução paliativa que eu coloquei para evitar que ficasse imprimindo muitos erros no console, foi dar um mute de 10 segundos no jogador que digita-se o nome do item errado. Valeu ai, obrigado ? ..:: Novos horizontes estão a caminho ::.. "É com um enaltecer maduro que vejo essa comunidade como uma grande família em que posso confiar e contar. Mantenhamos vivo o modelo Open Tibia Server para futuras gerações. Para que novos entretenimentos como esse RPG surjam e cresçam." "Nunca esqueçam que os momentos bons não são eternos, eles vêm o aproveitamos e ele se vai. Dessa mesma maneira são os momentos ruins, eles vêm o enfrentamos e ele se vai. Não se deixe abater pelas adversidades ou dificuldades, lute, enfrente e conquiste. Não espere que alguém o guie sempre pela mão." Dev Helpers Raythan - Ishikawa
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.