thankyou
Our sourceforge account was compromised and therefor the B3 projectfiles  are no longer safe to use.
Any windows installer and windows standalone version downloaded after 17 January 2015 might possibly be infected.
Run a tight anti virus check if you installed the windows binaries after 17 January 2015 or if you are not sure. (Report topic is here.)
Donate to the B3 fund!

"even a small donation helps!"
Donate with PayPal!
Year 2015 Donations
Apr-24 oldboss AUD10.00
Apr-16 embak EUR5.00
Mar-8 dobledosis USD5.00
Feb-17 |Brothers|-Chri... GBP10.00
Feb-8 [FTW]Banditas GBP5.00
Feb-8 oddball118 USD5.00
Feb-4 MordyT USD25.00
Developed with and

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 16317 times)

Offline KnightOrk

  • Jr. Member
  • **
  • Posts: 36
!rank for XLRStats
« on: June 01, 2010, 02:32:12 PM »
I modified the xlrstats.py Version 2.2.3

Now it allow to show the player his Rank...

This are the lines you have to add:

Open the xlrstats.py and search for:
Code: [Select]
    def cmd_xlrhide(self, data, client, cmd=None):

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

Now open xlrstats.xml and search for:
Code: [Select]
<set name="xlrhide">60</set>

Insert A Line above and write this:
Code: [Select]
                <set name="rank-rang">1</set>

Code was testet with Urt4.1 on my own Server, but why the Hell do i want this code? Cause People can see easy their Ranking on Statspage, but not in Game... So I wantedt that even low ranked Players can check their Ranking.

Have fun with this...

I can't post the whole Files, cause i modified many more... But most of my new Code is very special...

« Last Edit: June 25, 2010, 12:43:39 PM by KnightOrk »

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4861
    • Github repository
Re: !rank for XLRStats
« Reply #1 on: June 24, 2010, 09:03:11 AM »
nice work. Thanks for sharing.

Offline Padinn

  • Jr. Member
  • **
  • Posts: 44
Re: !rank for XLRStats
« Reply #2 on: June 24, 2010, 07:11:26 PM »
nice work. Thanks for sharing.


I can't for the life of me get this to work. Always says unrecognized command in game.

100624 13:08:34   VERBOSE   Parsing Event: Client Join Team: XlrstatsPlugin
100624 13:08:36   CONSOLE   ['player.onChat', 'Padinn', '/!rank', 'all']
100624 13:08:36   VERBOSE   Queueing event Say !rank
100624 13:08:36   VERBOSE   Parsing Event: Say: AdminPlugin
100624 13:08:36   DEBUG   AdminPlugin: OnSay handle 5:"!rank"
100624 13:08:36   DEBUG   AdminPlugin: Handle command !rank
100624 13:08:36   DEBUG   getCommand: ('admin.say', '(b3): [pm] Unrecognized command rank', 'player', 'Padinn')
100624 13:08:36   VERBOSE   RCON (1/1) ('admin.say', '(b3): [pm] Unrecognized command rank', 'player', 'Padinn')
100624 13:08:36   VERBOSE   Parsing Event: Say: ChatloggerPlugin

Offline Spoon

  • Sr. Member
  • ****
  • Posts: 254
    • EHD Gaming
Re: !rank for XLRStats
« Reply #3 on: June 24, 2010, 07:48:20 PM »
try adding
Code: [Select]
<set name="rank">1</set>
into your xlrstats.xml

Offline Padinn

  • Jr. Member
  • **
  • Posts: 44
Re: !rank for XLRStats
« Reply #4 on: June 24, 2010, 08:03:44 PM »
try adding
Code: [Select]
<set name="rank">1</set>
into your xlrstats.xml


It's not supposed to be rank-rang? I did as suggested in the OPs post and that's what I ended up with...after I fixed indentation and such.

Actually somehow managed to crash the entire unix server, not sure exactly how.
« Last Edit: June 24, 2010, 08:07:58 PM by Padinn »

Offline Spoon

  • Sr. Member
  • ****
  • Posts: 254
    • EHD Gaming
Re: !rank for XLRStats
« Reply #5 on: June 24, 2010, 08:10:39 PM »
you can use rank-rang i think

Offline Bakes

  • B3 Contrib/Support
  • Hero Member
  • *
  • Posts: 1226
Re: !rank for XLRStats
« Reply #6 on: June 24, 2010, 11:09:50 PM »
if you have rank only, !rank will be the only command you can use.

rank-rang means that you can use both !rank and !rang to get the rank - rang means rank in loads of languages (I believe French, Dutch, German, Romanian, Danish, Swedish, and more!)

Offline KnightOrk

  • Jr. Member
  • **
  • Posts: 36
Re: !rank for XLRStats
« Reply #7 on: June 25, 2010, 10:07:14 AM »
Bakes is right. I am from Germany and I always try to use english and german commands in my B3 Plugins.

That's why the Code uses
Code: [Select]
 def cmd_rank

And the Config allows you to use an other language.

You can also use:
Code: [Select]
 <set name="rank-rank_command_in_your_language">1</set>

Or for the english Version only: 
Code: [Select]
 <set name="rank">1</set>

Offline seanbarr1988

  • Full Member
  • ***
  • Posts: 82
    • NitroServers
Re: !rank for XLRStats
« Reply #8 on: October 13, 2010, 11:24:15 PM »
I seem to be getting an indentation error when i directly copy and paste the code into my xlrstats.py

Quote
101013 22:16:33 BOT     Loading Plugin #14 xlrstats [/home/nitro/b3/b3/extplugins/conf/xlrstats.xml]
101013 22:16:33 INFO    Could not load built in plugin xlrstats (No module named xlrstats)
101013 22:16:33 INFO    trying external plugin directory : /home/nitro/b3/b3/extplugins
101013 22:16:33 CRITICAL        Error loading plugin: unexpected indent (xlrstats.py, line 1300)
Traceback (most recent call last):
  File "/home/nitro/b3/b3/parser.py", line 526, in loadPlugins
    pluginModule = self.pluginImport(p)
  File "/home/nitro/b3/b3/parser.py", line 626, in pluginImport
    return imp.load_module(name, fp, pathname, description)
  File "/home/nitro/b3/b3/extplugins/xlrstats.py", line 1300
     sclient = client
    ^
 IndentationError: unexpected indent


Is it possible for womeone to upload a correctly modified version of the xlrstats.py to make this a simple swap out job  :D

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4861
    • Github repository
Re: !rank for XLRStats
« Reply #9 on: October 13, 2010, 11:32:56 PM »
that because you mixed tabs with spaces in your indentation

Offline seanbarr1988

  • Full Member
  • ***
  • Posts: 82
    • NitroServers
Re: !rank for XLRStats
« Reply #10 on: October 14, 2010, 12:10:39 AM »
but I copied and pasted it as is. 

I remember seeing you making a post on how to setup notepad++ with proper spacing but i cant seem to find it.

Offline seanbarr1988

  • Full Member
  • ***
  • Posts: 82
    • NitroServers
Re: !rank for XLRStats
« Reply #11 on: October 14, 2010, 12:44:09 AM »
ok I believe i have fixed the indentation since no more errors are given.

however it still does not work for me.


Quote
101013 23:37:40 CONSOLE 36:51 say: 0 |NS|NITR0: !rank
101013 23:37:40 VERBOSE Client Found: |NS|NITR0 on slot 0
101013 23:37:40 VERBOSE Queueing event Say !rank
101013 23:37:40 VERBOSE Parsing Event: Say: AdminPlugin
101013 23:37:40 DEBUG   AdminPlugin: OnSay handle 5:"!rank"
101013 23:37:40 DEBUG   AdminPlugin: Handle command !rank
101013 23:37:40 VERBOSE RCON sending (83.170.76.144:27960) tell 0 ^7 ^3[pm]^7 ^7Unrecognized command rank
101013 23:37:45 CONSOLE 36:56 say: 0 |NS|NITR0: !rank nitr0
101013 23:37:45 VERBOSE Client Found: |NS|NITR0 on slot 0
101013 23:37:45 VERBOSE Queueing event Say !rank nitr0
101013 23:37:45 VERBOSE Parsing Event: Say: AdminPlugin
101013 23:37:45 DEBUG   AdminPlugin: OnSay handle 5:"!rank nitr0"
101013 23:37:45 DEBUG   AdminPlugin: Handle command !rank nitr0
101013 23:37:45 VERBOSE RCON sending (83.170.76.144:27960) tell 0 ^7 ^3[pm]^7 ^7Unrecognized command rank
101013 23:37:52 CONSOLE 37:03 say: 0 |NS|NITR0: !rank |NS|NITR0
101013 23:37:52 VERBOSE Client Found: |NS|NITR0 on slot 0
101013 23:37:52 VERBOSE Queueing event Say !rank |NS|NITR0
101013 23:37:52 VERBOSE Parsing Event: Say: AdminPlugin
101013 23:37:52 DEBUG   AdminPlugin: OnSay handle 5:"!rank |NS|NITR0"
101013 23:37:52 DEBUG   AdminPlugin: Handle command !rank |NS|NITR0
101013 23:37:52 VERBOSE RCON sending (83.170.76.144:27960) tell 0 ^7 ^3[pm]^7 ^7Unrecognized command rank


This is in my xlrstats.xml file

Code: [Select]
	</settings>
<settings name="commands">
<set name="xlrstats-stats">1</set>
<set name="xlrtopstats-topstats">2</set>
<set name="rank">1</set>
<set name="xlrhide">60</set>
</settings>


Offline seanbarr1988

  • Full Member
  • ***
  • Posts: 82
    • NitroServers
Re: !rank for XLRStats
« Reply #12 on: October 15, 2010, 06:32:40 PM »
Got it working  :D
« Last Edit: October 15, 2010, 09:35:23 PM by seanbarr1988 »

Offline RCONHostingServices

  • Jr. Member
  • **
  • Posts: 29
    • RCON Hosting Services
Re: !rank for XLRStats
« Reply #13 on: January 05, 2011, 12:41:55 PM »
Would this B3 !rank replace !xlrstats and show the same data as !xlrstats would or does it ADD !rank command so both commands can be used to display the same data?

I am looking to ADD !rank to display the same data !xlrstats does while keeping the !xlrstats command.
RCON Hosting Services - http://rconhostingservices.net


Offline KnightOrk

  • Jr. Member
  • **
  • Posts: 36
Re: !rank for XLRStats
« Reply #14 on: January 05, 2011, 04:11:38 PM »
Would this B3 !rank replace !xlrstats and show the same data as !xlrstats would or does it ADD !rank command so both commands can be used to display the same data?

I am looking to ADD !rank to display the same data !xlrstats does while keeping the !xlrstats command.

The Command !xlrstats would work like before!
It only add a NEW Command called !rank to see Ingame the XLR Skill Rank of the Player.

I will try to seperate my command for a Pure Rank Plugin soon.

 


Rate this page +1 at Google Search

anything