Ir para conteúdo
  • 0

Script deathlist de unjustified e justified kills


Chupacabradoesgoto

Pergunta

Ola todos sabem que a DeahList do tfs 0.3.0 não funciona, mas queria algo alternativo,

existe uma maneira de um script que mostre no site

as unjustified kills e justified kills?

algo alternativo pra eu testar se funciona, não precisa ter morte de monstro

Link para o comentário
Compartilhar em outros sites

8 respostass a esta questão

Posts Recomendados

  • 0

a sim esse é um script interessante, mas eu digo algo que vc veja a sua lista de quem vc matou e pra quem vc morreu,

esse q vc mandou é diferente

Link para o comentário
Compartilhar em outros sites

  • 0

a sim esse é um script interessante, mas eu digo algo que vc veja a sua lista de quem vc matou e pra quem vc morreu,

esse q vc mandou é diferente

Veja se funciona. Peguei do tfs 1.2 e regredi para versões anteriores.

 

Abra o talkactions.xml e cole essa tag:

<talkaction words="!deathlist;/deathlist" script="deathlist.lua"/>

Em data/talkactions/scripts crie um arquivo deathlist.lua dentro dele cole:

local function getArticle(str)
	return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a"
end

local function getMonthDayEnding(day)
	if day == "01" or day == "21" or day == "31" then
		return "st"
	elseif day == "02" or day == "22" then
		return "nd"
	elseif day == "03" or day == "23" then
		return "rd"
	else
		return "th"
	end
end

local function getMonthString(m)
	return os.date("%B", os.time{year = 1970, month = m, day = 1})
end

function onSay(cid, words, param)
	local resultId = db.storeQuery("SELECT `id`, `name` FROM `players` WHERE `name` = " .. db.escapeString(param))
	if resultId ~= false then
		local targetGUID = result.getDataInt(resultId, "id")
		local targetName = result.getDataString(resultId, "name")
		result.free(resultId)
		local str = ""
		local breakline = ""

		local resultId = db.storeQuery("SELECT `time`, `level`, `killed_by`, `is_player` FROM `player_deaths` WHERE `player_id` = " .. targetGUID .. " ORDER BY `time` DESC")
		if resultId ~= false then
			repeat
				if str ~= "" then
					breakline = "\n"
				end
				local date = os.date("*t", result.getDataInt(resultId, "time"))

				local article = ""
				local killed_by = result.getDataString(resultId, "killed_by")
				if result.getDataInt(resultId, "is_player") == 0 then
					article = getArticle(killed_by) .. " "
					killed_by = string.lower(killed_by)
				end

				if date.day < 10 then date.day = "0" .. date.day end
				if date.hour < 10 then date.hour = "0" .. date.hour end
				if date.min < 10 then date.min = "0" .. date.min end
				if date.sec < 10 then date.sec = "0" .. date.sec end
				str = str .. breakline .. " " .. date.day .. getMonthDayEnding(date.day) .. " " .. getMonthString(date.month) .. " " .. date.year .. " " .. date.hour .. ":" .. date.min .. ":" .. date.sec .. "   Died at Level " .. result.getDataInt(resultId, "level") .. " by " .. article .. killed_by .. "."
			until not result.next(resultId)
			result.free(resultId)
		end

		if str == "" then
			str = "No deaths."
		end
		doPlayerPopupFYI(cid, "Deathlist for player, " .. targetName .. ".\n\n" .. str)
	else
		doPlayersendCancelMessage(cid, "A player with that name does not exist.")
	end
	return false
end

Editado por Fawz
Link para o comentário
Compartilhar em outros sites

  • 0

 

Veja se funciona. Peguei do tfs 1.2 e regredi para versões anteriores.

 

Abra o talkactions.xml e cole essa tag:

<talkaction words="!deathlist;/deathlist" script="deathlist.lua"/>

Em data/talkactions/scripts crie um arquivo deathlist.lua dentro dele cole:

