Ir para conteúdo

Featured Replies

Postado
  • Solução

@jNo como você sabe, tem 3x tipos para ganhar as skulls, dia, semana e mês, tanto pra red quanto pra black.

Como não sabia qual você queria, fiz do jeito que você pediu, só que por dias, mostra quantos frags falta por dia, tanto pra red quanto pra black. Espero que seja isso:

Spoiler

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 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 `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(config.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_RED, "You currently have " .. size.day .. " frags today, " .. (size.day + size.week) .. " this week and " .. (size.day + size.week + size.month) .. " this month.")
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have [" .. size.day .. "/"..getConfigValue('dailyFragsToRedSkull').."] to red skull.")
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have [" .. size.day .. "/"..getConfigValue('dailyFragsToBlackSkull').."] to black skull.")
		if(size.day > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "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_RED, "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

 

 

Mais algo que me veio na mente é: se já mostra quantos frags por dia para as skulls, para que esses dois de baixo ? Ou não conseguir compreender o seu pedido e fiz errado ?

                                                              ezgif-1-98aab239f3.gif.1a897c9c3225228909e7b356a5cfb8e4.gif

  • Respostas 7
  • Visualizações 359
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • @jNo como você sabe, tem 3x tipos para ganhar as skulls, dia, semana e mês, tanto pra red quanto pra black. Como não sabia qual você queria, fiz do jeito que você pediu, só que por dias, mostra q

Postado

@jNo cara, pra ser sincero, achei estranho pra krl, me perdoe o palavrão. Hahahha. 

O limite de frags [1/xx], o xx, é pego direto do config lua, o limite máximo de frags ele pega o numero máximo daqui: dailyFragsToRedSkull = 30, se aqui é 30, no script será 30, o mesmo vale para black skull, dailyFragsToBlackSkull = 350.

E isso só vale para os frags diários, não conta frags da semana e mês.

 

Em fim..ç

 

Abraços, fica na paz, e boa sorte com seu server!

 

                                                              ezgif-1-98aab239f3.gif.1a897c9c3225228909e7b356a5cfb8e4.gif

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.9k

Informação Importante

Confirmação de Termo