Ir para conteúdo
  • Cadastre-se

[Help] Shop System Nao para de chegar item


Posts Recomendados

Meu shop system nao para de chegar items... oque será isso?

 

Meu shop.lua

 

local SHOP_MSG_TYPE = MESSAGE_EVENT_ORANGE
local SQL_interval = 30
 
function onThink(interval, lastExecution)
local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
if(result_plr:getID() ~= -1) then
while(true) do
local id = tonumber(result_plr:getDataInt("id"))
local action = tostring(result_plr:getDataString("action"))
local delete = tonumber(result_plr:getDataInt("delete_it"))
local cid = getCreatureByName(tostring(result_plr:getDataString("name")))
if isPlayer(cid) then
local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
local container_id = tonumber(result_plr:getDataInt("param3"))
local container_count = tonumber(result_plr:getDataInt("param4"))
local add_item_type = tostring(result_plr:getDataString("param5"))
local add_item_name = tostring(result_plr:getDataString("param6"))
local received_item = 0
local full_weight = 0
if add_item_type == 'container' then
container_weight = getItemWeightById(container_id, 1)
if isItemRune(itemtogive_id) == TRUE then
items_weight = container_count * getItemWeightById(itemtogive_id, 1)
else
items_weight = container_count * getItemWeightById(itemtogive_id, itemtogive_count)
end
full_weight = items_weight + container_weight
else
full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
if isItemRune(itemtogive_id) == TRUE then
full_weight = getItemWeightById(itemtogive_id, 1)
else
full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
end
end
local free_cap = getPlayerFreeCap(cid)
if full_weight <= free_cap then
if add_item_type == 'container' then
local new_container = doCreateItemEx(container_id, 1)
local iter = 0
while iter ~= container_count do
doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
iter = iter + 1
end
received_item = doPlayerAddItemEx(cid, new_container)
else
local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
doItemSetAttribute(new_item, "description", "This item can only be used by the player ".. getPlayerName(cid) .."!")
doItemSetAttribute(new_item, "aid", getPlayerGUID(cid)+10000)
received_item = doPlayerAddItemEx(cid, new_item)
end
if received_item == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'Voce recebeu >> '.. add_item_name ..' << do Huck Shop.Obrigado pela compra, volte sempre!')
db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')
end
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.')
end
end
if not(result_plr:next()) then
break
end
end
result_plr:free()
end
return true
end

 

e na tag globalevents.xml

 

        <globalevent name="shop" interval="30000" script="shop.lua"/>

 

OBS: Meu tfs é 0.4 rev 3777...

Link para o post
Compartilhar em outros sites
  • Respostas 5
  • Created
  • Última resposta

Top Posters In This Topic

Popular Days

Top Posters In This Topic

em shop.lua use este código.
 

SHOP_MSG_TYPE = 19
 
SQL_interval = 30
 
function onThink(interval, lastExecution)
    local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
    if(result_plr:getID() ~= -1) then
        while(true) do
            id = tonumber(result_plr:getDataInt("id"))
            action = tostring(result_plr:getDataString("action"))
            delete = tonumber(result_plr:getDataInt("delete_it"))
            cid = getCreatureByName(tostring(result_plr:getDataString("name")))
            if isPlayer(cid) == TRUE then
                local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
                local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
                local container_id = tonumber(result_plr:getDataInt("param3"))
                local container_count = tonumber(result_plr:getDataInt("param4"))
                local add_item_type = tostring(result_plr:getDataString("param5"))
                local add_item_name = tostring(result_plr:getDataString("param6"))
                local received_item = 0
                local full_weight = 0
                if add_item_type == 'container' then
                    full_weight = getItemWeightById(itemtogive_id, 1)
                end
                local free_cap = getPlayerFreeCap(cid)
                if full_weight <= free_cap then
                    if add_item_type == 'container' then
                        local new_container = doCreateItemEx(container_id, 1)
                        local iter = 0
                        while iter ~= container_count do
                            doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
                            iter = iter + 1
                        end
                        received_item = doPlayerAddItemEx(cid, new_container)
                    else
                        local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                        received_item = doPlayerAddItemEx(cid, new_item)
                    end
                    if received_item == RETURNVALUE_NOERROR then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
                        db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
                        db.query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
doPlayerSave(cid)
else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                    end
                else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                end
            end
            if not(result_plr:next()) then
                break
            end
        end
        result_plr:free()
    end
    return TRUE
end
 
registre a tag em globalevents.xml
 
<globalevent name="shop" interval="30000" script="shop.lua"/>

www.pokemiw.com
24 Horas Online - 1º 2º 3º 4º 5º 6º 7º gerações 100%
 

Link para o post
Compartilhar em outros sites

 

em shop.lua use este código.

 

SHOP_MSG_TYPE = 19
 
SQL_interval = 30
 
function onThink(interval, lastExecution)
    local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
    if(result_plr:getID() ~= -1) then
        while(true) do
            id = tonumber(result_plr:getDataInt("id"))
            action = tostring(result_plr:getDataString("action"))
            delete = tonumber(result_plr:getDataInt("delete_it"))
            cid = getCreatureByName(tostring(result_plr:getDataString("name")))
            if isPlayer(cid) == TRUE then
                local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
                local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
                local container_id = tonumber(result_plr:getDataInt("param3"))
                local container_count = tonumber(result_plr:getDataInt("param4"))
                local add_item_type = tostring(result_plr:getDataString("param5"))
                local add_item_name = tostring(result_plr:getDataString("param6"))
                local received_item = 0
                local full_weight = 0
                if add_item_type == 'container' then
                    full_weight = getItemWeightById(itemtogive_id, 1)
                end
                local free_cap = getPlayerFreeCap(cid)
                if full_weight <= free_cap then
                    if add_item_type == 'container' then
                        local new_container = doCreateItemEx(container_id, 1)
                        local iter = 0
                        while iter ~= container_count do
                            doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
                            iter = iter + 1
                        end
                        received_item = doPlayerAddItemEx(cid, new_container)
                    else
                        local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                        received_item = doPlayerAddItemEx(cid, new_item)
                    end
                    if received_item == RETURNVALUE_NOERROR then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
                        db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
                        db.query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
doPlayerSave(cid)
else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                    end
                else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                end
            end
            if not(result_plr:next()) then
                break
            end
        end
        result_plr:free()
    end
    return TRUE
end
 
registre a tag em globalevents.xml
 
<globalevent name="shop" interval="30000" script="shop.lua"/>

 

Ja fiz isso, no caso o script vc so modifiquei o db.executeryQuery para db.Query né isso? ou fez algo a mais?

Link para o post
Compartilhar em outros sites

esse script que postei eu usava no meu server e entregava normalmente. "linux"

www.pokemiw.com
24 Horas Online - 1º 2º 3º 4º 5º 6º 7º gerações 100%
 

Link para o post
Compartilhar em outros sites

esse script que postei eu usava no meu server e entregava normalmente. "linux"

tranquilo, o meu é linux tbm, vo testar :)

Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por eddybrow
      O shop admin estava normal, isso foi depois que eu adicionei acho que o tutorial de anti-injection, ai ficou desse jeito.
      Esse tuto: http://www.tibiaking.com/forum/topic/26861-tutorial-protegendo-seu-gesior-e-xampp/
       
       
      Parou de criar ticket de atendimento também desse script abaixo.
      http://www.tibiaking.com/forum/topic/36314-sistema-de-ticket-atendimento-gesior-acc/
       
       
      Oque será ?
    • Por thalisson borin
      bom glr preciso de uma shop system passo a passo funcional, ja procurei em quase todos os topicos e todos estão sem as respostas que deram certo, ficaria grato se algum puder colocar os scripts aqui
    • Por ViitinG
      A pedidos de um membro eu vim trazer um tutorial do Nicaw AAC traduzido para o TK, é um sistema de SHOP simples mas que não deixa a desejar.
       
      Fotos :



       
      • Instalando •
       
      DOWNLOAD DO ANEXO :
      Hidden Content
      Give reaction to this post to see the hidden content.  
      Siga os passos para instalação :
      1 - Faça o download do anexo.
      2 - Coloque os arquivos (loja, shopadd, vender) na sua pasta nicaw.
      3 - Coloque os arquivos que estão dentro da pasta tools dentro da sua pasta tools.
      4 - Coloque a pasta items dentro da sua pasta nicaw.
      5 - Execute as querys a seguir :
      ALTER TABLE `players` ADD `points` int(11) NOT NULL; CREATE TABLE IF NOT EXISTS `shop` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL, `info` text NOT NULL, `price` int(11) NOT NULL, `image` varchar(20) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ; 6 - Em nicaw navigation.xml adicione isto :
      <item href="shop.php">Shop</item> OBS : Para acessar o SHOP e adicionar offers você precisa entrar com localhost.
       
      Creditos : Raggaer
       
       
    • Por cesarfilho55
      gostaria de pedir 1 shop system para meu nicaw acc .
    • Por TraNee
      Tudo Bom Galera?
      Seguinto crei Um Site Pro Meu Otserver [Gesior]
      Porem Na parte Do Shop System ,Quando Vou Comprar Itens
      Aparece Issu

      Shop System is currently disabled for this server.Please ask the admin for more information.




      shopsystem

      Hidden Content
      Give reaction to this post to see the hidden content.

      shopadmin

      Hidden Content
      Give reaction to this post to see the hidden content.


      Bom Espero Que Isso Ajude
      Aguardo Respostas
      Vlww!
  • Estatísticas dos Fóruns

    96851
    Tópicos
    519617
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo