Ir para conteúdo
  • 0

Ajuda LIB para quando acabar o tempo ser teleportado


vitinhoo96

Pergunta

Então queria sabe se alguem poderia me ajudar com esse LIB, pra quando p player estiver na cave exclusiva e der o tempo de 3 horas ele é teleportado para o templo x128 y61 z7

 

exclusives_caves_areas = { -- adicionar as caves
                       [1] = {name = "Exclusive Flame Dragon 1", price = 100000000, level = {min = 100, max =620}, time = 3, premium = false, enter = {x = 2999, y = 2452, z = 15}},
                       [2] = {name = "Exclusive Flame Dragon 2", price = 100000000, level = {min = 100, max = 620}, time = 3, premium = false, enter = {x = 2110, y = 2441, z = 15}},
					   [3] = {name = "Exclusive Baylor 1", price = 100000000, level = {min = 100, max =620}, time = 3, premium = false, enter = {x = 3020, y = 2569, z = 15}},
                       [4] = {name = "Exclusive Baylor 2", price = 100000000, level = {min = 100, max = 620}, time = 3, premium = false, enter = {x = 2908, y = 2575, z = 15}},
					   [5] = {name = "Exclusive Ceifador 1", price = 100000000, level = {min = 100, max =620}, time = 3, premium = false, enter = {x = 2682, y = 2459, z = 15}},
                       [6] = {name = "Exclusive Ceifador 2", price = 100000000, level = {min = 100, max = 620}, time = 3, premium = false, enter = {x = 2806, y = 2483, z = 15}},
					   [7] = {name = "Exclusive Fiery 1", price = 100000000, level = {min = 100, max =620}, time = 3, premium = false, enter = {x = 2669, y = 2390, z = 15}},
                       [8] = {name = "Exclusive Fiery 2", price = 100000000, level = {min = 100, max = 620}, time = 3, premium = false, enter = {x = 2702, y = 2421, z = 15}},
					   [9] = {name = "Exclusive Serpent Venenom 1", price = 100000000, level = {min = 100, max =620}, time = 3, premium = false, enter = {x = 2799, y = 2429, z = 15}},
                       [10] = {name = "Exclusive Serpent Venenom 2", price = 100000000, level = {min = 100, max = 620}, time = 3, premium = false, enter = {x = 2890, y = 2438, z = 15}},
					   [11] = {name = "Exclusive Crystalping 1", price = 100000000, level = {min = 100, max =620}, time = 3, premium = false, enter = {x = 2665, y = 2279, z = 15}},
                       [12] = {name = "Exclusive Crystalping 2", price = 100000000, level = {min = 100, max = 620}, time = 3, premium = false, enter = {x = 2763, y = 2279, z = 15}},
                       [13] = {name = "Exclusive Dipsochelys 1", price = 100000000, level = {min = 100, max =620}, time = 3, premium = false, enter = {x = 2830, y = 2254, z = 15}},
                       [14] = {name = "Exclusive Dipsochelys 2", price = 100000000, level = {min = 100, max = 620}, time = 3, premium = false, enter = {x = 2920, y = 2262, z = 15}},
					   [15] = {name = "Exclusive Frozen Dragon 1", price = 100000000, level = {min = 100, max =620}, time = 3, premium = false, enter = {x = 2972, y = 2317, z = 15}},
                       [16] = {name = "Exclusive Frozen Dragon 1", price = 100000000, level = {min = 100, max =620}, time = 3, premium = false, enter = {x = 3023, y = 2328, z = 15}},
                       [17] = {name = "Exclusive Magro Negro 1", price = 100000000, level = {min = 100, max = 620}, time = 3, premium = false, enter = {x = 3063, y = 2259, z = 15}},
					   [18] = {name = "Exclusive Magro Negro 2", price = 100000000, level = {min = 100, max = 620}, time = 3, premium = false, enter = {x = 3064, y = 2354, z = 15}},
					   }
                       
                                             
