Ir para conteúdo

Pesquisar na Comunidade

Mostrando resultados para as tags ''shopping system 1.0''.

  • Pesquisar por Tags

    Digite tags separadas por vírgulas
  • Pesquisar por Autor

Tipo de Conteúdo


Fóruns

  • xTibia - Notícias e Suporte
    • Regras
    • Noticias
    • Soluções
    • Projetos Patrocinados
    • Tutoriais para Iniciantes
    • Imprensa
  • OTServ
    • Notícias e Debates
    • OTServlist
    • Downloads
    • Recursos
    • Suporte
    • Pedidos
    • Show-Off
    • Tutoriais
  • OFF-Topic
    • Barzinho do Éks
    • Design
    • Informática

Encontrar resultados em...

Encontrar resultados que contenham...


Data de Criação

  • Início

    FIM


Data de Atualização

  • Início

    FIM


Filtrar pelo número de...

Data de Registro

  • Início

    FIM


Grupo


Sou

Encontrado 1 registro

  1. Ola galerinha do xtibiana. Vocês lembram do shopping system beta? Bem o shopping system beta foi um sistema criado por min a um tempinho. O link da versão beta é: http://www.xtibia.co...demo-by-caotic/ Os players podiam vender e comprar itens de forma rápida e pratica só que na versão demo ele tinha limitações então resolvi fazer a versão 1.0 com mais funções. Ele funciona da seguinte maneira: O player vende seu item no shopping depois outro player resolve ver o shopping e acaba comprando o item. Quando o player vendedor estiver online ele recebera a mensagem dizendo que o seu item foi vendido e ele recebera o money da compra. Na versão 1.0 do shopping system foi adicionado: Vamos a instalação. Primeiro execute estes comandos na sua database: CREATE TABLE "shop" ( "item" INT NOT NULL, "price" INT NOT NULL, "players" INT NOT NULL ); ALTER TABLE `players` ADD `shop` INT(15) NOT NULL DEFAULT 0 Agora va em lib e crie um arquivo lua chamado shop e coloque isto: function doPlayerAddItemInShop(cid, itemid, price) db.executeQuery("INSERT INTO `shop` VALUES (".. itemid ..", ".. price ..", ".. getPlayerGUID(cid) ..")") return true end function getItemPriceInShop(itemid) local shop = db.getResult("SELECT * FROM `shop` WHERE `item` = ".. itemid ..";") return shop:getDataInt("price") end function getItemPlayerInShop(itemid) local shop = db.getResult("SELECT * FROM `shop` WHERE `item` = ".. itemid ..";") return shop:getDataInt("players") end function getExistItemInShop(itemid) local shop = db.getResult("SELECT * FROM `shop` WHERE `item` = ".. itemid ..";") if shop:getID() ~= -1 then return true end return nil end function getExistItemPlayerInShop(player, itemid) local shop = db.getResult("SELECT * FROM `shop` WHERE `players` = ".. player .." and `item` = ".. itemid ..";") if shop:getID() ~= -1 then return true end return nil end function doPlayerBuyItemInShop(cid, itemid, player) doPlayerAddItem(cid, itemid) doPlayerRemoveMoney(cid, getItemPriceInShop(itemid)) db.executeQuery("UPDATE `players` SET `shop` = "..getItemPriceInShop(itemid).." WHERE `id` = "..getItemPlayerInShop(itemid)) db.executeQuery("DELETE FROM `shop` WHERE `players` = ".. player .." and `item` = ".. itemid ..";") end function getMoneyGainInShop(cid) local money = db.getResult("SELECT `shop` FROM `players` WHERE `id` = "..getPlayerGUID(cid)) return money:getDataInt("shop") end function setMoneyGainInShop(cid, money) db.executeQuery("UPDATE `players` SET `shop` = "..money.." WHERE `id` = "..getPlayerGUID(cid)) end function doShowListShop(cid) local item = db.getResult("SELECT * FROM `shop` WHERE `item` ORDER BY `price`") str = "Itens a venda no shopping:\n\n" if item:getID() == -1 then doShowTextDialog(cid, 1387, "Não ha itens disponiveis no shopping\n Não existe itens no shopping!") return true end while true do local list = item:getDataInt("item") local players = item:getDataInt("players") local price = item:getDataInt("price") local shops = "Itens em Shopping" local list = string.upper(getItemNameById(list)) local players = getPlayerNameByGUID(players) str = str .. list .. " -("..players..")- Preço ("..price..")]\n\n" if not item:next() then doShowTextDialog(cid, 1397, str) break end end end Agora vá em talkactions/script e crie um arquivo lua chamado list e coloque este codigo: function onSay(cid, words, param, channel) doShowListShop(cid) return true end Agora vá em talkactions denovo crie um arquivo lua chamado de shop e coloque isto: function onSay(cid, words, param, channel) if param == " " or param == "" or not param then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Coloque o id do item") end local t = string.explode(param, ",") if not t[1] then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Coloque o id do item") end if not t[2] then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Coloque o preço do item") end if(isNumeric(t[1])) then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Coloque o nome do item") end if not (isNumeric(t[2])) then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Coloque O PREÇO DO ITEM") end if not getItemIdByName(t[1], false) then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este item "..t[1].." não existe") end local item = getItemIdByName(t[1]) local price = t[2] if getPlayerItemCount(cid, item) < 1 then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não tem "..t[1].."") end if getExistItemPlayerInShop(getPlayerGUID(cid), item) then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você já pos este item no shop") end doPlayerRemoveItem(cid, item, 1) doPlayerAddItemInShop(cid, item, price) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você colocou no shopping o seu item "..t[1].."") return true end Agora continue em talkactions e crie um arquivo lua chamado de comprar e coloque isto: function onSay(cid, words, param, channel) if param == " " or param == "" or not param or isNumeric(param) then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Coloque o nome do item dizendo /compra(nome do item,nome do player)") end local t = string.explode(param, ",") if not getItemIdByName(t[1], false) then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este item "..t[1].." não existe") end local itemid = getItemIdByName(t[1]) local player = getPlayerGUIDByName(t[2]) if not getExistItemInShop(itemid) then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este item não existe no shopping") end if t[2] == " " or t[2] == "" or isNumeric(t[2]) then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Coloque o nome do vendendor dizendo /compra(nome do item,nome do player)") end if not doPlayerRemoveMoney(cid, getItemPriceInShop(itemid)) then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não tem "..getItemPriceInShop(itemid).." para comprar "..t[1].." do shopping") end if not player then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não existe nenhum item com o nome deste player.") end doPlayerBuyItemInShop(cid, itemid, player) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabens você comprou "..t[1].."") return true end Agora coloque estas tags em talkactions.xml: Agora vá em creaturescripts/scripts e crie um arquivo lua chamado de shop: function onThink(cid, interval) if getMoneyGainInShop(cid) > 0 then doPlayerAddMoney(cid, getMoneyGainInShop(cid)) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Seu itens foi vendidos você recebeu "..getMoneyGainInShop(cid).." money") setMoneyGainInShop(cid, 0) return true end return true end Registre o evento colocando em login.lua de creaturescripts e coloque isto antes do ultimo return: registerCreatureEvent(cid, "shop") Agora vá em creaturescrips.xml e coloque esta tag: E prontinho sistema instalado Comandos
×
×
  • Criar Novo...