SHOW:
|
|
- or go back to the newest paste.
| 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 |
| 8 | + | local str = tostring(pPlayer) |
| 9 | - | local str = tostring(pPlayer) |
| 9 | + | if(Amount and Amount <= high and Amount >= low) then |
| 10 | - | if(Amount <= high and Amount >= low) then |
| 10 | + | local Q = CharDBQuery("SELECT name, pvprank FROM Characters ORDER BY pvprank DESC LIMIT "..Amount)
|
| 11 | - | local Q = CharDBQuery("SELECT name, pvprank FROM Characters ORDER BY pvprank DESC LIMIT "..Amount)
|
| 11 | + | if(Q) then |
| 12 | - | if(Q) then |
| 12 | + | for i = 1, Q:GetRowCount() do |
| 13 | - | for i = 1, Q:GetRowCount() do |
| 13 | + | pPlayer:SendBroadcastMessage(i..". "..Q:GetColumn(0):GetString().." - "..Q:GetColumn(1):GetULong().." kills") |
| 14 | - | pPlayer:SendBroadcastMessage(i..". "..Q:GetColumn(0):GetString().." - "..Q:GetColumn(1):GetULong().." kills") |
| 14 | + | Q:NextRow() |
| 15 | - | Q:NextRow() |
| 15 | + | |
| 16 | - | end |
| 16 | + | |
| 17 | - | else |
| 17 | + | pPlayer:SendBroadcastMessage("No players found")
|
| 18 | - | pPlayer:SendBroadcastMessage("No players found")
|
| 18 | + | |
| 19 | else | |
| 20 | pPlayer:SendBroadcastMessage("Bad value. "..low.."-"..high.." accepted.")
| |
| 21 | - | pPlayer:SendBroadcastMessage("Bad value. "..low.."-"..high.." accepted.")
|
| 21 | + | |
| 22 | return false | |
| 23 | end | |
| 24 | end | |
| 25 | ||
| 26 | RegisterServerHook(16, OnChat) |