Advertisement
Rochet2

PvP msg

Apr 10th, 2012
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local OnChat, GetList
  2. local low, high = 1, 50
  3.  
  4. function OnChat(event, pPlayer, pMessage, pType, pLanguage, pMisc)
  5.     local msg = pMessage:lower()
  6.     if(msg:find("[.!]top .+") == 1) then
  7.         local Amount = tonumber(msg:match("[.!]top (.+)"))
  8.         if(Amount) then
  9.             local str = tostring(pPlayer)
  10.             if(Amount <= high and Amount >= low) then
  11.                 local Q = CharDBQuery("SELECT name, pvprank FROM Characters ORDER BY pvprank DESC LIMIT "..Amount)
  12.                 if(Q) then
  13.                     for i = 1, Q:GetRowCount() do
  14.                         pPlayer:SendBroadcastMessage(i..". "..Q:GetColumn(0):GetString().." - "..Q:GetColumn(1):GetULong().." kills")
  15.                         Q:NextRow()
  16.                     end
  17.                 else
  18.                     pPlayer:SendBroadcastMessage("No players found")
  19.                 end
  20.             else
  21.                 pPlayer:SendBroadcastMessage("Bad value. "..low.."-"..high.." accepted.")
  22.             end
  23.         end
  24.         return false
  25.     end
  26. end
  27.  
  28. RegisterServerHook(16, OnChat)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement