Ir para conteúdo

Featured Replies

Postado

Bom dia Tibia King!!

Senhores, estou com o seguinte problema:

Utilizo  TF 0.4 3777, o mining system do meu servidor ele funciona super bem porém quando os players estão cm as bps cheia os itens começam a cair no chao e  eu não estou conseguindo adicionar na script uma bloqueador para parar de minerar quando não tiver mais slot na bp ou x itens no chão.

 

Spoiler

terra = {873,4477,4468,4478,4471,4475,4476,1304,4474,8215,8214,3631,3630,1309,5622,5709,5624}
 levels = {
[-1] = 2229, ---- skull 50
[0] = 1294, --- small stone 60
[1] = 3976, --- worm 70
[20] = 2149, -- Small Emerald 80
[30] = 2146, -- Small Sapphire 90 
[40] = 2145, -- Small Diamond 100
[50] = 2150, -- Small Amethyst 110
[60] = 2147, -- Small Ruby 120
[70] = 2144, -- Black Pearls 130
[80] = 2143, -- White Pearls 140
[90] = 7761, -- small enchanted emerald 150
[100] = 7759, -- Small Enchanted Sapphiire 160
[110] = 7762, -- Small Enchanted Amethyst 170
[120] = 7760, -- Small Enchanted Ruby 180


local config = {
storage = 19333,
chance = 40, --- chance de achar um item ou não
k = 2, --- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante)
experience = 19334
}


function onUse(cid, item, fromPosition, itemEx, toPosition)


local drops = {}


function getDrops(cid)
for i= -1,getPlayerStorageValue(cid, config.storage) do
if levels then
table.insert(drops, levels)
end
end
return true
end


if isInArray(terra, itemEx.itemid) then
getDrops(cid)
doPlayerSetStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience)+1)
local experience = getPlayerStorageValue(cid, config.experience)
if experience >= (8+(getPlayerStorageValue(cid, config.storage)^2))/config.k then
doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1)
doPlayerSendTextMessage(cid, 27, "Congratulations, you have leveled! Your currect level is "..getPlayerStorageValue(cid, config.storage) ..".")
if getPlayerStorageValue(cid, config.storage) == 50 then
doPlayerSendTextMessage(cid, 20, "For reaching level "..getPlayerStorageValue(cid, config.storage) .." you have been awarded with Mining Helmet.")
doPlayerAddItem(cid, 7497, 1, true)
end
end
if config.chance >= math.random(1,100) then
if #drops >= 1 then
local item = drops[math.random(1,#drops)]
doPlayerSendTextMessage(cid, 27, "You have found a "..getItemNameById(item)..".")
doPlayerAddItem(cid, item, 1, true)
end
doSendMagicEffect(toPosition, 3)
else
doSendMagicEffect(toPosition, 2)
return true
end
elseif itemEx.itemid == item.itemid then
doPlayerSendTextMessage(cid, 27, "You're currenctly level "..getPlayerStorageValue(cid, config.storage)..".")
else
return false
end
return true
end

 

Isso está causando Lag no meu servidor.

 

Alguém poderia me ajuda a resolver??

 

Desde já obrigado.

Postado

Testa aí, (=

terra = {873,4477,4468,4478,4471,4475,4476,1304,4474,8215,8214,3631,3630,1309,5622,5709,5624}
levels = {
	[-1] = 2229, ---- skull 50
	[0] = 1294, --- small stone 60
	[1] = 3976, --- worm 70
	[20] = 2149, -- Small Emerald 80
	[30] = 2146, -- Small Sapphire 90 
	[40] = 2145, -- Small Diamond 100
	[50] = 2150, -- Small Amethyst 110
	[60] = 2147, -- Small Ruby 120
	[70] = 2144, -- Black Pearls 130
	[80] = 2143, -- White Pearls 140
	[90] = 7761, -- small enchanted emerald 150
	[100] = 7759, -- Small Enchanted Sapphiire 160
	[110] = 7762, -- Small Enchanted Amethyst 170
	[120] = 7760, -- Small Enchanted Ruby 180
} 


local config = {
	storage = 19333,
	chance = 40, --- chance de achar um item ou não
	k = 2, --- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante)
	experience = 19334
}


function onUse(cid, item, fromPosition, itemEx, toPosition)
	
	
	local drops = {}
	
	
	function getDrops(cid)
		for i= -1,getPlayerStorageValue(cid, config.storage) do
			if levels then
				table.insert(drops, levels)
			end
		end
		return true
	end
	
	
	if isInArray(terra, itemEx.itemid) then
		getDrops(cid)
		doPlayerSetStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience)+1)
		local experience = getPlayerStorageValue(cid, config.experience)
		if(getPlayerSlotItem(cid,CONST_SLOT_BACKPACK)) then
			local backpackSlots = getContainerSize(getPlayerSlotItem(cid,CONST_SLOT_BACKPACK).uid)
			
			if experience >= (8+(getPlayerStorageValue(cid, config.storage)^2))/config.k and not getContainerItem(cid, backpackSlots) then
				doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1)
				doPlayerSendTextMessage(cid, 27, "Congratulations, you have leveled! Your currect level is "..getPlayerStorageValue(cid, config.storage) ..".")
				if getPlayerStorageValue(cid, config.storage) == 50 then
					doPlayerSendTextMessage(cid, 20, "For reaching level "..getPlayerStorageValue(cid, config.storage) .." you have been awarded with Mining Helmet.")
					doPlayerAddItem(cid, 7497, 1, true)
				end
			end
			if config.chance >= math.random(1,100) and not getContainerItem(cid, backpackSlots) then
				if #drops >= 1 then
					local item = drops[math.random(1,#drops)]
					doPlayerSendTextMessage(cid, 27, "You have found a "..getItemNameById(item)..".")
					doPlayerAddItem(cid, item, 1, true)
				end
				doSendMagicEffect(toPosition, 3)
			else
				doSendMagicEffect(toPosition, 2)
				return true
			end
      	else
      		doPlayerSendTextMessage(cid, 27, "You haven't a backpack or free slots in backpack .")
		end
	elseif itemEx.itemid == item.itemid then
		doPlayerSendTextMessage(cid, 27, "You're currenctly level "..getPlayerStorageValue(cid, config.storage)..".")
	else
		return false
	end
	return true
end

 

Programador PHP, Lua, Java, database administrator.

 

"Nada é verdade, tudo é permitido."

Requiescat in pace.

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

Testa aí, (=


terra = {873,4477,4468,4478,4471,4475,4476,1304,4474,8215,8214,3631,3630,1309,5622,5709,5624}
levels = {
	[-1] = 2229, ---- skull 50
	[0] = 1294, --- small stone 60
	[1] = 3976, --- worm 70
	[20] = 2149, -- Small Emerald 80
	[30] = 2146, -- Small Sapphire 90 
	[40] = 2145, -- Small Diamond 100
	[50] = 2150, -- Small Amethyst 110
	[60] = 2147, -- Small Ruby 120
	[70] = 2144, -- Black Pearls 130
	[80] = 2143, -- White Pearls 140
	[90] = 7761, -- small enchanted emerald 150
	[100] = 7759, -- Small Enchanted Sapphiire 160
	[110] = 7762, -- Small Enchanted Amethyst 170
	[120] = 7760, -- Small Enchanted Ruby 180
} 


local config = {
	storage = 19333,
	chance = 40, --- chance de achar um item ou não
	k = 2, --- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante)
	experience = 19334
}


function onUse(cid, item, fromPosition, itemEx, toPosition)
	
	
	local drops = {}
	
	
	function getDrops(cid)
		for i= -1,getPlayerStorageValue(cid, config.storage) do
			if levels then
				table.insert(drops, levels)
			end
		end
		return true
	end
	
	
	if isInArray(terra, itemEx.itemid) then
		getDrops(cid)
		doPlayerSetStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience)+1)
		local experience = getPlayerStorageValue(cid, config.experience)
		if(getPlayerSlotItem(cid,CONST_SLOT_BACKPACK)) then
			local backpackSlots = getContainerSize(getPlayerSlotItem(cid,CONST_SLOT_BACKPACK).uid)
			
			if experience >= (8+(getPlayerStorageValue(cid, config.storage)^2))/config.k and not getContainerItem(cid, backpackSlots) then
				doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1)
				doPlayerSendTextMessage(cid, 27, "Congratulations, you have leveled! Your currect level is "..getPlayerStorageValue(cid, config.storage) ..".")
				if getPlayerStorageValue(cid, config.storage) == 50 then
					doPlayerSendTextMessage(cid, 20, "For reaching level "..getPlayerStorageValue(cid, config.storage) .." you have been awarded with Mining Helmet.")
					doPlayerAddItem(cid, 7497, 1, true)
				end
			end
			if config.chance >= math.random(1,100) and not getContainerItem(cid, backpackSlots) then
				if #drops >= 1 then
					local item = drops[math.random(1,#drops)]
					doPlayerSendTextMessage(cid, 27, "You have found a "..getItemNameById(item)..".")
					doPlayerAddItem(cid, item, 1, true)
				end
				doSendMagicEffect(toPosition, 3)
			else
				doSendMagicEffect(toPosition, 2)
				return true
			end
      	else
      		doPlayerSendTextMessage(cid, 27, "You haven't a backpack or free slots in backpack .")
		end
	elseif itemEx.itemid == item.itemid then
		doPlayerSendTextMessage(cid, 27, "You're currenctly level "..getPlayerStorageValue(cid, config.storage)..".")
	else
		return false
	end
	return true
end

 

 

Fala nazo bom dia! tive este problema ao bater a pick:

[11:52:27.116] [Error - Action Interface]
[11:52:27.118] data/actions/scripts/mining.lua:onUse
[11:52:27.157] Description:
[11:52:27.159] (luaGetContainerItem) Container not found

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