thankyou
Donate to the B3 fund!

"even a small donation helps!"
Donate with PayPal!

Full documentation and information about XLRstats version 2 can be found at this subsection of our site.

Our upcoming XLRstats version 3 (League Edition) is currently being developed. You can have a glimpse on our main XLRstats website: www.xlrstats.com


Author Topic: !rank for XLRStats  (Read 22582 times)

Offline Sars

  • Full Member
  • ***
  • Posts: 72
Re: !rank for XLRStats
« Reply #30 on: May 30, 2011, 04:48:59 PM »
I notice today that if you run multiple xlrstats off the same database, the !rank command in this only recalls the default rank. Is there a way to make it recall the xlrstats from the tables that are being used by xlrstats and not the default?



Offline Sars

  • Full Member
  • ***
  • Posts: 72
Re: !rank for XLRStats
« Reply #31 on: June 01, 2011, 04:45:37 AM »
Quote
Insert above this Line:
Code: [Select]
    def cmd_rank(self, data, client, cmd=None):

        """\

        [<name>] - list a players XLR Skill Rank Position
        """

sclient = client
id = client.id

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)

cursor = self.query(q)
if not cursor.EOF:

r = cursor.getRow()      

message = '^3XLR Ranking: ^7%s ^7: Rank ^2%s' % (sclient.exactName, int(r['rang']))

cmd.sayLoudOrPM(client, message)

return
else:

client.message('^3XLR Ranking: ^7 %s is not Ranked' % sclient.exactName)        
return


This only works if you are running a single database and server, if you are running multiple server then you need to change the xlr_playerstats in this code to whatever you named the playerstats table for that server. This fixed my problem with all my servers saying the same rank even though we are on different tables.



Offline MistaObvious

  • Jr. Member
  • **
  • Posts: 16
