Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local T, OnChat, GetList = {}
- local low, high = 1, 50
- function OnChat(event, pPlayer, pMessage, pType, pLanguage, pMisc)
- local msg = pMessage:lower()
- if(msg:find("[.!]top .+") == 1) then
- local Amount = tonumber(msg:match("[.!]top (.+)"))
- if(Amount) then
- local str = tostring(pPlayer)
- if(Amount <= high and Amount >= low) then
- GetList(pPlayer, Amount)
- if(T[str]) then
- DestroyLuaEvent(T[str])
- end
- T[str] = CreateLuaEvent(function() GetList(pPlayer,Amount); end, 60000, 0)
- else
- pPlayer:SendBroadcastMessage("Bad value. "..low.."-"..high.." accepted. Use \"Stop\" to stop.")
- end
- else
- pPlayer:SendBroadcastMessage("Stopped PvP message")
- if(T[str]) then
- DestroyLuaEvent(T[str])
- end
- end
- return false
- end
- end
- function GetList(pPlayer, Amount)
- local Q = CharDBQuery("SELECT name, pvprank FROM Characters ORDER BY pvprank DESC LIMIT "..Amount)
- if(Q) then
- for i = 1, Q:GetRowCount() do
- pPlayer:SendBroadcastMessage(i..". "..Q:GetColumn(0):GetString().." - "..Q:GetColumn(1):GetULong().." kills")
- Q:NextRow()
- end
- else
- pPlayer:SendBroadcastMessage("No players found")
- end
- end
- RegisterServerHook(16, OnChat)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement