Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Olá pessoal do TK nao sei se estou na area certa mais ai vai..
meu sistema de shopping ta bugado. O player compra item do shopping o item chega normal só q depois disso da um erro e nao para de vir o item
tipo ele compra e paga uma vez e o item nao para de cai.. alguem ajuda ai plz.. 
                   ESSE É O ERRO QUE DA..

Lua Script Error: [GlobalEvent Interface] 
data/globalevents/scripts/others/shop.lua:onThink 
data/globalevents/scripts/others/shop.lua:57: attempt to perform arithmetic on local 'storage' (a string value) 
stack traceback: 
[C]: in function '__add' 
data/globalevents/scripts/others/shop.lua:57: in function 
[Error - GlobalEvents::think] Failed to execute event: shop 

Editado por bunda321 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

eai manin, poxa tentei faze de todas as maneiras que estao ai nesse tutorial unica coisa que consegui foi o erro nao persistir 
Lua Script Error: [GlobalEvent Interface] 
data/globalevents/scripts/others/shop.lua:onThink 
data/globalevents/scripts/others/shop.lua:57: attempt to perform arithmetic on local 'storage' (a string value) 
stack traceback: 
[C]: in function '__add' 
data/globalevents/scripts/others/shop.lua:57: in function 
[Error - GlobalEvents::think] Failed to execute event: shop

SO que agora eu compro e nao chega nada do item q comprei, sera que eu nao tenho que mudar , shopsysten.php ou algo do tipo? tenta ajuda ai manos!!
e quando do load no server apareçe esse erro agora >
 
[Warning - Event::checkScript] Can not load script: scripts/shop.lua 
cannot open data/globalevents/scripts/shop.lua: No such file or directory 

Link para o post
Compartilhar em outros sites

blz ai esta meu shop.lua

-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 18
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
    local result_plr = db.storeQuery("SELECT * FROM z_ots_comunication")
    if(result_plr ~= false) then
        repeat
            local id = tonumber(result.getDataInt(result_plr, "id"))
            local action = tostring(result.getDataString(result_plr, "action"))
            local delete = tonumber(result.getDataInt(result_plr, "delete_it"))
            local cid = getPlayerByName(tostring(result.getDataString(result_plr, "name")))
            if(cid) then
                local itemtogive_id = tonumber(result.getDataInt(result_plr, "param1"))
                local itemtogive_count = tonumber(result.getDataInt(result_plr, "param2"))
                local container_id = tonumber(result.getDataInt(result_plr, "param3"))
                local container_count = tonumber(result.getDataInt(result_plr, "param4"))
                local add_item_type = tostring(result.getDataString(result_plr, "param5"))
                local add_item_name = tostring(result.getDataString(result_plr, "param6"))
                local storage = tostring(result.getDataString(result_plr, "param7"))
                local received_item = 0
                local full_weight = 0
                if(add_item_type == 'container') then
                    container_weight = getItemWeight(container_id, 1)
                    if(isItemRune(itemtogive_id)) then
                        items_weight = container_count * getItemWeight(itemtogive_id, 1)
                    else
                        items_weight = container_count * getItemWeight(itemtogive_id, itemtogive_count)
                    end
                    full_weight = items_weight + container_weight
                else
                    full_weight = getItemWeight(itemtogive_id, itemtogive_count)
                    if(isItemRune(itemtogive_id)) then
                        full_weight = getItemWeight(itemtogive_id, 1)
                    else
                        full_weight = getItemWeight(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)
                        received_item = doPlayerAddItemEx(cid, new_item)
                    end
                    if(type(received_item) == "number" and received_item == RETURNVALUE_NOERROR) then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received '.. add_item_name ..' from ArenaTibia Shop.')
                        setPlayerStorageValue(cid,storage+555884621212,1)
                        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 .. ";")
                    else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, ' '.. add_item_name ..' from ArenaTibia 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 ..' ArenaTibia 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
        until not result.next(result_plr)
        result.free(result_plr)
    end
    return true
endr, 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


globalevents.xml

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

Link para o post
Compartilhar em outros sites

Vou dar uma olhada no script... Certifica que ele ta dentro da pasta /globalevents/scripts/, copia ele la

Life is so meaningless, there is nothing worth a smile
So goodbye, I'll miss you

 

 

sugestões?

 

 

Link para o post
Compartilhar em outros sites

Põe uma pasta antes, globalevents/scripts/, e não globalevents/scripts/others, e fala o erro que der.

Life is so meaningless, there is nothing worth a smile
So goodbye, I'll miss you

 

 

sugestões?

 

 

