VI
action

Erro No Shop

Por viniciusBIG, 16 de mar. de 2014 em Scripts

shop
script
7
1.8k
viniciusBIGV
16 de março de 2014 às 14:47
​Olá eu estou tendo 1 erro no shop n sei se e essa a área correta se n for essa movam pra certa, enfim estou com 1 erro no shop que quando eu compro o item o item n chega e da esse seguinte erro:
[16/03/2014 14:37:50] [Error - GlobalEvent Interface] 
[16/03/2014 14:37:50] data/globalevents/scripts/shopModernAcc.lua:onThink
[16/03/2014 14:37:50] Description: 
[16/03/2014 14:37:50] data/globalevents/scripts/shopModernAcc.lua:20: attempt to call global 'doPlayerGiveItemSHOP' (a nil value)
[16/03/2014 14:37:50] stack traceback:
[16/03/2014 14:37:50] 	data/globalevents/scripts/shopModernAcc.lua:20: in function <data/globalevents/scripts/shopModernAcc.lua:1>
[16/03/2014 14:37:50] [Error - GlobalEvents::think] Couldn't execute event: shopModernAAC

alguem sabe oq é? esse e o shop que eu uso '-'

 

 

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"))
idTransaction = tonumber(result:getDataInt("id"))
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 = doPlayerGiveItemSHOP(cid, id, count, 0, idTransaction)
--received = doAddContainerItem(getPlayerSlotItem(cid, 3).uid, id,count)
if received == true 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 = doPlayerGiveItemContainer(cid, 1988, id, count, 0)
--received = doPlayerAddItemEx(getPlayerSlotItem(cid, 3).uid, bag)
if received == true 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

Editado Março 16 por viniciusBIG

u n d e rU
16 de março de 2014 às 16:54

Que resultado seu banco de dados retorna quando você executa este select?

 

SELECT * FROM shop_history WHERE `processed` = 0;

viniciusBIGV
16 de março de 2014 às 17:22

desculpe não entendi a pergunta, eu uso 1 site parecido ao dbo brasil, só da esse erro quando eu compro itens, quando eu compro premmy, não da erro algum oq será isso?

Junior001J
16 de março de 2014 às 17:31

Troque seu script do shop que fica no globalevents por este

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 Uma >> "..productn.." << do Shop System")
											db.executeQuery("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
										else
											doPlayerSendTextMessage(cid,19, "Desculpa, Você não tem espaço para receber o item >> "..productn.." <<")
										end
									else
										doPlayerSendTextMessage(cid,19, "Desculpa, Você não tem espaço para receber >> "..productn.." <<")
									end
								else
									doPlayerSendTextMessage(cid,19, "Desculpa, você não tem cap 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, "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

e vai na tag la no globalevents.xml e troque o interval para 1

viniciusBIGV
16 de março de 2014 às 17:55

Troque seu script do shop que fica no globalevents por este

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 Uma >> "..productn.." << do Shop System")
											db.executeQuery("UPDATE `shop_history` SET `processed`='1' WHERE id = " .. tid .. ";")
										else
											doPlayerSendTextMessage(cid,19, "Desculpa, Você não tem espaço para receber o item >> "..productn.." <<")
										end
									else
										doPlayerSendTextMessage(cid,19, "Desculpa, Você não tem espaço para receber >> "..productn.." <<")
									end
								else
									doPlayerSendTextMessage(cid,19, "Desculpa, você não tem cap 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, "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

e vai na tag la no globalevents.xml e troque o interval para 1

 

eu coloquei assim, não esta aparecendo o erro, mais em compensação o item n ta vindo '-' oq será? no shop aparece isso:

A PHP Error was encountered

Severity: 8192

Message: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

Filename: config/functions.php

Line Number: 12

e normal? '-'

aé, tbm apareceu isso no log do server: [16/03/2014 17:51:48] [Error - TalkAction Interface]

[16/03/2014 17:51:48] data/talkactions/scripts/createitem.lua:onSay
[16/03/2014 17:51:48] Description:
[16/03/2014 17:51:48] (luaDoPlayerAddItemEx) Item not found quando eu comprei outro item

Editado Março 16 por viniciusBIG

Junior001J
16 de março de 2014 às 18:03

Vá no localhost/phpmyadmin/suadb e execulte a db shop.sql que fica dentro da pasta gifts/config no seu htdocs :D

viniciusBIGV
16 de março de 2014 às 19:01

Vá no localhost/phpmyadmin/suadb e execulte a db shop.sql que fica dentro da pasta gifts/config no seu htdocs :D

 

como assim execulte? é a mesma coisa que importar? to na duvida, desculpe minha nubisse ;-;

duvida sanada, podem fechar o topico, eu vo dar rep+ pro junior silva quando eu puder, ja atingi meu limite! obg pela ajuda!