exclusives_caves_config = {
                        storage = 547575,
                        check =  547576,
                        comand_add_exaust = {hours = 1, storage = 547577}, -- tempo para nao ficar toda hora tirando e colocando amigo
                        mensagem = "[Exclusive Cave System] Você foi removido ou o tempo da %s cave expirou!",
                        serve_mensagem = "[Exclusive Cave System] A cave %s acabou de ficar liberada para venda por %d Gold's, aproveitem para compra-la no NPC!"
                        }




 -- [[ Functions To Owner System ]]--
function getCaveByPlayerID(cid)
	local qry = db.getResult("SELECT `cave_id` FROM `exclusive_cave` WHERE `account_id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
	if (qry:getID() ~= -1) then
			return qry:getDataInt("cave_id")
	end
	return 0
end
function getCanBuyCave(id)
	local qry = db.getResult("SELECT `id` FROM `exclusive_cave` WHERE `cave_id` = " .. id)
	if (qry:getID() ~= -1) then
			return false
	end
	return true
end
function doPlayerAddCave(cid, cave_id, hours)
	return db.executeQuery("INSERT INTO `exclusive_cave` (`account_id`, `player_id`, `player_name`, `cave_id`, `friend_id`, `time`) VALUES ('".. getPlayerAccountId(cid) .."', '".. getPlayerGUID(cid).."', '".. getCreatureName(cid) .."', '".. cave_id .."', '0', '".. os.time()+hours*3600 .."');")
end
function doDeleteExclusiveCave(cave_id)
         return db.executeQuery("DELETE FROM `exclusive_cave` WHERE `cave_id` = "..cave_id)
end
function doAddAcessFriendCave(cid, id)
         return db.executeQuery("UPDATE `exclusive_cave` SET `friend_id` = "..id.." WHERE `account_id` = "..getPlayerAccountId(cid))
end
function doRemoveAcessFriendCave(cid)
         return db.executeQuery("UPDATE `exclusive_cave` SET `friend_id` = 0  WHERE `account_id` = "..getPlayerAccountId(cid))
end
function getTimeByCave(id)
	local qry = db.getResult("SELECT `time` FROM `exclusive_cave` WHERE `cave_id` = "..id)
	if qry:getDataInt("time") - os.time() <= 0 then
		return 0
	end
	return timeString((-(os.time() - qry:getDataInt("time"))))
end
 -- [[ Functions To Friend System ]]--
function getFriendCaveOwner(cid)
	local qry = db.getResult("SELECT `friend_id` FROM `exclusive_cave` WHERE `account_id` = "..getPlayerAccountId(cid))
	return qry:getDataInt("friend_id")
end
function isCaveFriend(cid)
	local qry = db.getResult("SELECT `cave_id` FROM `exclusive_cave` WHERE `friend_id` = "..getPlayerGUID(cid))
	if (qry:getID() ~= -1) then
			return qry:getDataInt("cave_id")
	end
	return 0
end
function doLeaveCave(id)
         local qry = db.getResult("SELECT `account_id` FROM `exclusive_cave` WHERE `cave_id` = "..id)
         return db.executeQuery("UPDATE `exclusive_cave` SET `friend_id` = 0  WHERE `account_id` = "..qry:getDataInt("account_id"))	
end



function timeString(timeDiff)
	local dateFormat = {
		{"day", timeDiff / 60 / 60 / 24},
		{"hour", timeDiff / 60 / 60 % 24},
		{"minute", timeDiff / 60 % 60},
		{"second", timeDiff % 60}
	}
	local out = {}
	for k, t in ipairs(dateFormat) do
		local v = math.floor(t[2])
		if(v > 0) then
			table.insert(out, (k < #dateFormat and (#out > 0 and ', ' or '') or ' and ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
		end
	end
	local ret = table.concat(out)
	if ret:len() < 16 and ret:find("second") then
		local a, b = ret:find(" and ")
		ret = ret:sub(b+1)
	end
	
	return ret
end

 

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...