• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Top Killers

PHBS

New Member
Joined
Mar 25, 2009
Messages
28
Reaction score
0
Top Killers

(Srry bad english)

Hello, I'll post my script.

You must the Killed Monsters Counter script

And u can use: !killers MONSTER_NAME
Exemple: !killers rat

Create killers.lua in data/talkactions/scripts/killers.lua
and paste:

-- HIGHSCORE OF KILLERS! BY PHBS!
local monsters = {
--name = storage
["rat"] = 35001,
["cave rat"] = 35002,
["hydra"] = 35003,
["dragon"] = 35004
}


function onSay(cid, words, param)

-- max players on the highscore
local players = 20 -- The amount of players that is shown in the list

-- don't touch --
local str = ""
local value = ""
local name = ""
local player_id = 0
local result = nil
local namis = param
local crat = monsters[string.lower(namis)]
if (crat) then
str = "# Top "..param.." Killers\n"
value = "value"
player_id = "player_id"
result = db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = "..crat.." ORDER BY cast(`value` as DECIMAL) DESC, `player_id` ASC;")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Fale !killers [monster name].")
return TRUE
end
if (result:getID() ~= -1) then
local i = 1
while TRUE do
str = str .. "\n " .. i .. ". [" .. result:getDataInt(value) .. "] - " .. (name ~= "" and result:getDataString("name") or getPlayerNameByGUID(result:getDataInt(player_id)))
i = i+1
if not(result:next()) or i > players then
break
end
end
result:free()
end
if str ~= "" then
doPlayerPopupFYI(cid, str)
end
return TRUE
end

and add in talkactions.xml

<talkaction words="!killers" event="script" value="killers.lua"/>
 
Last edited:
Back
Top