Ir para conteúdo

Pesquisar na Comunidade

Mostrando resultados para as tags ''trade a distancia''.



Mais opções de pesquisa

  • Pesquisar por Tags

    Digite tags separadas por vírgulas
  • Pesquisar por Autor

Tipo de Conteúdo


Fóruns

  • A Cidade OTBR
    • OTServ Brasil
    • Atendimento
    • Taverna
  • Projetos Open Source
    • Canary
    • OTServBR-Global
    • Mehah OTClient
    • MyAAC
  • OpenTibia
    • Notícias e Discussões
    • Suporte - Dúvidas, Bugs, Erros
    • Downloads
    • Tutoriais
    • Show-Off
  • Outros
    • Design

Encontrado 1 registro

  1. Trade List System

    Informações = { Nome = Trade List System Autor = Mock, Dean(reformulação do script) Versão testada = TFS 0.3.5 } Informações A algum tempo atrás(1 ano +/-) o Mock havia postado um script assim, porém ele já é antigo e não sei se functiona nos servers novos. O script permite que você compre ou venda itens, sem estar perto do player ou até mesmo offline! Comandos /sell item name,price = Adiciona o item à lista com o preço escolhido. /buy trade id = Compra o item, trade id é o número da venda, que está na lista. /offers = Mostar uma lista com todos os itens à venda. /search item name = Semelhante ao /offers, porém mostra a lista apenas com o item escolhido. /stop trade id = Para a venda, o item é devolvido automaticamente ao player. Script Crie um arquivo chamado trade.lua na pasta talkactions/scripts e adicione isso dentro: function onSay(cid,words,param) list = "Id Player Item Money" if param == "info" then return doPlayerPopupFYI(cid,"Comandos:\n/sell itemname,price\n/offers\n/search\n/buy tradeid\n/stop tradeid") end if words == "/sell" then local t = db.getResult("SELECT `tradeid`,`player`,`itemid`,`money` FROM `trade` ORDER BY `tradeid` DESC LIMIT 100;") local itemname,price = param:match('(.-),%s*(.+)') local item = getItemIdByName(itemname) if t:getID() ~= -1 then v = t:getDataInt("tradeid") else v = 0 end if doPlayerRemoveItem(cid,item,1) then return db.executeQuery("INSERT INTO `trade` (`tradeid`, `player`, `itemid`, `money`) VALUES ("..v.."+1,"..getPlayerGUID(cid)..","..item..","..price..");") end return doPlayerSendTextMessage(cid,22,"Você não tem essa quantidade do item") end if words == "/buy" then local j = db.getResult("SELECT `tradeid`,`player`,`itemid`,`money` FROM `trade` WHERE `tradeid` = "..param.." LIMIT 100;") if doPlayerRemoveMoney(cid,j:getDataInt("money")) then doPlayerAddItem(cid,j:getDataInt("itemid")) if isOnline(getPlayerNameByGUID(j:getDataInt("player"))) then doPlayerAddMoney(getPlayerByName(getPlayerNameByGUID(j:getDataInt("player"))),j:getDataInt("money")) else db.executeQuery("UPDATE `players` SET `moneytoreceive` = "..j:getDataInt("money").." WHERE `players`.`id` ="..j:getDataInt("player").." LIMIT 1 ;") end return db.executeQuery("DELETE FROM `trade` WHERE `trade`.`tradeid` = "..param.." LIMIT 1;") end return doPlayerSendTextMessage(cid,22,"Você não possui essa quantia") end if words == "/offers" then local t = db.getResult("SELECT `tradeid`,`player`,`itemid`,`money` FROM `trade` ORDER BY `tradeid` DESC LIMIT 100;") if t:getID() ~= -1 then repeat list = list.."\n"..t:getDataInt("tradeid").." "..getPlayerNameByGUID(t:getDataString("player")).." "..getItemNameById(t:getDataInt("itemid")).." "..t:getDataInt("money").." gps" until not t:next() end return doPlayerPopupFYI(cid,list) end if words == "/search" then id = getItemIdByName(param, false) if (not id) then return doPlayerSendTextMessage(cid,22,"Esse item não existe.") end local t = db.getResult("SELECT `tradeid`,`player`,`itemid`,`money` FROM `trade` WHERE `itemid` = "..id..";") if t:getID() == -1 then return doPlayerSendTextMessage(cid,22,"O item procurado não está à venda") end repeat list = list.."\n"..t:getDataInt("tradeid").." "..getPlayerNameByGUID(t:getDataString("player")).." "..getItemNameById(t:getDataInt("itemid")).." "..t:getDataInt("money").." gps" until not t:next() return doPlayerPopupFYI(cid,list) end if words == "/stop" then local t = db.getResult("SELECT `tradeid`,`player`,`itemid`,`money` FROM `trade` ORDER BY `tradeid` DESC LIMIT 100;") repeat if tonumber(t:getDataInt("tradeid")) == tonumber(param) and tonumber(t:getDataInt("player")) == tonumber(getPlayerGUID(cid)) then doPlayerAddItem(cid,t:getDataInt("itemid")) return db.executeQuery("DELETE FROM `trade` WHERE `trade`.`tradeid` = "..t:getDataInt("tradeid").." LIMIT 1;") end until not t:next() end t:close() return TRUE end Adicione as seguintes tags em talkaction.xml: <talkaction words="/sell" event="script" value="trade.lua"/> <talkaction words="/offers" event="script" value="trade.lua"/> <talkaction words="/buy" event="script" value="trade.lua"/> <talkaction words="/search" event="script" value="trade.lua"/> <talkaction words="/stop" event="script" value="trade.lua"/> Crie um arquivo chamado trade.lua na pasta creaturescripts/scripts e adicione isso dentro: function onLogin(cid) local t = db.getResult("SELECT `moneytoreceive` FROM `players` WHERE `id` = "..getPlayerGUID(cid).." LIMIT 1;") if t:getDataInt("moneytoreceive") > 0 then return doPlayerAddMoney(cid,tonumber(t:getDataInt("moneytoreceive"))),doPlayerSendTextMessage(cid,22,"Um item seu foi comprado da trade list.Receba seu dinheiro"),db.executeQuery("UPDATE `players` SET `moneytoreceive` = 0 WHERE `players`.`id` ="..getPlayerGUID(cid).." LIMIT 1 ;") end t:close() return TRUE end Adicione a seguinte tag em creaturescripts.xml: <event type="login" name="Trade" script="trade.lua"/> Agora abra o arquivo creaturescripts/scripts/login.lua e adicione entes do último return TRUE: registerCreatureEvent(cid, "Trade") Você precisará da OTAL ou simplesmente coloque isso em lib/functions.lua ou arquivo semelhante: function isOnline(name)--by mock local players = getOnlinePlayers() name = string.lower(name) for i, player in ipairs(players) do player = string.lower(player) if name == player then return TRUE end end return FALSE end Para finalizar, execute a seguinte query no seu banco de dados mysql: CREATE TABLE `trade` ( `tradeid` INT NOT NULL , `player` INT NOT NULL , `itemid` INT NOT NULL , `money` INT NOT NULL ) ENGINE = MYISAM ;[font=Comic Sans MS][size=4][size=2][size=4][size=2][size=4][size=2] [/size][/size][/size][/size][/size][/size][/font]ALTER TABLE `players` ADD `moneytoreceive` INT NOT NULL Bom, é isso, espero que façam bom uso do script, se achar algum bug por favor avise. Esse script é exclusivo da OTnet, se encontrar em outro fórum por favor avise
×