mais é pro site?
Script deathlist de unjustified e justified kills
Por Chupacabradoesgoto, 18 de ago. de 2015 em Scripts
info
Grupo: Lorde
Registrado: 22/07/12
Posts: 2.2k
Reputação: +453
Char no Tibia: Kissy

info
Grupo: Campones
Registrado: 09/07/15
Posts: 37
Reputação: +14
Gênero: Masculino

mais é pro site?
tanto faz, se for comando pra aparecer no game, ou pro site
info
Grupo: Lorde
Registrado: 22/07/12
Posts: 2.2k
Reputação: +453
Char no Tibia: Kissy

info
Grupo: Campones
Registrado: 09/07/15
Posts: 37
Reputação: +14
Gênero: Masculino

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
info
Grupo: Marquês
Registrado: 03/02/13
Posts: 1.2k
Reputação: +254
Gênero: Masculino
Char no Tibia: Partiu Baladinha

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 Agosto 19 por Fawz
info
Grupo: Campones
Registrado: 09/07/15
Posts: 37
Reputação: +14
Gênero: Masculino

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
info
Grupo: Campones
Registrado: 09/07/15
Posts: 37
Reputação: +14
Gênero: Masculino

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 endnã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>
info
Grupo: Marquês
Registrado: 03/02/13
Posts: 1.2k
Reputação: +254
Gênero: Masculino
Char no Tibia: Partiu Baladinha

Tópico Movido
Este tópico foi movido de "OTServ → Suporte OTServ → Suporte Scripting"
para "OTServ → Suporte OTServ → Suporte Scripting → Pedidos e dúvidas resolvidos - Scripting".



info
Grupo: Campones
Registrado: 09/07/15
Posts: 37
Reputação: +14
Gênero: Masculino
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