Re: !rank for XLRStats
« Reply #32 on: June 06, 2011, 12:49:44 AM »
In the sql for this code, which is great btw, you have a hard-coded value for the minimum rounds and kills.  If I knew a little more about how to code in Python (which I'm thinking I might have to learn despite my laziness) I might understand how to change it, but wouldn't it be better to use the variables that are defined in the xlrstats.xml file?  I realize most haven't changed those values, but our install has.  Besides, it would be much more efficient, no?
« Last Edit: June 06, 2011, 01:26:24 AM by MistaObvious »

Offline cursecore

  • Jr. Member
  • **
  • Posts: 14
    • CurseGamers
Re: !rank for XLRStats
« Reply #33 on: February 19, 2012, 03:34:14 PM »
hey thx for this works great. anw i want to add some more informations on rank msg i try this:

Code: [Select]
message = '^3# %s: ^7%s ^7: Rank ^3%1.02f ^7Ratio ^5%1.02f ^7Kills: ^2%s' % (c, r['name'], r['rang'], r['ratio'], r['kills'])

but some error on this. any help?

Thank you!
cursegamers.com | Follow us on Twitter

Offline HazzMatt

  • Newbie
  • *
  • Posts: 4
Re: !rank for XLRStats
« Reply #34 on: February 21, 2012, 12:05:52 AM »
Hi im trying to get this to work but im having some trouble, im getting a "invalid syntax" error in my log for line 1485
http://pastebin.com/2hUe3Jbn
I'm not sure horw to fix it
here is my "xlrstats.py" file

any help would be appreciated

Offline 82ndAB.Bravo17

  • Dev. Team
  • Hero Member
  • *
  • Posts: 2611
Re: !rank for XLRStats
« Reply #35 on: February 21, 2012, 03:11:52 AM »
Lines 1484 & 1485 need one more indent in them - python uses indents to delimit code sections, so the corresponding if and next statements need to be indented the same amount, and everything in between needs more indent(s).

Offline HazzMatt

  • Newbie
  • *
  • Posts: 4
Re: !rank for XLRStats
« Reply #36 on: February 21, 2012, 05:15:56 AM »
okay thanks man, fixed the syntax problem but still says !rank is an unrecognised command in-game  ??? ???, I am renting B3 + xlrstats from host4b3 if that makes any difference
« Last Edit: February 21, 2012, 05:35:31 AM by HazzMatt »

Offline 82ndAB.Bravo17

  • Dev. Team
  • Hero Member
  • *
  • Posts: 2611
Re: !rank for XLRStats
« Reply #37 on: February 21, 2012, 06:17:52 AM »
Have you put it in the correct xml section?

Offline HazzMatt

  • Newbie
  • *
  • Posts: 4
Re: !rank for XLRStats
« Reply #38 on: February 21, 2012, 06:57:45 AM »
yea pretty sure its right
Code: [Select]
	</settings>
<settings name="commands">
<set name="xlrstats">1</set>
<set name="xlrtopstats">2</set>
<set name="rank">1</set>
<set name="xlrhide">60</set>
</settings>

Offline TmR

  • Full Member
  • ***
  • Posts: 94
Re: !rank for XLRStats
« Reply #39 on: February 21, 2012, 08:19:53 AM »
I'm having some issues with !rank after we used "recreate SQL" file, to reset all the stats...
My original topic: http://forum.bigbrotherbot.net/cod7-%28bo%29/!rank-not-working-after-reset/
Pastebin log: http://pastebin.com/U68PHdct
Pastebin xml file: http://www.ooc-clan.com/xlrstats/?config=1

What would be the reason that people get the "not ranked" msg?

Offline cursecore

  • Jr. Member
  • **
  • Posts: 14
    • CurseGamers
Re: !rank for XLRStats
« Reply #40 on: February 21, 2012, 09:45:01 AM »
I'm having some issues with !rank after we used "recreate SQL" file, to reset all the stats...
My original topic: http://forum.bigbrotherbot.net/cod7-%28bo%29/!rank-not-working-after-reset/
Pastebin log: http://pastebin.com/U68PHdct
Pastebin xml file: http://www.ooc-clan.com/xlrstats/?config=1

What would be the reason that people get the "not ranked" msg?

Paste you extplugins/xlrstats.py

Btw i also get this message when i join in the server. after some seconds its ok and i get my rank.
cursegamers.com | Follow us on Twitter

Offline TmR

  • Full Member
  • ***
  • Posts: 94
Re: !rank for XLRStats
« Reply #41 on: February 21, 2012, 09:47:47 AM »
Paste you extplugins/xlrstats.py

Btw i also get this message when i join in the server. after some seconds its ok and i get my rank.
http://pastebin.com/3YxbMaJx

Offline cursecore

  • Jr. Member
  • **
  • Posts: 14
    • CurseGamers
Re: !rank for XLRStats
« Reply #42 on: February 21, 2012, 10:12:56 AM »
http://pastebin.com/3YxbMaJx

download mine and test it. dont replace yours just move out from the folder.
yours looking correct but i see different size.

[attachment deleted by maintenance]
cursegamers.com | Follow us on Twitter

Offline MordyT

  • Support Hero
  • Hero Member
  • *
  • Posts: 3644
  • Over $300 Donated to B3!
    • MordyT
Re: !rank for XLRStats
« Reply #43 on: February 21, 2012, 02:49:03 PM »
okay thanks man, fixed the syntax problem but still says !rank is an unrecognised command in-game  ??? ???, I am renting B3 + xlrstats from host4b3 if that makes any difference
Can you use this file? http://forum.bigbrotherbot.net/xlrstats/!rank-for-xlrstats/?action=dlattach;attach=968
Credits to cursecore
Help will be given to those with a b3.log

If drop off the map it is due to RL becoming busy :)

System: Python 2.7.3 - Deb 7 - B3 Source Code - 128MB RAM box (rented at $5 a year) - remote MySQL - Remote Web Services

Offline TmR

  • Full Member
  • ***
  • Posts: 94
Re: !rank for XLRStats
« Reply #44 on: February 21, 2012, 04:19:03 PM »
download mine and test it. dont replace yours just move out from the folder.
yours looking correct but i see different size.
will do in 2 hours or so, when i get home! stay tuned =)

 


Rate this page +1 at Google Search

anything