Ir para conteúdo

Sistema De Deathlist


Posts Recomendados

Olá XTibianos,

 

hoje vim aqui para mostrar uma talkaction muito legal, retirada do Styfler Yourots.

 

Crie uma pasta em data/talkactions/script chamada deathlist.lua e bote isso dentro dela:

 

function onSay(cid, words, param)
local target = db.getResult("SELECT `name`, `id` FROM `players` WHERE `name` = " .. db.escapeString(param) .. ";")
if(target:getID() ~= -1) then
local targetName = target:getDataString("name")
local targetGUID = target:getDataInt("id")
target:free()

local str = ""
local deaths = db.getResult("SELECT `time`, `level`, `killed_by`, `altkilled_by` FROM `player_deaths` WHERE `player_id` = " .. targetGUID .. " ORDER BY `time` DESC;")
if(deaths:getID() ~= -1) then
local breakline = ""

while(true) do
if(str ~= "") then
breakline = "\n"
end

local time = os.date("%d %B %Y %X ", deaths:getDataInt("time"))
local level = deaths:getDataInt("level")
local killed = ""
local lastHitKiller = deaths:getDataString("killed_by")
local mostDamageKiller = deaths:getDataString("altkilled_by")

if(tonumber(lastHitKiller)) then
killed = getPlayerNameByGUID(tonumber(lastHitKiller))
else
killed = getArticle(lastHitKiller) .. " " .. string.lower(lastHitKiller)
end

if(mostDamageKiller ~= "") then
if(tonumber(mostDamageKiller)) then
killed = killed .. " and by " .. getPlayerNameByGUID(tonumber(mostDamageKiller))
else
killed = killed .. " and by " .. getArticle(mostDamageKiller) .. " " .. string.lower(mostDamageKiller)
end
end

str = str .. breakline .. " " .. time .. " Died at Level " .. level .. " by " .. killed .. "."
if not(deaths:next()) then
break
end
end
deaths:free()
else
str = "No deaths recorded."
end
doPlayerPopupFYI(cid, "Deathlist for player: " .. targetName .. ".\n\n" .. str)
else
doPlayerSendCancel(cid, "Este Jogador Não Existe")
end
return TRUE
end

 

Depois vai em data/talkactions/talkactions.xml e bote isso:

 

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

 

Então é isso, espero ter ajudado.

 

Créditos by: Styfler

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...