Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.



 
InícioInício  Portal Nerd-FoxPortal Nerd-Fox  GaleriaGaleria  Últimas imagensÚltimas imagens  ProcurarProcurar  RegistarRegistar  EntrarEntrar  
Parceiros

Tibia

Tópicos semelhantes
Top dos mais postadores
markimbozi (106)
[Gesior Acc] Configurando Shop System Vote_lcap[Gesior Acc] Configurando Shop System Voting_bar[Gesior Acc] Configurando Shop System Vote_rcap 
pandá s2 (86)
[Gesior Acc] Configurando Shop System Vote_lcap[Gesior Acc] Configurando Shop System Voting_bar[Gesior Acc] Configurando Shop System Vote_rcap 
Roger1530 (70)
[Gesior Acc] Configurando Shop System Vote_lcap[Gesior Acc] Configurando Shop System Voting_bar[Gesior Acc] Configurando Shop System Vote_rcap 
Coca .Zero (32)
[Gesior Acc] Configurando Shop System Vote_lcap[Gesior Acc] Configurando Shop System Voting_bar[Gesior Acc] Configurando Shop System Vote_rcap 
Vinaao (25)
[Gesior Acc] Configurando Shop System Vote_lcap[Gesior Acc] Configurando Shop System Voting_bar[Gesior Acc] Configurando Shop System Vote_rcap 
khabelo (17)
[Gesior Acc] Configurando Shop System Vote_lcap[Gesior Acc] Configurando Shop System Voting_bar[Gesior Acc] Configurando Shop System Vote_rcap 
oOoO~ (12)
[Gesior Acc] Configurando Shop System Vote_lcap[Gesior Acc] Configurando Shop System Voting_bar[Gesior Acc] Configurando Shop System Vote_rcap 
Cookie (9)
[Gesior Acc] Configurando Shop System Vote_lcap[Gesior Acc] Configurando Shop System Voting_bar[Gesior Acc] Configurando Shop System Vote_rcap 
toty1234 (6)
[Gesior Acc] Configurando Shop System Vote_lcap[Gesior Acc] Configurando Shop System Voting_bar[Gesior Acc] Configurando Shop System Vote_rcap 
Stecykw (3)
[Gesior Acc] Configurando Shop System Vote_lcap[Gesior Acc] Configurando Shop System Voting_bar[Gesior Acc] Configurando Shop System Vote_rcap 
maio 2024
SegTerQuaQuiSexSábDom
  12345
6789101112
13141516171819
20212223242526
2728293031  
CalendárioCalendário
Procurar
 
 

Resultados por:
 
Rechercher Pesquisa avançada
Quem está conectado?
1 usuário online :: 0 registrados, 0 invisíveis e 1 visitante

Nenhum

O recorde de usuários online foi de 7 em Ter Fev 16, 2021 4:33 pm

 

 [Gesior Acc] Configurando Shop System

Ir para baixo 
3 participantes
AutorMensagem
markimbozi
Minerador
Minerador
markimbozi


Cheia
Aquário Mensagens : 106
Data de inscrição : 04/02/2010
Idade : 29
Localização : Espirito Santo

[Gesior Acc] Configurando Shop System Empty
MensagemAssunto: [Gesior Acc] Configurando Shop System   [Gesior Acc] Configurando Shop System Icon_minitimeQui Fev 04, 2010 5:50 pm

TUTORIAL ATUALIZADO!
AGORA O SCRIPT FUNCIONA EM TFS 0.3.x!!!


1. Instale o acc. maker. (Download Aqui)
2. Abra ".../xampp/htdocs/config/config.php" e ative o shop system (mude "0" para "1"):

$config['site']['shop_system'] = 1

3. Abra o arquivo globalevents.xml e adiciona a tag:

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

Em data/globalevent/shop.lua coloque:

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


3.1 CONFIGURAÇÃO
No início do arquivo postado acima é parte do shop config:

-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 17
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30


Script padrão para se conectar com o banco de dados 1 vez a cada 30 segundos.

3.2 Abra seu arquivo constant.lua que se encontra em "data/lib/constant.lua" e adicione esta linha em qualquer lugar:

InitShopComunication = 0

4. Na database do seu otserv execute (no phpmyadmin):

CREATE TABLE IF NOT EXISTS `z_ots_comunication` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`type` varchar(255) NOT NULL,
`action` varchar(255) NOT NULL,
`param1` varchar(255) NOT NULL,
`param2` varchar(255) NOT NULL,
`param3` varchar(255) NOT NULL,
`param4` varchar(255) NOT NULL,
`param5` varchar(255) NOT NULL,
`param6` varchar(255) NOT NULL,
`param7` varchar(255) NOT NULL,
`delete_it` int(2) NOT NULL default '1',
PRIMARY KEY (`id`)
);
CREATE TABLE IF NOT EXISTS `z_shop_offer` (
`id` int(11) NOT NULL auto_increment,
`points` int(11) NOT NULL default '0',
`itemid1` int(11) NOT NULL default '0',
`count1` int(11) NOT NULL default '0',
`itemid2` int(11) NOT NULL default '0',
`count2` int(11) NOT NULL default '0',
`offer_type` varchar(255) default NULL,
`offer_description` text NOT NULL,
`offer_name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE IF NOT EXISTS `z_shop_history_item` (
`id` int(11) NOT NULL auto_increment,
`to_name` varchar(255) NOT NULL default '0',
`to_account` int(11) NOT NULL default '0',
`from_nick` varchar(255) NOT NULL,
`from_account` int(11) NOT NULL default '0',
`price` int(11) NOT NULL default '0',
`offer_id` int(11) NOT NULL default '0',
`trans_state` varchar(255) NOT NULL,
`trans_start` int(11) NOT NULL default '0',
`trans_real` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
);
CREATE TABLE IF NOT EXISTS `z_shop_history_pacc` (
`id` int(11) NOT NULL auto_increment,
`to_name` varchar(255) NOT NULL default '0',
`to_account` int(11) NOT NULL default '0',
`from_nick` varchar(255) NOT NULL,
`from_account` int(11) NOT NULL default '0',
`price` int(11) NOT NULL default '0',
`pacc_days` int(11) NOT NULL default '0',
`trans_state` varchar(255) NOT NULL,
`trans_start` int(11) NOT NULL default '0',
`trans_real` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
);


5. Fim da instalação. Agora adicione ofertas!! (exemplo abaixo)

Exemplo de configuração de ofertas. Execute na database do seu OT:


INSERT INTO `z_shop_offer`(`id`,`points`,`itemid1` ,`count1` ,`itemid2` ,`count2` ,`offer_type` ,`offer_description` ,`offer_name`)
VALUES (NULL , '10', '0', '12', '0', '0', 'pacc', 'Buy 12 days of premium account for yourself or your friend!', '12 Days of PACC'
), (NULL , '40', '5890', '50', '0', '0', 'item', 'Buy 50 Chicken Feathers!', '50x Chicken Feather'
), (NULL , '100', '2466', '1', '1987', '8', 'container', 'Buy bag with 8 Golden Armor! Become a rich mother fucker!', '8x Golden Armor');


Quando você for adicionar novas ofertas de PACC
id - empty (auto_incement)
points - quantos pontos custa essa oferta
count1 - Dias de PACC esta oferta dá.
offer_type = "pacc"
offer_description - Descrição da Oferta, exeplo: "Buy 5 days of PACC. With PACC you can visit new areas, fight stronger monsters and promote your character!"
offer_name - Nome da oferta, como: "5 Days of PACC"

Quando você for adicionar uma nova oferta de ITEM
id - empty (auto_increment)
points - quantos pontos custa essa oferta.
itemid1 - ID do item criato no seu OT
count1 - "quantidade" do item, como SD com 15 cargas tem "count" 15, item normais (bag, crossbow, golden armor...) tem "count" 1, "count" 3 não irá criar 3 Golden Armos, use 'container' para dar mais items.
offer_type = "item"
offer_description - Descrição da oferta, como: "Buy Golden Armor and become great knight! Fight stonger mosters and lose less HP!"
offer_name - Nome da nova oferta, como: "1x Golden Armor"

Quando você for adicionar uma nova oferta de CONTAINER
id - empty (auto_increment)
points - Quantos ponstos custa essa oferta
itemid1 - ID do item criado dentro da BP
count1 - "quantidade"/"tipo" dos itens da BP, para itens normais, use "count" 1, para dar mais itens use "count2" e coloce quantos itens serão dados.
itemid2 - ID da BP (como uma bag: 1987, ESSE ITEM DEVE SER UM CONTAINER E DEVE SER USÁVEL!!!)
count2 - Número de itens dentro do container, se você usar "bag" (id 1987) como container você pode por 1-8 items, se backpack 1-20, não coloque mais doque cabe no container!
offer_type = "container"
offer_description - Descrição da oferta, como: "Buy 8 Golden Armors in bag and become rich player! Fight stonger mosters and lose less HP or sell it for much cash!"
offer_name - Nome da oferta, como: "8x Golden Armor"


Créditos: MarkimBozi

Ir para o topo Ir para baixo
http://dynastyworld.servegame.com
Roger1530
SOBERANO
SOBERANO
Roger1530


Cheia
Peixes Mensagens : 70
Data de inscrição : 03/02/2010
Idade : 31
Localização : Governador Valadares

[Gesior Acc] Configurando Shop System Empty
MensagemAssunto: Re: [Gesior Acc] Configurando Shop System   [Gesior Acc] Configurando Shop System Icon_minitimeQui Fev 04, 2010 6:22 pm

Topico Totalmente Aprovado !!!
Ir para o topo Ir para baixo
http://nerd-fox.com
markimbozi
Minerador
Minerador
markimbozi


Cheia
Aquário Mensagens : 106
Data de inscrição : 04/02/2010
Idade : 29
Localização : Espirito Santo

[Gesior Acc] Configurando Shop System Empty
MensagemAssunto: aprovado   [Gesior Acc] Configurando Shop System Icon_minitimeQui Fev 04, 2010 6:44 pm

Pó, valeu mesmo
Ir para o topo Ir para baixo
http://dynastyworld.servegame.com
pandá s2
Caçador
Caçador
pandá s2


Cheia
Capricórnio Mensagens : 86
Data de inscrição : 04/02/2010
Idade : 28
Localização : Abreu e Lima-PE

[Gesior Acc] Configurando Shop System Empty
MensagemAssunto: Re: [Gesior Acc] Configurando Shop System   [Gesior Acc] Configurando Shop System Icon_minitimeSex Fev 05, 2010 4:15 am

Aprovado!!

[Gesior Acc] Configurando Shop System Colaborador
Ir para o topo Ir para baixo
http://www.rodrigo158.webs.com
markimbozi
Minerador
Minerador
markimbozi


Cheia
Aquário Mensagens : 106
Data de inscrição : 04/02/2010
Idade : 29
Localização : Espirito Santo

[Gesior Acc] Configurando Shop System Empty
MensagemAssunto: Re: [Gesior Acc] Configurando Shop System   [Gesior Acc] Configurando Shop System Icon_minitimeSex Fev 05, 2010 4:42 pm

valeu, panda
Ir para o topo Ir para baixo
http://dynastyworld.servegame.com
pandá s2
Caçador
Caçador
pandá s2


Cheia
Capricórnio Mensagens : 86
Data de inscrição : 04/02/2010
Idade : 28
Localização : Abreu e Lima-PE

[Gesior Acc] Configurando Shop System Empty
MensagemAssunto: Re: [Gesior Acc] Configurando Shop System   [Gesior Acc] Configurando Shop System Icon_minitimeDom Fev 07, 2010 4:33 am

Obrigado falo eu por seu Conhescimento em WEB SITE!

Você ainda tem muito pra nos ajudar
Ir para o topo Ir para baixo
http://www.rodrigo158.webs.com
Conteúdo patrocinado





[Gesior Acc] Configurando Shop System Empty
MensagemAssunto: Re: [Gesior Acc] Configurando Shop System   [Gesior Acc] Configurando Shop System Icon_minitime

Ir para o topo Ir para baixo
 
[Gesior Acc] Configurando Shop System
Ir para o topo 
Página 1 de 1
 Tópicos semelhantes
-
» System Of A Down - B.Y.O.B.
» [ Inicia-se coleta de feedback para o war system ]

Permissões neste sub-fórumNão podes responder a tópicos
 :: Ot-Servers :: Tutorias Sobre Web Site-
Ir para: