Advertisement
Guest User

Untitled

a guest
Aug 10th, 2014
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. def cmd_rank(self, data, client, cmd=None):
  2.  
  3. """\
  4.  
  5. [<name>] - list a players XLR Skill Rank Position
  6. """
  7. if data:
  8. sclient = self._adminPlugin.findClientPrompt(data, client)
  9. if not sclient: return
  10. else:
  11. sclient = client
  12. #sclient = client
  13. id = sclient.id
  14. q = 'SELECT rang FROM (SELECT @rownum := @rownum +1 AS rang, statistic . * FROM (SELECT clients.name, clients.time_edit, xlr_playerstats.client_id, xlr_playerstats.id, kills, deaths, ratio, skill, winstreak, losestreak, rounds, fixed_name, ip FROM clients, xlr_playerstats WHERE ( clients.id = xlr_playerstats.client_id) AND ((xlr_playerstats.kills >1000) OR (xlr_playerstats.rounds >50)) AND (xlr_playerstats.hide =0) AND (UNIX_TIMESTAMP( NOW( ) ) - clients.time_edit <14 *60 *60 *24) AND clients.id NOT IN (SELECT DISTINCT (target.id) FROM penalties AS penalties, clients AS target WHERE (penalties.type = "Ban" OR penalties.type = "TempBan") AND inactive =0 AND penalties.client_id = target.id AND (penalties.time_expire = -1 OR penalties.time_expire > UNIX_TIMESTAMP( NOW( ) )))) AS statistic, (SELECT @rownum :=0) AS vars ORDER BY skill DESC) AS DATA WHERE client_id = %s' % (id)
  15. cursor = self.query(q)
  16. if (cursor and (cursor.rowcount > 0) ):
  17. r = cursor.getRow()
  18. self._rang = r['rang']
  19. q = 'SELECT count(id) as total from xlr_playerstats'
  20. cursor = self.query(q)
  21. if (cursor and (cursor.rowcount > 0) ):
  22. r = cursor.getRow()
  23. self._total = r['total']
  24. message = '^3XLR Ranking: ^7%s ^7: Rank ^2%s ^7out of ^2%s^7 total competing players' % (sclient.exactName, int(self._rang), int(self._total))
  25.  
  26. cmd.sayLoudOrPM(client, message)
  27. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement