Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Em globalevents/scripts/ crie um arquivo com o nome de shop.lua, e cole isso dentro:

 

 

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, "You have received >> "..productn.." << from our shop system")
                                            db.executeQuery("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
                                        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.executeQuery("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

 

 

 

 

 

Após ter Adicionado o arquivo Acima, faça isto:

 

Adicione a Seguinte linha, em: globalevents.xml:

 

 

<!-- Shop Site -->

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

 

 

Ajudei ???, REP+ Nao Mata

Link para o post
Compartilhar em outros sites

 

Em globalevents/scripts/ crie um arquivo com o nome de shop.lua, e cole isso dentro:

 

 

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, "You have received >> "..productn.." << from our shop system")

                                            db.executeQuery("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")

                                        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.executeQuery("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

 

 

 

 

 

Após ter Adicionado o arquivo Acima, faça isto:

 

Adicione a Seguinte linha, em: globalevents.xml:

 

 

<!-- Shop Site -->

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

 

 

Ajudei ???, REP+ Nao Mata

 

 

Deu erro no console '-'

 10449463_248656798657646_641721147122721

Link para o post
Compartilhar em outros sites
  • 1 month later...
  • 2 months later...

eu fis uma se funcionar da um rep ai 

 

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

Ajudei Rep+ :D

Link para o post
Compartilhar em outros sites

saudades de um code, mano ele quer saber oq nao chega no dp, esses sistemas de entrega do mysql sao para o inventario ou amunition!

 

na epoca desses scripts de entrega, os itens comprados na loja iam para o amunition(onde coloca as municoes de paladin, algusn se nao tivesse como cair la ia pro inventario do usuario caso a bp estivesse com espaço, se seu ot for desses amis novos que nao deixa colocar outros tipos de itens na amunition como sets e armas, tenta pegar um que ignora o amunition e jogar no inventario!

 

lembrando esses scripts citados jogam o item no player nao no dp!

Xuuuuooooo!!!!!

Link para o post
Compartilhar em outros sites

1º EM GLOBALEVENTS E FAÇA A COPIA DE UM ARQUIVO E RENOMEIE PRA SHOP.LUA E ADICIONE ISSO DENTRO

-- ### 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
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)
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.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

2º EM GLOBAEVENTS.XML ADICIONE A SEGUINTE LINHA

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

TFS 0.4 DEV   | 

 

Ajudei você ? retribua a ajuda com uma Reputação positiva
" Se a sua vida for a melhor coisa que já te aconteceu, acredite, você tem mais sorte do que pode imaginar. "

 

 

 

Link para o post
Compartilhar em outros sites

man essse n ta funcionando

ve la o q eu postei ta mlehor sem ofença suave ?

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