• 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 Command !rank Update

Critico

Sexy
Joined
Mar 25, 2010
Messages
370
Reaction score
176
Ranks:

All Skills
level
magic
health
mana
frags

Rank All Vocations

exemple:

!rank frags
!rank magic
!rank druid -- show top level druid/elder druid
!rank knight -- show top level knight/elite knight druid

data/talkactions/ranks.lua
Lua:
local config = {
MaxPlayer = 20,
fight_skills = {
        ['fist'] = 0,
        ['club'] = 1,
        ['sword'] = 2,
        ['axe'] = 3,
        ['distance'] = 4,
        ['shielding'] = 5,
        ['fishing'] = 6,
        ['dist'] = 4,
        ['shield'] = 5,
        ['fish'] = 6,
},
other_skills = {
[''] = "level",
['level'] = "level",
['magic'] = "maglevel",
['health'] = "healthmax",
['mana'] = "manamax"
},
vocations = {
['sorcerer'] = {1,5},
['druid'] = {2,6},
['paladin'] = {3,7},
['knight'] = {4,8}
},
storages = {
['frags'] = 824544
}
}
function onSay(cid, words, param)
local store,exausted = 156201,30
local param,str = string.lower(param),""
if not config.fight_skills[param] and not config.other_skills[param] and not config.vocations[param] and not config.storages[param] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "this ranking does not exists.") return true
elseif getPlayerStorageValue(cid, store) >= os.time() then
doPlayerSendCancel(cid, "wait " .. getPlayerStorageValue(cid, store) - os.time() .. " seconds to use this command again.") return true
end
str = "--[ RANK "..(param == "" and "LEVEL" or string.upper(param)).." ]--\n\n"
query = config.fight_skills[param] and db.getResult("SELECT `player_id`, `value` FROM `player_skills` WHERE `skillid` = "..config.fight_skills[param].." ORDER BY `value` DESC;") or config.other_skills[param] and db.getResult("SELECT `name`, `"..config.other_skills[param].."` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `"..config.other_skills[param].."` DESC, `name` ASC;") or config.storages[param] and db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = "..config.storages[param].." ORDER BY cast(value as INTEGER) DESC;") or db.getResult("SELECT `name`, `level` FROM `players` WHERE `group_id` <= 2 AND `vocation` = "..config.vocations[param][1].." or `vocation` = "..config.vocations[param][2].." ORDER BY `level` DESC;") 
if (query:getID() ~= -1) then 
k = 1 
while true do
str = str .. "\n " .. k .. ". "..(config.fight_skills[param] and getPlayerNameByGUID(query:getDataString("player_id")) or config.storages[param] and getPlayerNameByGUID(query:getDataString("player_id")) or query:getDataString("name")).." - [" .. query:getDataInt((config.fight_skills[param] and "value" or config.storages[param] and "value" or config.vocations[param] and "level" or config.other_skills[param])) .. "]"
k = k + 1
if not(query:next()) or k > config.MaxPlayer then
break 
end 
end 
query:free()
end
doShowTextDialog(cid,6500, str)
setPlayerStorageValue(cid, store, os.time()+exausted) 
return true
end

In data/lib/050-function.lua add:
Code:
function setFrags(cid)
if not isCreature(cid) then return LUA_ERROR end
setPlayerStorageValue(cid, 824544, getPlayerFrags(cid))
return doPlayerSave(cid)
end

data/creaturescript/script

rankfrags.lua
Lua:
function onKill(cid, target, lastHit)
if isPlayer(cid) and isPlayer(target) then
addEvent(setFrags, 1, cid)
end
return true
end

data/creaturescript/script/login.lua before the last 'return true' add:
Code:
registerCreatureEvent(cid, "Rankfrags")
setFrags(cid)
 
Last edited:
everything works fine exept !highscore frag, when using give a frezes
any idea?
 
change "este rank não existe." to "this ranking does not exists." and also add an exhaustion feature, so users will not load the ot with lots of queries all the time
 
Back
Top