Ir para conteúdo

Featured Replies

  • Respostas 38
  • Visualizações 7.6k
  • Created
  • Última resposta

Top Posters In This Topic

Postado

@EnzzoCaaue, coloque a parte do shop do gesior referente a add alguma query, por exemplo redskull, removeban, e etc .. que monto um exemplo! (não gosto de dar de mão beijada, gosto de ensinar) 

 

Pesquisando aqui no tk, encontrei um tópico, onde você chegou a comentar sobre isso, e um membro postou um código dizendo que era possível só substituir, o shop.lua por isso, entendi mais ou menos o código ainda não testei mais daqui a pouco vou fazer isso :)

-- ### 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 received_item = 0
                local full_weight = 0
				
				-- Script para addons e montaria full pelo Gesior -- 
				if(add_item_type == 'mounts') then
				local player = Player(cid)
				if (getPlayerStorageValue(cid,itemtogive_id) == -1) then
				doPlayerAddMount(cid, itemtogive_id)
				setPlayerStorageValue(cid,itemtogive_id,1)
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
				doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received '.. add_item_name ..' from Otserv Soft 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 .. ";")
				else
				doPlayerSendTextMessage(cid,25,"You Already have this Mount.")
				end
				return TRUE
				
				end				
				-- fim do script --
				-- Script para addons e montaria full pelo Gesior -- 
				if(add_item_type == 'addons') then
				local player = Player(cid)
				if (getPlayerStorageValue(cid,itemtogive_id) == -1) then
				doPlayerAddOutfit(cid, itemtogive_id, 3) 
				doPlayerAddOutfit(cid, container_id, 3)
				setPlayerStorageValue(cid,itemtogive_id,1)
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
				doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received '.. add_item_name ..' from Otserv Soft 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 .. ";")
				else
				doPlayerSendTextMessage(cid,25,"You Already have this Outfit.")
				end
				return TRUE
				end				
				-- fim do script --
				
				
				
                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 Otserv Soft 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 .. ";")
                    else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, ' '.. add_item_name ..' from Keltera 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 ..' Keltera 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

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

Postado

@neykos, não tem nada a ver com o shop.lua, e sim o shop do site ... 

 

 

Esse script não é o responsável por entregar determinado item ao personagem quando efetua uma compra?

pois o do servidor que estou usando é assim olha 

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

O meu site já tem aquelas abas que separa os itens das montarias e dos addons,

o site que estou usando é do liane.

 

 

E no meu servidor isso também que entrega as montarias e os addons

function onLogin(cid)
if getPlayerStorageValue(cid, 80+555884621212) == 1 then
doPlayerAddMount(cid, 6)
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
setPlayerStorageValue(cid, 80+555884621212, 2)

elseif getPlayerStorageValue(cid, 81+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 20)
setPlayerStorageValue(cid, 81+555884621212, 2)

elseif getPlayerStorageValue(cid, 82+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 29)
setPlayerStorageValue(cid, 82+555884621212, 2)

elseif getPlayerStorageValue(cid, 83+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 30)
setPlayerStorageValue(cid, 83+555884621212, 2)

elseif getPlayerStorageValue(cid, 84+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 27)
setPlayerStorageValue(cid, 84+555884621212, 2)

elseif getPlayerStorageValue(cid, 85+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 21)
setPlayerStorageValue(cid, 85+555884621212, 2)

elseif getPlayerStorageValue(cid, 90+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 24)
setPlayerStorageValue(cid, 90+555884621212, 2)

elseif getPlayerStorageValue(cid, 91+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 33)
setPlayerStorageValue(cid, 91+555884621212, 2)

elseif getPlayerStorageValue(cid, 92+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 41)
setPlayerStorageValue(cid, 92+555884621212, 2)

elseif getPlayerStorageValue(cid, 93+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 23)
setPlayerStorageValue(cid, 93+555884621212, 2)

elseif getPlayerStorageValue(cid, 94+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 9)
setPlayerStorageValue(cid, 94+555884621212, 2)

elseif getPlayerStorageValue(cid, 95+555884621212) == 2 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 37)
setPlayerStorageValue(cid, 95+555884621212, 2)

elseif getPlayerStorageValue(cid, 96+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 34)
setPlayerStorageValue(cid, 96+555884621212, 2)

elseif getPlayerStorageValue(cid, 97+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 36)
setPlayerStorageValue(cid, 97+555884621212, 2)

elseif getPlayerStorageValue(cid, 98+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 38)
setPlayerStorageValue(cid, 98+555884621212, 2)

elseif getPlayerStorageValue(cid, 116+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 43)
setPlayerStorageValue(cid, 116+555884621212, 2)

elseif getPlayerStorageValue(cid, 117+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 44)
setPlayerStorageValue(cid, 117+555884621212, 2)

elseif getPlayerStorageValue(cid, 118+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 45)
setPlayerStorageValue(cid, 118+555884621212, 2)

elseif getPlayerStorageValue(cid, 119+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 46)
setPlayerStorageValue(cid, 119+555884621212, 2)

elseif getPlayerStorageValue(cid, 120+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 47)
setPlayerStorageValue(cid, 120+555884621212, 2)

elseif getPlayerStorageValue(cid, 121+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 48)
setPlayerStorageValue(cid, 121+555884621212, 2)

elseif getPlayerStorageValue(cid, 122+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 49)
setPlayerStorageValue(cid, 122+555884621212, 2)

elseif getPlayerStorageValue(cid, 123+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 50)
setPlayerStorageValue(cid, 123+555884621212, 2)

elseif getPlayerStorageValue(cid, 124+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 51)
setPlayerStorageValue(cid, 124+555884621212, 2)

elseif getPlayerStorageValue(cid, 125+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received mount from ArenaTibia Shop.')
doPlayerAddMount(cid, 52)
setPlayerStorageValue(cid, 125+555884621212, 2)

-- Addons --

elseif getPlayerStorageValue(cid, 76+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received addon full from ArenaTibia Shop.')
doPlayerAddOutfit(cid, 147, 3)
doPlayerAddOutfit(cid, 143, 3)
setPlayerStorageValue(cid, 76+555884621212, 2)

elseif getPlayerStorageValue(cid, 77+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received addon full from ArenaTibia Shop.')
doPlayerAddOutfit(cid, 142, 3)
doPlayerAddOutfit(cid, 134, 3)
setPlayerStorageValue(cid, 77+555884621212, 2)

elseif getPlayerStorageValue(cid, 78+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received addon full from ArenaTibia Shop.')
doPlayerAddOutfit(cid, 156, 3)
doPlayerAddOutfit(cid, 152, 3)
setPlayerStorageValue(cid, 78+555884621212, 2)

elseif getPlayerStorageValue(cid, 79+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received addon full from ArenaTibia Shop.')
doPlayerAddOutfit(cid, 466, 3)
doPlayerAddOutfit(cid, 465, 3)
setPlayerStorageValue(cid, 79+555884621212, 2)

elseif getPlayerStorageValue(cid, 87+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received addon full from ArenaTibia Shop.')
doPlayerAddOutfit(cid, 141, 3)
doPlayerAddOutfit(cid, 133, 3)
setPlayerStorageValue(cid, 87+555884621212, 2)

elseif getPlayerStorageValue(cid, 88+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received addon full from ArenaTibia Shop.')
doPlayerAddOutfit(cid, 471, 3)
doPlayerAddOutfit(cid, 472, 3)
setPlayerStorageValue(cid, 88+555884621212, 2)

elseif getPlayerStorageValue(cid, 100+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received addon full from ArenaTibia Shop.')
doPlayerAddOutfit(cid, 138, 3)
doPlayerAddOutfit(cid, 130, 3)
setPlayerStorageValue(cid, 100+555884621212, 2)

elseif getPlayerStorageValue(cid, 126+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received addon full from ArenaTibia Shop.')
doPlayerAddOutfit(cid, 618, 3)
doPlayerAddOutfit(cid, 610, 3)
setPlayerStorageValue(cid, 126+555884621212, 2)

elseif getPlayerStorageValue(cid, 127+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received addon full from ArenaTibia Shop.')
doPlayerAddOutfit(cid, 633, 3)
doPlayerAddOutfit(cid, 632, 3)
setPlayerStorageValue(cid, 127+555884621212, 2)

elseif getPlayerStorageValue(cid, 128+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received addon full from ArenaTibia Shop.')
doPlayerAddOutfit(cid, 635, 3)
doPlayerAddOutfit(cid, 634, 3)
setPlayerStorageValue(cid, 128+555884621212, 2)

elseif getPlayerStorageValue(cid, 129+555884621212) == 1 then
doPlayerSendTextMessage(cid, 18, 'You received addon full from ArenaTibia Shop.')
doPlayerAddOutfit(cid, 637, 3)
doPlayerAddOutfit(cid, 636, 3)
setPlayerStorageValue(cid, 129+555884621212, 2)
	end
 	return TRUE
end

Acho que na verdade já tem só precisa adicionar 1 por 1. 

com seu id 

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

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo