Ir para conteúdo

Featured Replies

Postado

Bom pessoal, estou com um problema em meu servidor, no qual vi muitas pessoas com o mesmo problema, porém tentei de diversas forma resolve-lo e não tive sucesso.

Meu servidor é TFS 0.1.7 Global

O que acontece é o seguinte:

Ao adquirir qualquer item no shop do site, o item não para de chegar para o player, até acabar a cap ou espaço do mesmo..

Já tentei utilizar diversos scripts globalevents que estavam aqui no forum porém nenhum deu resultado positivo

Segue o Script Globalevent atual:

local SHOP_MSG_TYPE = MESSAGE_EVENT_ORANGE
local SQL_interval = 30
 
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
local id = tonumber(result_plr:getDataInt("id"))
local action = tostring(result_plr:getDataString("action"))
local delete = tonumber(result_plr:getDataInt("delete_it"))
local cid = getCreatureByName(tostring(result_plr:getDataString("name")))
if isPlayer(cid) 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)
doItemSetAttribute(new_item, "description", "This item can only be used by the player ".. getPlayerName(cid) .."!")
doItemSetAttribute(new_item, "aid", getPlayerGUID(cid)+10000)
received_item = doPlayerAddItemEx(cid, new_item)
end
if received_item == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'Voce recebeu >> '.. add_item_name ..' << do Dramonio Shop.Obrigado pela compra, volte sempre!')
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 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

A TAG para executar o globalevent:

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

E para confirmar... no meu último teste, exclui minha tabela db no phpmyadmin e executei essa QUERY para adicionar uma nova table (pois achei que o problema estava nela):

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`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Mas o erro persiste, o item não para de chegar no char... Segue o Erro na DISTRO para vocês verificarem:

 

11syvjo.png

 

Realmente não sei mais o que fazer, tentei de tudo :(

Antes que alguém fale, eu já tentei usar o comando Executequery sem o "execute"

 

No aguardo pessoal, me ajudem Porfavor

  • Respostas 6
  • Visualizações 1.9k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Cara, onde que eu dou mais de 1 de REP pra vc, você conseguiu solucionar meu problema que estava a 1 semana já, nenhum forum, nenhum tópico tinha dito isso :D Muito obrigado cara

  • Tentou com db.executeQuery? Se não der certo, tenta botar db.getResult, não é o mais indicado a se fazer, mas acredito que vá editar o banco de dados anyway.

  • tenta assim  local SHOP_MSG_TYPE = MESSAGE_EVENT_ORANGE local SQL_interval = 30 function onThink(interval, lastExecution) local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE

Postado

tenta assim 

local SHOP_MSG_TYPE = MESSAGE_EVENT_ORANGE
local SQL_interval = 30
 
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
local id = tonumber(result_plr:getDataInt("id"))
local action = tostring(result_plr:getDataString("action"))
local delete = tonumber(result_plr:getDataInt("delete_it"))
local cid = getCreatureByName(tostring(result_plr:getDataString("name")))
if isPlayer(cid) 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)
doItemSetAttribute(new_item, "description", "This item can only be used by the player ".. getPlayerName(cid) .."!")
doItemSetAttribute(new_item, "aid", getPlayerGUID(cid)+10000)
received_item = doPlayerAddItemEx(cid, new_item)
end
if received_item == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'Voce recebeu >> '.. add_item_name ..' << do Dramonio Shop.Obrigado pela compra, volte sempre!')
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 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

 

Ajudei? REP+

gLpfVZ6.png.1639daf943fbd385c7ba030675b6ffc0.png

DotA Event (TFS 1.x) => Clique Aqui

Skype: rike.sexy

Postado
  • Autor

@CirocReturn deu o erro denovo :(

Tentei os dois "executequery" e "query" com tudo mínusculo

Olha o erro:

 

[27/02/2017 15:51:04] [Error - GlobalEvent Interface] 
[27/02/2017 15:51:04] data/globalevents/scripts/shop.lua:onThink
[27/02/2017 15:51:04] Description: 
[27/02/2017 15:51:05] data/globalevents/scripts/shop.lua:55: attempt to call field 'executequery' (a nil value)
[27/02/2017 15:51:05] stack traceback:
[27/02/2017 15:51:05]     data/globalevents/scripts/shop.lua:55: in function <data/globalevents/scripts/shop.lua:4>
[27/02/2017 15:51:05] [Error - GlobalEvents::think] Couldn't execute event: shop

Postado

Tentou com db.executeQuery? Se não der certo, tenta botar db.getResult, não é o mais indicado a se fazer, mas acredito que vá editar o banco de dados anyway.

                                                                     Ajudei? De nada \o/                                            Att Rusherzin

Postado
  • Autor
1 hora atrás, Rusherzin disse:

Tentou com db.executeQuery? Se não der certo, tenta botar db.getResult, não é o mais indicado a se fazer, mas acredito que vá editar o banco de dados anyway.

Cara, onde que eu dou mais de 1 de REP pra vc, você conseguiu solucionar meu problema que estava a 1 semana já, nenhum forum, nenhum tópico tinha dito isso :D

Muito obrigado cara

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo