Guest User

HOF

a guest
Aug 27th, 2011
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.44 KB | None | 0 0
  1. -- by Xemorin --
  2. local lvl = {
  3.     [1] = {pos= {x = 92, y = 114, z = 7, stackpos = 1}, prof = 'all', text2 = 'player'}, -- lvl
  4.     [2] = {pos= {x = 93, y = 114, z = 7, stackpos = 1}, prof = '1, 5', text2 = 'sorcerer'}, -- sorcerer, ms
  5.     [3] = {pos= {x = 94, y = 114, z = 7, stackpos = 1}, prof = '2, 6', text2 = 'druid'}, -- druid, ed
  6.     [4] = {pos= {x = 95, y = 114, z = 7, stackpos = 1}, prof = '3, 7', text2 = 'paladin'}, -- palladin, rp
  7.     [5] = {pos= {x = 96, y = 114, z = 7, stackpos = 1}, prof = '4, 8', text2 = 'knight'}, -- knight, ek
  8.     --[index] = {pos = {pozycja, pamietaj o stackpos!}, prof = 'id profesji', text2 = 'string z nazwa profesji'},
  9. }
  10.  
  11. local skill = {
  12.     {pos = {x = 92, y = 114, z = 7, stackpos = 1}, skill = 0, text2 = 'fist'}, -- fist
  13.     {pos = {x = 93, y = 114, z = 7, stackpos = 1}, skill = 1, text2 = 'club'}, -- club
  14.     {pos = {x = 94, y = 114, z = 7, stackpos = 1}, skill = 2, text2 = 'sword'}, -- sword
  15.     {pos = {x = 95, y = 114, z = 7, stackpos = 1}, skill = 3, text2 = 'axe'}, -- axe
  16.     {pos = {x = 96, y = 114, z = 7, stackpos = 1}, skill = 4, text2 = 'dist'}, -- dist
  17.     {pos = {x = 97, y = 114, z = 7, stackpos = 1}, skill = 5, text2 = 'shield'}, -- shield
  18.     {pos = {x = 98, y = 114, z = 7, stackpos = 1}, skill = 6, text2 = 'fish'}, -- fishing
  19. }
  20. function onThink(interval)
  21.     local best, profe, kam = '', 0, 0
  22.     for index, options in ipairs(lvl) do
  23.         local kam = getThingFromPos(options.pos).uid
  24.         if(options.prof == 'all') then
  25.             best = db.getResult("SELECT `level`,`name` FROM `players` WHERE `group_id` < '2' AND `account_id` > '1' ORDER BY `experience` DESC LIMIT 1;")
  26.             if(best:getID() ~= -1) then
  27.                 doItemSetAttribute(kam, 'description', 'Currently, the best '..options.text2..' is '..best:getDataString('name')..' ('..best:getDataInt('level')..' level)')
  28.             else
  29.                 doItemSetAttribute(kam, 'description', 'Currently there are no characters')
  30.             end
  31.             doSendMagicEffect(options.pos, CONST_ME_FIREWORK_RED)
  32.         else
  33.             profe = string.explode(options.prof, ',')
  34.             best = db.getResult("SELECT `level`,`name` FROM `players` WHERE (`vocation` = '"..tonumber(profe[1]).."' OR `vocation` = '"..tonumber(profe[2]).."') AND `group_id` < '2' AND `account_id` > '1' ORDER BY `experience` DESC LIMIT 1;")
  35.             if(best:getID() ~= -1) then
  36.                 doItemSetAttribute(kam, 'description', 'Currently, the best '..options.text2..' is '..best:getDataString('name')..' ('..best:getDataInt('level')..' level)')
  37.             else
  38.                 doItemSetAttribute(kam, 'description', 'Currently, on a server doesn\'t play none '..options.text2)
  39.             end
  40.             doSendMagicEffect(options.pos, CONST_ME_FIREWORK_RED)
  41.         end
  42.     end
  43.    
  44.     for index, options in ipairs(skill) do
  45.         local kam = getThingFromPos(options.pos).uid
  46.         best = db.getResult("SELECT `player_id`, `value` FROM `player_skills` WHERE `skillid` = '"..options.skill.."' ORDER BY `count` DESC LIMIT 1;")
  47.         local name = getPlayerNameByGUID(best:getDataInt('player_id'))
  48.         if(best:getID() ~= -1 and name ~= '' and name ~= nil) then
  49.             doItemSetAttribute(kam, 'description', 'Currently, the biggest '..options.text2..'\'er is '..name..' ('..best:getDataInt('value')..' level)')
  50.         else
  51.             doItemSetAttribute(kam, 'description', 'Currently there are no characters')
  52.         end
  53.         doSendMagicEffect(options.pos, CONST_ME_FIREWORK_RED)
  54.     end
  55.     return true
  56. end
Advertisement
Add Comment
Please, Sign In to add comment