Ajuda arrumar !frags tempo ultimo frag

warriorfrog
em Scripts

warriorfrog

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 22/05/13Posts: 110

Alguém poderia me ajudar a arrumar meu !frags que mostra o tempo do ultimo frag?

Estou usando: 0.4

local config = {
  useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')),
  advancedFragList = getBooleanFromString(getConfigValue('advancedFragList'))
}

function onSay(cid, words, param, channel)
  if(not config.useFragHandler) then
  return false
  end


   local hours = math.floor(remainingSeconds / 3600)
   local minutes = math.floor((remainingSeconds % 3600) / 60)
   local seconds = remainingSeconds % 60

   local message = "You have " .. kills .. " unjustified kill" .. (kills > 1 and "s" or "") .. ". The amount of unjustified kills will decrease after: "
   if hours ~= 0 then
     if hours == 1 then
       message = message .. hours .. " hour, "
     else
       message = message .. hours .. " hours, "
     end
   end

   if hours ~= 0 or minutes ~= 0 then
     if minutes == 1 then
       message = message .. minutes .. " minute and "
     else
       message = message .. minutes .. " minutes and "
     end
   end

   if seconds == 1 then
     message = message .. seconds .. " second."
   else
     message = message .. seconds .. " seconds."
   end

   player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, message)
  return true
end

Erro:

http://i.imgur.com/ZkiU4kt.png

Night Wolf

Coordenador de Desenvolvimento
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 14/02/14Posts: 341Gênero: MasculinoChar no Tibia: Night Wolf

cara, esse sistema é de 1.x.. não é atoa que não funciona.

Sem falar que
local hours = math.floor(remainingSeconds / 3600)
local minutes = math.floor((remainingSeconds % 3600) / 60)
local seconds = remainingSeconds % 60


em nenhum momento vc declarou oque é remainingSeconds, por isso o erro.

I9AtE9T.png
/NW

warriorfrog

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 22/05/13Posts: 110

 

cara, esse sistema é de 1.x.. não é atoa que não funciona.

 

Sem falar que

local hours = math.floor(remainingSeconds / 3600)

local minutes = math.floor((remainingSeconds % 3600) / 60)

local seconds = remainingSeconds % 60

em nenhum momento vc declarou oque é remainingSeconds, por isso o erro.

 

 

Mas eu declaro ela como? Não tem nenhuma função como essa pra 0.4?

Pq tipo se eu colocar só local remaningSeconds não vai funcionar né!?

Night Wolf

Coordenador de Desenvolvimento
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 14/02/14Posts: 341Gênero: MasculinoChar no Tibia: Night Wolf

Meu server 8.6 tem esse sistema aqui:

 

function onSay(cid, words, param, channel)
	if(not getBooleanFromString(getConfigValue('useFragHandler'))) then
		return false
	end

	local time = os.time()
	local times = {today = (time - 86400), week = (time - (7 * 86400))}

	local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `k`.`war` = 0 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
	if(result:getID() ~= -1) then
		repeat
			local content = {
				name = result:getDataString("name"),
				level = result:getDataInt("level"),
				date = result:getDataInt("date")
			}
			if(content.date > times.today) then
				table.insert(contents.day, content)
			elseif(content.date > times.week) then
				table.insert(contents.week, content)
			else
				table.insert(contents.month, content)
			end
		until not result:next()
		result:free()
	end

	local size = {
		day = table.maxn(contents.day),
		week = table.maxn(contents.week),
		month = table.maxn(contents.month)
	}

	if(getBooleanFromString(getConfigValue('advancedFragList'))) then
		local result = "Frags gained today: " .. size.day .. "."
		if(size.day > 0) then
			for _, content in ipairs(contents.day) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end

			result = result .. "\n"
		end

		result = result .. "\nFrags gained this week: " .. (size.day + size.week) .. "."
		if(size.week > 0) then
			for _, content in ipairs(contents.week) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end

			result = result .. "\n"
		end

		result = result .. "\nFrags gained this month: " .. (size.day + size.week + size.month) .. "."
		if(size.month > 0) then
			for _, content in ipairs(contents.month) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end

			result = result .. "\n"
		end

		local skullEnd = getPlayerSkullEnd(cid)
		if(skullEnd > 0) then
			result = result .. "\nYour " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd)
		end

		doPlayerPopupFYI(cid, result)
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have " .. size.day .. " frags today, " .. (size.day + size.week) .. " this week and " .. (size.day + size.week + size.month) .. " this month.")
		if(size.day > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Last frag at " .. os.date("%d %B %Y %X", contents.day[1].date) .. " on level " .. contents.day[1].level .. " (" .. contents.day[1].name .. ").")
		end

		local skullEnd = getPlayerSkullEnd(cid)
		if(skullEnd > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd))
		end
	end

	return true
end

 

 

I9AtE9T.png
/NW

warriorfrog

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 22/05/13Posts: 110

Meu server 8.6 tem esse sistema aqui:

 

 

function onSay(cid, words, param, channel)
	if(not getBooleanFromString(getConfigValue('useFragHandler'))) then
		return false
	end

	local time = os.time()
	local times = {today = (time - 86400), week = (time - (7 * 86400))}

	local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `k`.`war` = 0 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
	if(result:getID() ~= -1) then
		repeat
			local content = {
				name = result:getDataString("name"),
				level = result:getDataInt("level"),
				date = result:getDataInt("date")
			}
			if(content.date > times.today) then
				table.insert(contents.day, content)
			elseif(content.date > times.week) then
				table.insert(contents.week, content)
			else
				table.insert(contents.month, content)
			end
		until not result:next()
		result:free()
	end

	local size = {
		day = table.maxn(contents.day),
		week = table.maxn(contents.week),
		month = table.maxn(contents.month)
	}

	if(getBooleanFromString(getConfigValue('advancedFragList'))) then
		local result = "Frags gained today: " .. size.day .. "."
		if(size.day > 0) then
			for _, content in ipairs(contents.day) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end

			result = result .. "\n"
		end

		result = result .. "\nFrags gained this week: " .. (size.day + size.week) .. "."
		if(size.week > 0) then
			for _, content in ipairs(contents.week) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end

			result = result .. "\n"
		end

		result = result .. "\nFrags gained this month: " .. (size.day + size.week + size.month) .. "."
		if(size.month > 0) then
			for _, content in ipairs(contents.month) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end

			result = result .. "\n"
		end

		local skullEnd = getPlayerSkullEnd(cid)
		if(skullEnd > 0) then
			result = result .. "\nYour " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd)
		end

		doPlayerPopupFYI(cid, result)
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have " .. size.day .. " frags today, " .. (size.day + size.week) .. " this week and " .. (size.day + size.week + size.month) .. " this month.")
		if(size.day > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Last frag at " .. os.date("%d %B %Y %X", contents.day[1].date) .. " on level " .. contents.day[1].level .. " (" .. contents.day[1].name .. ").")
		end

		local skullEnd = getPlayerSkullEnd(cid)
		if(skullEnd > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd))
		end
	end

	return true
end

 

 

 

Mas esse aí é diferente, não mostra em qnt tempo sai o frag, queria apenas mostrar qnt tempo falta pra limpar o frag

warriorfrog

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 22/05/13Posts: 110

Não teria como fazer como no underwar?

Que é assim:

19:59 You have 1 unjustified kill. The amount of unjustified kills will decrease after: 5 hours, 59 minutes and 57 seconds.

?????