Ir para conteúdo
  • Cadastre-se

(Resolvido)Comando !frags


Ir para solução Resolvido por Jamison Collins,

Posts Recomendados

Qual é a versão do seu servidor?

Pelo que eu entendi ele está dando erro na hora de buscar a informação size.dayblack

Uma solução paliativa seria remover essa função que busca os valores e os colocar manualmente

Trocar a linha 42 por essa:
 

  Citar

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Day: " .. size.day .. " (red skull: X DIAS / black skull: X DIAS)")

Mostrar mais  

Lembre-se de trocar X DIAS para os dias corretos.

Não garanto que vá funcionar, mas vale apena tentar.

Editado por grafit (veja o histórico de edições)

Att,
Grafit.

Link para o post
Compartilhar em outros sites
  • Solução

Tente isso:

local useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
 
function onSay(cid, words, param, channel)
	if(not 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),
		dayred = getConfigValue('dailyFragsToRedSkull'),
		dayblack = getConfigValue('dailyFragsToBlackSkull'),
		weekred = getConfigValue('weeklyFragsToRedSkull'),
		weekblack = getConfigValue('weeklyFragsToBlackSkull'),
		monthred = getConfigValue('monthlyFragsToRedSkull'),
		monthblack = getConfigValue('monthlyFragsToBlackSkull')
	}

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Day: " .. size.day .. " (red skull: " .. size.dayred .." / black skull: " .. size.dayblack .. ")")
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Week: " .. size.week .. " (red skull: " .. size.weekred .. " / black skull: " .. size.weekblack .. ")")
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Month: " .. size.month .. " (red skull: " .. size.monthred .. " / black skull: " .. size.monthblack .. ")")
 
	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
	return true
end

"A alma permanece em suas criações" V89E5aN.png


142c9d3439.jpg
(Não dou suporte por mensagem privada.)

Link para o post
Compartilhar em outros sites
  Em 02/03/2015 em 14:31, Jamison Collins disse:

 

Tente isso:

local useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
 
function onSay(cid, words, param, channel)
	if(not 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),
		dayred = getConfigValue('dailyFragsToRedSkull'),
		dayblack = getConfigValue('dailyFragsToBlackSkull'),
		weekred = getConfigValue('weeklyFragsToRedSkull'),
		weekblack = getConfigValue('weeklyFragsToBlackSkull'),
		monthred = getConfigValue('monthlyFragsToRedSkull'),
		monthblack = getConfigValue('monthlyFragsToBlackSkull')
	}

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Day: " .. size.day .. " (red skull: " .. size.dayred .." / black skull: " .. size.dayblack .. ")")
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Week: " .. size.week .. " (red skull: " .. size.weekred .. " / black skull: " .. size.weekblack .. ")")
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Month: " .. size.month .. " (red skull: " .. size.monthred .. " / black skull: " .. size.monthblack .. ")")
 
	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
	return true
end
Expand   Mostrar mais  

 

Perfeito, muito obrigado. REP+

Editado por ScythePhantom (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Estatísticas dos Fóruns

    96836
    Tópicos
    519589
    Posts
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo