Ir para conteúdo
  • Cadastre-se

[Pedido Urgente] Quando um jogador compra item no site, o item vir com o nome dele e ID.


Posts Recomendados

Ola Gostaria de pedir não sei como falar se é script spell etc.Que quando o jogar compra o item vip no site vim com o nome dele no item e com Id do item mostrando. Pfv é urgente.Vo deixar meu shop.lua se precisar

 

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, "Você recebeu >> "..productn.." << da nossa loja")
db.executeQuery("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
else
doPlayerSendTextMessage(cid,19, "Desculpe, você não tem espaço suficiente no recipiente para receber >> "..productn.." <<")
end
else
doPlayerSendTextMessage(cid,19, "Desculpe, você não tem um recipiente para receber >> "..productn.." <<")
end
else
doPlayerSendTextMessage(cid,19, "Desculpe, você não tem capacidade suficiente para receber >> "..productn.." << (You need: "..getItemWeightById(id, count).." Capacity)")
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, "Você recebeu >> "..productn.." << da nossa loja")
db.executeQuery("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
else
doPlayerSendTextMessage(cid,19, "Desculpe, você não tem espaço suficiente para receber >> "..productn.." <<")
end
else
doPlayerSendTextMessage(cid,19, "Desculpe, você não tem capacidade suficiente para receber >> "..productn.." << (You need: "..getItemWeightById(id, count).." Capacity)")
end
end
end
itemr:free()
if not(result:next()) then
break
end
end
result:free()
end
return true
end

 

Rep+ :D

Ajudei Rep+ :D

Link para o post
Compartilhar em outros sites

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(getPlayerNameByGUID(tonumber(result:getDataInt("player"))))
            product = tonumber(result:getDataInt("product"))
            itemr = db.getResult("SELECT * FROM shop_offer WHERE `id` = "..product..";")
               if isPlayer(cid) then
local um_um = {1,2,3,4,5,6,7,8,9,0}
um = um_um[math.random(1, #um_um)]
 
local dois_dois = {1,2,3,4,5,6,7,8,9,0}
dois = dois_dois[math.random(1, #dois_dois)]
 
local tres_tres = {1,2,3,4,5,6,7,8,9,0}
tres = tres_tres[math.random(1, #tres_tres)]
 
local quatro_quatro = {1,2,3,4,5,6,7,8,9,0}
quatro = quatro_quatro[math.random(1, #quatro_quatro)]
 
                  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 = doPlayerAddItem(cid, id, count, false)
                              if received then
                              doItemSetAttribute(received, "description", ''.. productn ..' by ' .. getCreatureName(cid) .. ' [iD:' .. um .. '' .. dois .. '' .. tres .. '' .. quatro .. '].')
                                 doPlayerSendTextMessage(cid,19, "You have received >> "..productn.." << from our shop system")
                                 db.query("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
f = io.open("data/logs/Shop.txt", "a+")
f:write("Player : '".. productn .." by ".. getCreatureName(cid) .." [iD: ".. um .."".. dois .."".. tres .."".. quatro .."] Item : "..productn.." - "..getCreatureName(cid).."- " .. os.date("%d %B %Y - %X.", os.time()) .."\n----------------------------------------------------------\n")
f:close()
                              else
                                 doPlayerSendTextMessage(cid,19, "Sorry, you don't have enough space on container to receive >> "..productn.." <<")
                              end
                           else
                              doPlayerSendTextMessage(cid,19, "Sorry, you don't have a container to receive >> "..productn.." <<")
                           end
                        else
                           doPlayerSendTextMessage(cid,19, "Sorry, you don't have enough capacity to receive >> "..productn.." << (You need: "..getItemWeightById(id, count).." Capacity)")
                        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, "You have received >> "..productn.." << from our shop system")
                                 db.query("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
                              else
                                 doPlayerSendTextMessage(cid,19, "Sorry, you don't have enough space to receive >> "..productn.." <<")
                              end
                           else
                              doPlayerSendTextMessage(cid,19, "Sorry, you don't have enough capacity to receive >> "..productn.." << (You need: "..getItemWeightById(id, count).." Capacity)")
                           end
                     end
               end
            itemr:free()
            if not(result:next()) then
               break
            end
         end
         result:free()
      end
   return true
end

YDmXTU2.png

 

Entenda tudo sobre VPS, DEDICADOS & HOSPEDAGENS. => Clique aqui

Global Full Download 10.9x - TFS 1.2/FERUMBRAS/KRAILOS. => Clique aqui

 

Muitos querem aquilo que você tem, 
mas vão desistir quando souberem o preço que você pagou.

 

skype-favicon.png lu.lukinha

message-16.png [email protected]

Link para o post
Compartilhar em outros sites

vo testar rapidin


man deu esse erro aki

 

[16/11/2014 05:52:29] [Error - GlobalEvent Interface]


[16/11/2014 05:52:29] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:52:29] Description:
[16/11/2014 05:52:29] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:52:29] [Error - GlobalEvent Interface]
[16/11/2014 05:52:29] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:52:29] Description:
[16/11/2014 05:52:29] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:52:29] [Error - GlobalEvent Interface]
[16/11/2014 05:52:29] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:52:29] Description:
[16/11/2014 05:52:29] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:52:29] [Error - GlobalEvent Interface]
[16/11/2014 05:52:29] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:52:29] Description:
[16/11/2014 05:52:29] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:52:29] [Error - GlobalEvent Interface]
[16/11/2014 05:52:29] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:52:29] Description:
[16/11/2014 05:52:29] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:52:29] [Error - GlobalEvent Interface]
[16/11/2014 05:52:29] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:52:29] Description:
[16/11/2014 05:52:29] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:52:29] [Error - GlobalEvent Interface]
[16/11/2014 05:52:29] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:52:29] Description:
[16/11/2014 05:52:29] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:52:29] [Error - GlobalEvent Interface]
[16/11/2014 05:52:29] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:52:29] Description:
[16/11/2014 05:52:29] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:52:29] [Error - GlobalEvent Interface]
[16/11/2014 05:52:29] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:52:30] Description:
[16/11/2014 05:52:30] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:00] [Error - GlobalEvent Interface]
[16/11/2014 05:53:00] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:00] Description:
[16/11/2014 05:53:00] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:00] [Error - GlobalEvent Interface]
[16/11/2014 05:53:00] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:00] Description:
[16/11/2014 05:53:00] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:00] [Error - GlobalEvent Interface]
[16/11/2014 05:53:00] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:00] Description:
[16/11/2014 05:53:00] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:01] [Error - GlobalEvent Interface]
[16/11/2014 05:53:01] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:01] Description:
[16/11/2014 05:53:01] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:01] [Error - GlobalEvent Interface]
[16/11/2014 05:53:01] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:01] Description:
[16/11/2014 05:53:01] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:01] [Error - GlobalEvent Interface]
[16/11/2014 05:53:01] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:01] Description:
[16/11/2014 05:53:01] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:01] [Error - GlobalEvent Interface]
[16/11/2014 05:53:01] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:01] Description:
[16/11/2014 05:53:01] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:01] [Error - GlobalEvent Interface]
[16/11/2014 05:53:01] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:01] Description:
[16/11/2014 05:53:01] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:01] [Error - GlobalEvent Interface]
[16/11/2014 05:53:01] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:01] Description:
[16/11/2014 05:53:01] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:32] [Error - GlobalEvent Interface]
[16/11/2014 05:53:32] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:32] Description:
[16/11/2014 05:53:32] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:32] [Error - GlobalEvent Interface]
[16/11/2014 05:53:32] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:32] Description:
[16/11/2014 05:53:32] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:32] [Error - GlobalEvent Interface]
[16/11/2014 05:53:32] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:32] Description:
[16/11/2014 05:53:32] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:32] [Error - GlobalEvent Interface]
[16/11/2014 05:53:32] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:32] Description:
[16/11/2014 05:53:32] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:32] [Error - GlobalEvent Interface]
[16/11/2014 05:53:32] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:32] Description:
[16/11/2014 05:53:32] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:32] [Error - GlobalEvent Interface]
[16/11/2014 05:53:32] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:32] Description:
[16/11/2014 05:53:32] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:32] [Error - GlobalEvent Interface]
[16/11/2014 05:53:32] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:32] Description:
[16/11/2014 05:53:32] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:32] [Error - GlobalEvent Interface]
[16/11/2014 05:53:32] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:32] Description:
[16/11/2014 05:53:32] (luaGetPlayerNameByGUID) Player not found

[16/11/2014 05:53:32] [Error - GlobalEvent Interface]
[16/11/2014 05:53:32] data/globalevents/scripts/shop.lua:onThink
[16/11/2014 05:53:32] Description:
[16/11/2014 05:53:32] (luaGetPlayerNameByGUID) Player not found

Editado por avalax (veja o histórico de edições)

Ajudei Rep+ :D

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 = 19
-- 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.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
                            new_item = doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
                            iter = iter + 1
                        end
                        received_item = doPlayerAddItemEx(cid, new_container)
                        doItemSetAttribute(new_item, "description", "Este item pertence a "..getCreatureName(cid))
                    else
                        new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                        received_item = doPlayerAddItemEx(cid, new_item)
                        doItemSetAttribute(new_item, "description", "Este item pertence a "..getCreatureName(cid))
                    end
                    if received_item == RETURNVALUE_NOERROR then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'Voce acaba de receber o item >> '.. add_item_name ..' << de nosso shopping, obrigado por ser um ilustrissimo donate!')
                        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 .. ";")
                        doPlayerSave(cid)
                    else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'Seu item >> '.. add_item_name ..' << esta esperando por voce. Por favor faça o local para este item em sua mochila e aguarde cerca de 30 segundos para obte-lo.')
                    end
                else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'Seu item >> '.. add_item_name ..' << esta esperando por voce. O peso do item e '.. full_weight ..' oz., Vc tem no momento '.. free_cap ..' oz. de capacidade livre. Coloque alguns itens no deposito e espere cerca de 30 segundos para obte-lo.')
                end
            end
            if not(result_plr:next()) then
                break
            end
        end
        result_plr:free()
    end
    return TRUE
end

Tony Araújo  ;D 

 

Link para o post
Compartilhar em outros sites

man agora os items não chega quando eu compro na loja

Editado por avalax (veja o histórico de edições)

Ajudei Rep+ :D

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