Link para o post
Compartilhar em outros sites

deu esse erro no painel 

[Warning - Event::checkScript] Can not load script: scripts/shop.lua 
data/globalevents/scripts/shop.lua:71: 'end' expected (to close 'function' at line 7) near 'endr' 

e ainda nao chega o item ao player, eu acho que nao ta chegando pq eu mudei a global_storage na database depois que eu fiz isso o item nao cai mais..

Link para o post
Compartilhar em outros sites

Tu não tem de onde você baixou/extraiu, o script shop.lua original pra mandar? Esse ai parece que ta faltando algumas partes.

Life is so meaningless, there is nothing worth a smile
So goodbye, I'll miss you

 

 

sugestões?

 

 

Link para o post
Compartilhar em outros sites

esse aqui é o shop.lua original

-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 18
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
    local result_plr = db.storeQuery("SELECT * FROM z_ots_comunication")
    if(result_plr ~= false) then
        repeat
            local id = tonumber(result.getDataInt(result_plr, "id"))
            local action = tostring(result.getDataString(result_plr, "action"))
            local delete = tonumber(result.getDataInt(result_plr, "delete_it"))
            local cid = getPlayerByName(tostring(result.getDataString(result_plr, "name")))
            if(cid) then
                local itemtogive_id = tonumber(result.getDataInt(result_plr, "param1"))
                local itemtogive_count = tonumber(result.getDataInt(result_plr, "param2"))
                local container_id = tonumber(result.getDataInt(result_plr, "param3"))
                local container_count = tonumber(result.getDataInt(result_plr, "param4"))
                local add_item_type = tostring(result.getDataString(result_plr, "param5"))
                local add_item_name = tostring(result.getDataString(result_plr, "param6"))
                local storage = tostring(result.getDataString(result_plr, "param7"))
                local received_item = 0
                local full_weight = 0
                if(add_item_type == 'container') then
                    container_weight = getItemWeight(container_id, 1)
                    if(isItemRune(itemtogive_id)) then
                        items_weight = container_count * getItemWeight(itemtogive_id, 1)
                    else
                        items_weight = container_count * getItemWeight(itemtogive_id, itemtogive_count)
                    end
                    full_weight = items_weight + container_weight
                else
                    full_weight = getItemWeight(itemtogive_id, itemtogive_count)
                    if(isItemRune(itemtogive_id)) then
                        full_weight = getItemWeight(itemtogive_id, 1)
                    else
                        full_weight = getItemWeight(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)
                        received_item = doPlayerAddItemEx(cid, new_item)
                    end
                    if(type(received_item) == "number" and received_item == RETURNVALUE_NOERROR) then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received '.. add_item_name ..' from ArenaTibia Shop.')
                        setPlayerStorageValue(cid,storage+555884621212,1)
                        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 .. ";")
                    else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, ' '.. add_item_name ..' from ArenaTibia 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 ..' ArenaTibia 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
        until not result.next(result_plr)
        result.free(result_plr)
    end
    return true
end

Link para o post
Compartilhar em outros sites

-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 18
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
    local result_plr = db.storeQuery("SELECT * FROM z_ots_comunication")
    if(result_plr ~= false) then
        repeat
            local id = tonumber(result.getDataInt(result_plr, "id"))
            local action = tostring(result.getDataString(result_plr, "action"))
            local delete = tonumber(result.getDataInt(result_plr, "delete_it"))
            local cid = getPlayerByName(tostring(result.getDataString(result_plr, "name")))
            if(cid) then
                local itemtogive_id = tonumber(result.getDataInt(result_plr, "param1"))
                local itemtogive_count = tonumber(result.getDataInt(result_plr, "param2"))
                local container_id = tonumber(result.getDataInt(result_plr, "param3"))
                local container_count = tonumber(result.getDataInt(result_plr, "param4"))
                local add_item_type = tostring(result.getDataString(result_plr, "param5"))
                local add_item_name = tostring(result.getDataString(result_plr, "param6"))
                local storage = tostring(result.getDataString(result_plr, "param7"))
                local received_item = 0
                local full_weight = 0
                if(add_item_type == 'container') then
                    container_weight = getItemWeight(container_id, 1)
                    if(isItemRune(itemtogive_id)) then
                        items_weight = container_count * getItemWeight(itemtogive_id, 1)
                    else
                        items_weight = container_count * getItemWeight(itemtogive_id, itemtogive_count)
                    end
                    full_weight = items_weight + container_weight
                else
                    full_weight = getItemWeight(itemtogive_id, itemtogive_count)
                    if(isItemRune(itemtogive_id)) then
                        full_weight = getItemWeight(itemtogive_id, 1)
                    else
                        full_weight = getItemWeight(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)
                        received_item = doPlayerAddItemEx(cid, new_item)
                    end
                    if(type(received_item) == "number" and received_item == RETURNVALUE_NOERROR) then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received '.. add_item_name ..' from ArenaTibia Shop.')
                        setPlayerStorageValue(cid,storage+555884621212,1)
                        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 .. ";")
                    else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, ' '.. add_item_name ..' from ArenaTibia 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 ..' ArenaTibia 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
        until not result.next(result_plr)
        result.free(result_plr)
    end
    return true
end, 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
Link para o post
Compartilhar em outros sites

Faz backup do antigo e testa esse shop.lua, ou procura outro por ai, o seu ta bugado

-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "data/lib/000-constants.lua")
SHOP_MSG_TYPE = MESSAGE_STATUS_CONSOLE_BLUE
-- time (in seconds) between queries to MySQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
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
                    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)
                        doItemSetAttribute(new_container, "description", 'Bought by ' .. getCreatureName(cid) .. ' [ID:' .. id .. '].')
                        doItemSetAttribute(new_container, "tid", id)
                        local iter = 0
                        while iter ~= container_count do
                            local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                            doItemSetAttribute(new_item, "description", 'Bought by ' .. getCreatureName(cid) .. ' [ID:' .. id .. '].')
                            doItemSetAttribute(new_item, "tid", id)
                            doAddContainerItemEx(new_container, new_item)
                            iter = iter + 1
                        end
                        received_item = doPlayerAddItemEx(cid, new_container)
                    else
                        local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                        doItemSetAttribute(new_item, "description", 'Bought by ' .. getCreatureName(cid) .. ' [ID:' .. id .. '].')
                        doItemSetAttribute(new_item, "tid", id)
                        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.')
                        doPlayerSave(cid)
                        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

Life is so meaningless, there is nothing worth a smile
So goodbye, I'll miss you

 

 

sugestões?

 

 

Link para o post
Compartilhar em outros sites

ja fiz de tudo nada resolve, ate o gesior intalei denovo mais n deu lol q bosta isso ai, mas vlw ai pelo esforço de vcs

por acaso nao me indicarias um outro web site pra min? uso dedicado obunto

Editado por bunda321 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

RESOLVI MEU PROBLEMA USEI ESSE shop.lua apaguei o meu e coloquei esse
 

  1. -- ### CONFIG ###
  2. -- time (in seconds) between connections to SQL database by shop script
  3. SQL_interval = 30
  4. -- ### END OF CONFIG ###
  5. function onThink(interval, lastExecution)
  6.     local result_plr = db.storeQuery("SELECT * FROM z_ots_comunication")
  7.     if result_plr ~= false then
  8.         repeat
  9.             local id = tonumber(result.getDataInt(result_plr, "id"))
  10.             local action = tostring(result.getDataString(result_plr, "action"))
  11.             local delete = tonumber(result.getDataInt(result_plr, "delete_it"))
  12.             local player = Player(tostring(result.getDataString(result_plr, "name")))
  13.             if player then
  14.                 local itemtogive_id = tonumber(result.getDataInt(result_plr, "param1"))
  15.                 local itemtogive_count = tonumber(result.getDataInt(result_plr, "param2"))
  16.                 local container_id = tonumber(result.getDataInt(result_plr, "param3"))
  17.                 local container_count = tonumber(result.getDataInt(result_plr, "param4"))
  18.                 local add_item_type = tostring(result.getDataString(result_plr, "param5"))
  19.                 local add_item_name = tostring(result.getDataString(result_plr, "param6"))
  20.                 local received_item = 0
  21.                 local full_weight = 0
  22.                 local itemType = ItemType(itemtogive_id)
  23.                 if add_item_type == 'container' then
  24.                     if itemType:isRune() then
  25.                         items_weight = container_count * itemType:getWeight()
  26.                     else
  27.                         items_weight = container_count * itemType:getWeight(itemtogive_count)
  28.                     end
  29.                     full_weight = items_weight + ItemType(container_id):getWeight()
  30.                 else
  31.                     if itemType:isRune() then
  32.                         full_weight = itemType:getWeight()
  33.                     else
  34.                         full_weight = itemType:getWeight(itemtogive_count)
  35.                     end
  36.                 end
  37.                 local free_cap = player:getFreeCapacity()
  38.                 if full_weight <= free_cap then
  39.                     if add_item_type == 'container' then
  40.                         local new_container = Game.createItem(container_id, 1)
  41.                         local iter = 0
  42.                         while iter ~= container_count do
  43.                             new_container:addItem(itemtogive_id, itemtogive_count)
  44.                             iter = iter + 1
  45.                         end
  46.                         received_item = player:addItemEx(new_container)
  47.                     else
  48.                         local new_item = Game.createItem(itemtogive_id, itemtogive_count)
  49.                         received_item = player:addItemEx(new_item)
  50.                     end
  51.                     if type(received_item) == 'number' and received_item == RETURNVALUE_NOERROR then
  52.                         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You received >> '.. add_item_name ..' << from OTS shop.')
  53.                         db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
  54.                         db.query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " ..id .. ";")
  55.                     else
  56.                         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, '>> '.. 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.')
  57.                     end
  58.                 else
  59.                     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, '>> '.. 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.')
  60.                 end
  61.             end
  62.         until not result.next(result_plr)
  63.         result.free(result_plr)
  64.     end
  65.     return true
  66. end


e agora esta tudo 100%, topico resolvido
Link para o post
Compartilhar em outros sites
  • 1 month later...

MUITO OBRIGA

Em 17/10/2015 20:20:09, bunda321 disse:

RESOLVI MEU PROBLEMA USEI ESSE shop.lua apaguei o meu e coloquei esse
 

  1. -- ### CONFIG ###
  2. -- time (in seconds) between connections to SQL database by shop script
  3. SQL_interval = 30
  4. -- ### END OF CONFIG ###
  5. function onThink(interval, lastExecution)
  6.     local result_plr = db.storeQuery("SELECT * FROM z_ots_comunication")
  7.     if result_plr ~= false then
  8.         repeat
  9.             local id = tonumber(result.getDataInt(result_plr, "id"))
  10.             local action = tostring(result.getDataString(result_plr, "action"))
  11.             local delete = tonumber(result.getDataInt(result_plr, "delete_it"))
  12.             local player = Player(tostring(result.getDataString(result_plr, "name")))
  13.             if player then
  14.                 local itemtogive_id = tonumber(result.getDataInt(result_plr, "param1"))
  15.                 local itemtogive_count = tonumber(result.getDataInt(result_plr, "param2"))
  16.                 local container_id = tonumber(result.getDataInt(result_plr, "param3"))
  17.                 local container_count = tonumber(result.getDataInt(result_plr, "param4"))
  18.                 local add_item_type = tostring(result.getDataString(result_plr, "param5"))
  19.                 local add_item_name = tostring(result.getDataString(result_plr, "param6"))
  20.                 local received_item = 0
  21.                 local full_weight = 0
  22.                 local itemType = ItemType(itemtogive_id)
  23.                 if add_item_type == 'container' then
  24.                     if itemType:isRune() then
  25.                         items_weight = container_count * itemType:getWeight()
  26.                     else
  27.                         items_weight = container_count * itemType:getWeight(itemtogive_count)
  28.                     end
  29.                     full_weight = items_weight + ItemType(container_id):getWeight()
  30.                 else
  31.                     if itemType:isRune() then
  32.                         full_weight = itemType:getWeight()
  33.                     else
  34.                         full_weight = itemType:getWeight(itemtogive_count)
  35.                     end
  36.                 end
  37.                 local free_cap = player:getFreeCapacity()
  38.                 if full_weight <= free_cap then
  39.                     if add_item_type == 'container' then
  40.                         local new_container = Game.createItem(container_id, 1)
  41.                         local iter = 0
  42.                         while iter ~= container_count do
  43.                             new_container:addItem(itemtogive_id, itemtogive_count)
  44.                             iter = iter + 1
  45.                         end
  46.                         received_item = player:addItemEx(new_container)
  47.                     else
  48.                         local new_item = Game.createItem(itemtogive_id, itemtogive_count)
  49.                         received_item = player:addItemEx(new_item)
  50.                     end
  51.                     if type(received_item) == 'number' and received_item == RETURNVALUE_NOERROR then
  52.                         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You received >> '.. add_item_name ..' << from OTS shop.')
  53.                         db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
  54.                         db.query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " ..id .. ";")
  55.                     else
  56.                         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, '>> '.. 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.')
  57.                     end
  58.                 else
  59.                     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, '>> '.. 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.')
  60.                 end
  61.             end
  62.         until not result.next(result_plr)
  63.         result.free(result_plr)
  64.     end
  65.     return true
  66. end

 


e agora esta tudo 100%, topico resolvido

 

muito obrigado,resolveu meu problema aqui

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo