Postado Fevereiro 5, 2016 9 anos @Absolute tenho um ot serv que já possui o shop, inclusive já esta vendendo tem algum tempo, porém ou reseta-lo todo para incluir seu sistema! Segue minhas dúvidas: Pra eu resetar meu shop é preciso zerar a database dele, ou deletar os itens através do site? (shop admin) Como incluo essa "KEY" ? Com o sistema instalado, é preciso fazer algo diferente para adicionar um novo item ao shop?
Postado Fevereiro 7, 2016 9 anos Autor Em 05/02/2016 20:48:25, gmdouglas disse: @Absolute tenho um ot serv que já possui o shop, inclusive já esta vendendo tem algum tempo, porém ou reseta-lo todo para incluir seu sistema! Segue minhas dúvidas: Pra eu resetar meu shop é preciso zerar a database dele, ou deletar os itens através do site? (shop admin) Como incluo essa "KEY" ? Com o sistema instalado, é preciso fazer algo diferente para adicionar um novo item ao shop? Bem Douglas, seguinte, o que adiciona a KEY é o arquivo do ot, o SHOP.lua então não há necessidade de alterar nada em PHP/no site, tanto é que o sistema procede apenas no ot/db, nada do site. Para usa-lo, seria necessário resetar todos os items VIP do servidor ou até mesmo o servidor, pois os que já foram disparados para as contas sem este SCRIPT não foram dados a KEY necessária ao item que é gravada no banco de dados, então ele reconheceria os já existentes como clonados por não possuir a KEY. O que você pode fazer também é adicionar a KEY por uma QUERY nos items já existentes, nos IDS dos items VIP's/disparados do seu SHOP.
Postado Fevereiro 8, 2016 9 anos Obrigado @Absolute! Irei instalar o sistema e deixar rodar daqui pra frente! REP +
Postado Fevereiro 13, 2016 9 anos @Absolute esse script não funciona no modern acc de jeito nenhum, o único que funciona no modern acc é esse, voce consegue alterar as linhas necessárias nele para funcionar o seu sistema? Meu shop.lua: function onThink(interval, lastExecution, thinkInterval) local result = db.getResult("SELECT * FROM shop_history WHERE `processed` = 0;") if(result:getID() ~= -1) then while(true) do cid = getCreatureByName(tostring(result:getDataString("player"))) product = tonumber(result:getDataInt("product")) itemr = db.getResult("SELECT * FROM shop_offer WHERE `id` = "..product..";") if isPlayer(cid) then local id = tonumber(itemr:getDataInt("item")) local tid = tonumber(result:getDataInt("id")) local count = tonumber(itemr:getDataInt("count")) local tipe = tonumber(itemr:getDataInt("type")) local productn = tostring(itemr:getDataString("name")) if isInArray({5,8},tipe) then if getPlayerFreeCap(cid) >= getItemWeightById(id, count) then if isContainer(getPlayerSlotItem(cid, 3).uid) then received = doAddContainerItem(getPlayerSlotItem(cid, 3).uid, id,count) if received then doPlayerSendTextMessage(cid,19, "Voce recebeu >> "..productn.." << do shop") db.query("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";") else doPlayerSendTextMessage(cid,19, "Desculpe voce nao tem espaco para receber >> "..productn.." <<") end else doPlayerSendTextMessage(cid,19, "Voce nao tem uma backpack para receber >> "..productn.." <<") end else doPlayerSendTextMessage(cid,19, "Voce nao tem cap suficiente >> "..productn.." << (Precisa de: "..getItemWeightById(id, count).." Cap)") end elseif isInArray({6,7},tipe) then if tipe == 6 then bcap = 8 bid = 1987 elseif tipe == 7 then bcap = 20 bid = 1988 end if isItemRune(id) then count = 1 end if getPlayerFreeCap(cid) >= (getItemWeightById(1987, 1) + getItemWeightById(id,count * bcap)) then local bag = doCreateItemEx(bid, 1) for i = 1,bcap do doAddContainerItem(bag, id, count) end received = doPlayerAddItemEx(getPlayerSlotItem(cid, 3).uid, bag) if received == RETURNVALUE_NOERROR then doPlayerSendTextMessage(cid,19, "Voce recebeu >> "..productn.." << do shop") db.query("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";") else doPlayerSendTextMessage(cid,19, "Voce nao tem espaco para receber libere alguns itens >> "..productn.." <<") end else doPlayerSendTextMessage(cid,19, "Voce nao tem capacidade para receber >> "..productn.." << (Precisa de: "..getItemWeightById(id, count).." Cap)") end end end if not(result:next()) then break end end end return true end Editado Fevereiro 13, 2016 9 anos por One Punch Man (veja o histórico de edições)
Postado Fevereiro 14, 2016 9 anos Autor Em 13/02/2016 00:09:32, One Punch Man disse: @Absolute esse script não funciona no modern acc de jeito nenhum, o único que funciona no modern acc é esse, voce consegue alterar as linhas necessárias nele para funcionar o seu sistema? Meu shop.lua: function onThink(interval, lastExecution, thinkInterval) local result = db.getResult("SELECT * FROM shop_history WHERE `processed` = 0;") if(result:getID() ~= -1) then while(true) do cid = getCreatureByName(tostring(result:getDataString("player"))) product = tonumber(result:getDataInt("product")) itemr = db.getResult("SELECT * FROM shop_offer WHERE `id` = "..product..";") if isPlayer(cid) then local id = tonumber(itemr:getDataInt("item")) local tid = tonumber(result:getDataInt("id")) local count = tonumber(itemr:getDataInt("count")) local tipe = tonumber(itemr:getDataInt("type")) local productn = tostring(itemr:getDataString("name")) if isInArray({5,8},tipe) then if getPlayerFreeCap(cid) >= getItemWeightById(id, count) then if isContainer(getPlayerSlotItem(cid, 3).uid) then received = doAddContainerItem(getPlayerSlotItem(cid, 3).uid, id,count) if received then doPlayerSendTextMessage(cid,19, "Voce recebeu >> "..productn.." << do shop") db.query("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";") else doPlayerSendTextMessage(cid,19, "Desculpe voce nao tem espaco para receber >> "..productn.." <<") end else doPlayerSendTextMessage(cid,19, "Voce nao tem uma backpack para receber >> "..productn.." <<") end else doPlayerSendTextMessage(cid,19, "Voce nao tem cap suficiente >> "..productn.." << (Precisa de: "..getItemWeightById(id, count).." Cap)") end elseif isInArray({6,7},tipe) then if tipe == 6 then bcap = 8 bid = 1987 elseif tipe == 7 then bcap = 20 bid = 1988 end if isItemRune(id) then count = 1 end if getPlayerFreeCap(cid) >= (getItemWeightById(1987, 1) + getItemWeightById(id,count * bcap)) then local bag = doCreateItemEx(bid, 1) for i = 1,bcap do doAddContainerItem(bag, id, count) end received = doPlayerAddItemEx(getPlayerSlotItem(cid, 3).uid, bag) if received == RETURNVALUE_NOERROR then doPlayerSendTextMessage(cid,19, "Voce recebeu >> "..productn.." << do shop") db.query("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";") else doPlayerSendTextMessage(cid,19, "Voce nao tem espaco para receber libere alguns itens >> "..productn.." <<") end else doPlayerSendTextMessage(cid,19, "Voce nao tem capacidade para receber >> "..productn.." << (Precisa de: "..getItemWeightById(id, count).." Cap)") end end end if not(result:next()) then break end end end return true end Você só vai precisar adicionar no seu shop a função do item atribute que vai nomear os items que disparam do seu shop e fazem a checagem.
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.