local function getArticle(str)
	return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a"
end

local function getMonthDayEnding(day)
	if day == "01" or day == "21" or day == "31" then
		return "st"
	elseif day == "02" or day == "22" then
		return "nd"
	elseif day == "03" or day == "23" then
		return "rd"
	else
		return "th"
	end
end

local function getMonthString(m)
	return os.date("%B", os.time{year = 1970, month = m, day = 1})
end

function onSay(cid, words, param)
	local resultId = db.storeQuery("SELECT `id`, `name` FROM `players` WHERE `name` = " .. db.escapeString(param))
	if resultId ~= false then
		local targetGUID = result.getDataInt(resultId, "id")
		local targetName = result.getDataString(resultId, "name")
		result.free(resultId)
		local str = ""
		local breakline = ""

		local resultId = db.storeQuery("SELECT `time`, `level`, `killed_by`, `is_player` FROM `player_deaths` WHERE `player_id` = " .. targetGUID .. " ORDER BY `time` DESC")
		if resultId ~= false then
			repeat
				if str ~= "" then
					breakline = "\n"
				end
				local date = os.date("*t", result.getDataInt(resultId, "time"))

				local article = ""
				local killed_by = result.getDataString(resultId, "killed_by")
				if result.getDataInt(resultId, "is_player") == 0 then
					article = getArticle(killed_by) .. " "
					killed_by = string.lower(killed_by)
				end

				if date.day < 10 then date.day = "0" .. date.day end
				if date.hour < 10 then date.hour = "0" .. date.hour end
				if date.min < 10 then date.min = "0" .. date.min end
				if date.sec < 10 then date.sec = "0" .. date.sec end
				str = str .. breakline .. " " .. date.day .. getMonthDayEnding(date.day) .. " " .. getMonthString(date.month) .. " " .. date.year .. " " .. date.hour .. ":" .. date.min .. ":" .. date.sec .. "   Died at Level " .. result.getDataInt(resultId, "level") .. " by " .. article .. killed_by .. "."
			until not result.next(resultId)
			result.free(resultId)
		end

		if str == "" then
			str = "No deaths."
		end
		doPlayerPopupFYI(cid, "Deathlist for player, " .. targetName .. ".\n\n" .. str)
	else
		doPlayersendCancelMessage(cid, "A player with that name does not exist.")
	end
	return false
end

vou testar

Link para o comentário
Compartilhar em outros sites

  • 0

 

Veja se funciona. Peguei do tfs 1.2 e regredi para versões anteriores.

 

Abra o talkactions.xml e cole essa tag:

<talkaction words="!deathlist;/deathlist" script="deathlist.lua"/>

Em data/talkactions/scripts crie um arquivo deathlist.lua dentro dele cole:

local function getArticle(str)
	return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a"
end

local function getMonthDayEnding(day)
	if day == "01" or day == "21" or day == "31" then
		return "st"
	elseif day == "02" or day == "22" then
		return "nd"
	elseif day == "03" or day == "23" then
		return "rd"
	else
		return "th"
	end
end

local function getMonthString(m)
	return os.date("%B", os.time{year = 1970, month = m, day = 1})
end

function onSay(cid, words, param)
	local resultId = db.storeQuery("SELECT `id`, `name` FROM `players` WHERE `name` = " .. db.escapeString(param))
	if resultId ~= false then
		local targetGUID = result.getDataInt(resultId, "id")
		local targetName = result.getDataString(resultId, "name")
		result.free(resultId)
		local str = ""
		local breakline = ""

		local resultId = db.storeQuery("SELECT `time`, `level`, `killed_by`, `is_player` FROM `player_deaths` WHERE `player_id` = " .. targetGUID .. " ORDER BY `time` DESC")
		if resultId ~= false then
			repeat
				if str ~= "" then
					breakline = "\n"
				end
				local date = os.date("*t", result.getDataInt(resultId, "time"))

				local article = ""
				local killed_by = result.getDataString(resultId, "killed_by")
				if result.getDataInt(resultId, "is_player") == 0 then
					article = getArticle(killed_by) .. " "
					killed_by = string.lower(killed_by)
				end

				if date.day < 10 then date.day = "0" .. date.day end
				if date.hour < 10 then date.hour = "0" .. date.hour end
				if date.min < 10 then date.min = "0" .. date.min end
				if date.sec < 10 then date.sec = "0" .. date.sec end
				str = str .. breakline .. " " .. date.day .. getMonthDayEnding(date.day) .. " " .. getMonthString(date.month) .. " " .. date.year .. " " .. date.hour .. ":" .. date.min .. ":" .. date.sec .. "   Died at Level " .. result.getDataInt(resultId, "level") .. " by " .. article .. killed_by .. "."
			until not result.next(resultId)
			result.free(resultId)
		end

		if str == "" then
			str = "No deaths."
		end
		doPlayerPopupFYI(cid, "Deathlist for player, " .. targetName .. ".\n\n" .. str)
	else
		doPlayersendCancelMessage(cid, "A player with that name does not exist.")
	end
	return false
end

não funcionou, deu esse erro no console:

[04/09/2015 21:52:23] Lua Script Error: [TalkAction Interface]
[04/09/2015 21:52:23] data/talkactions/scripts/deathlist.lua:onSay
[04/09/2015 21:52:23] luaDBResultGetDataInt(). Result not found.
[04/09/2015 21:52:23] Lua Script Error: [TalkAction Interface]
[04/09/2015 21:52:23] data/talkactions/scripts/deathlist.lua:onSay
[04/09/2015 21:52:23] luaDBResultGetDataString(). Result not found.
[04/09/2015 21:52:23] Lua Script Error: [TalkAction Interface]
[04/09/2015 21:52:23] data/talkactions/scripts/deathlist.lua:onSay
[04/09/2015 21:52:24] luaDBResultFree(). Result not found.
[04/09/2015 21:52:24] mysql_real_query(): SELECT `time`, `level`, `killed_by`, `is_player` FROM `player_deaths` WHERE `player_id` = -1 ORDER BY `time` DESC: MYSQL ERROR: Unknown column 'is_player' in 'field list'
[04/09/2015 21:52:24] mysql_store_result(): SELECT `time`, `level`, `killed_by`, `is_player` FROM `player_deaths` WHERE `player_id` = -1 ORDER BY `time` DESC: MYSQL ERROR: Unknown column 'is_player' in 'field list'
[04/09/2015 21:52:24] Lua Script Error: [TalkAction Interface]
[04/09/2015 21:52:24] data/talkactions/scripts/deathlist.lua:onSay
[04/09/2015 21:52:24] luaDBResultGetDataInt(). Result not found.
[04/09/2015 21:52:24] Lua Script Error: [TalkAction Interface]
[04/09/2015 21:52:24] data/talkactions/scripts/deathlist.lua:onSay
[04/09/2015 21:52:24] luaDBResultGetDataString(). Result not found.
[04/09/2015 21:52:24] Lua Script Error: [TalkAction Interface]
[04/09/2015 21:52:24] data/talkactions/scripts/deathlist.lua:onSay
[04/09/2015 21:52:24] luaDBResultGetDataInt(). Result not found.
[04/09/2015 21:52:24] Lua Script Error: [TalkAction Interface]
[04/09/2015 21:52:24] data/talkactions/scripts/deathlist.lua:onSay
[04/09/2015 21:52:24] data/talkactions/scripts/deathlist.lua:45: attempt to index local 'date' (a nil value)
[04/09/2015 21:52:24] stack traceback:
[04/09/2015 21:52:24] data/talkactions/scripts/deathlist.lua:45: in function <data/talkactions/scripts/deathlist.lua:21>

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...