Atualizado V1.0:
Mostra últimas mortes do servidor:
você pode usar o comando !deathlist NOME
ex: !deathlist Carlin:
in your db execute this query:
CREATE TABLE death_list ( id INTEGER NOT NULL, player_id INTEGER NOT NULL, date INTEGER NOT NULL, level INTEGER NOT NULL, killer_name INTEGER NOT NULL, PRIMARY KEY ( id ) );
creaturescript
death_list.lua
function onDeath(cid, corpse, deathList) local str = "" for _, pid in ipairs(deathList) do if isCreature(pid) == true then str = str.."".. (str == "" and "" or ",") ..""..getCreatureName(pid) else str = str.."".. (str == "" and "" or ",") .." a field item" end end str = str.."." death = str .. " ".. (getPlayerBlessing(cid, 5) and "[Blessed]" or getPlayerSlotItem(cid, 2).itemid == 2173 and "[AOL]" or "") db.executeQuery("INSERT INTO `death_list` (`player_id`, `date`, `level`, `killer_name`) VALUES ('".. getPlayerGUID(cid).."', '".. os.time() .."', '".. getPlayerLevel(cid) .."', '".. death .."');") return true end
creaturescript.xml
<event type="death" name="DeathList" event="script" value="death_list.lua"/>
creaturescript/script/login.lua
registerCreatureEvent(cid, "DeathList")
talkactions
deathlist.lua
limit = 5 function onSay(cid, words, param, channel) str = "" if param == "" then local qry = db.getResult("SELECT `player_id`, `date`, `level`, `killer_name` FROM `death_list` ORDER BY `date` DESC LIMIT 0, " .. limit) if(qry:getID() ~= -1) then repeat str = str .."\n "..os.date("%d %B %Y %X ", qry:getDataInt("date")).." "..getPlayerNameByGUID(qry:getDataString("player_id")).." died at level "..qry:getDataInt("level").." by:\n"..qry:getDataString("killer_name") until not(qry:next()) qry:free() else str = "Não há mortes no servidor." end doPlayerPopupFYI(cid, "Last Deaths:\n\n" .. str) return true end local getGuid = getPlayerGUIDByName(param:lower()) if not getGuid then doPlayerSendCancel(cid, "Este Player não existe.") return true end local qry = db.getResult("SELECT `id`, `date`, `level`, `killer_name` FROM `death_list` WHERE `player_id` = " .. getGuid .." ORDER BY `date` DESC LIMIT 0, " .. limit) if(qry:getID() ~= -1) then repeat str = str .."\n "..os.date("%d %B %Y %X ", qry:getDataInt("date")).." died at level "..qry:getDataInt("level").." by:\n"..qry:getDataString("killer_name") until not(qry:next()) qry:free() else str = "Não há mortes." end doPlayerPopupFYI(cid, "Last Deaths of: " .. param .. ".\n\n" .. str) return true end
talkactions.xml
<talkaction words="!deathlist" script="deathlist.lua"/>