You are here: Big Brother Bot ForumCommunity DevelopersPlugin Developers[Request] XLRStats on Map End for Everyone
Pages: [1]   Go Down
  Print  
Author Topic: [Request] XLRStats on Map End for Everyone  (Read 872 times) Bookmark and Share
Jr. Member
**
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 35
Offline Offline
« on: February 26, 2011, 02:33:31 PM »

I would like to have a Plugin Showing the XLRStats of Player!

So every Player get a PM with his Stats at MapEnd. Should be own Plugin, so i don't need to edit it every time xlrstats is updating...

Logged


Jr. Member
**
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 35
Offline Offline
« Reply #1 on: October 30, 2011, 08:59:30 PM »

Ok i wrote it myself.

Its called pmstats.py you will also need an empty plugin_pmstats.xml

Code:
__version__ = '1.0.1'
__author__  = 'KnightOrk'

from b3 import clients
import b3, os, string, re, threading
import b3.events
import b3.plugin


class PmstatsPlugin(b3.plugin.Plugin):
_xlrstatsPlugin = None

def onStartup(self):
self.registerEvent(b3.events.EVT_GAME_ROUND_END)
self.registerEvent(b3.events.EVT_GAME_EXIT)
self._xlrstatsPlugin = self.console.getPlugin('xlrstats')

def onEvent(self, event):
if event.type == b3.events.EVT_GAME_ROUND_END or event.type == b3.events.EVT_GAME_EXIT:
self.show_stats()

def show_stats(self):
d= {}
for player in self.console.clients.getList():
        if not d.has_key(player.name):
          d[player.name] = [player.cid]
        else:
          d[player.name].append(player.cid)
     
      for pname,cidlist in d.items():
        if (len(pname) > 0):
          for cid in cidlist:
          client = self.console.clients.getByCID(cid)
  stats = self._xlrstatsPlugin.get_PlayerStats(client)
if stats:          
client.message( '^3XLR Stats: ^7%s ^7: K ^2%s ^7D ^3%s ^7TK ^1%s ^7Ratio ^5%1.02f ^7Skill ^3%1.02f' % (client.exactName, stats.kills, stats.deaths, stats.teamkills, stats.ratio, stats.skill))

Logged

Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #2 on: October 31, 2011, 02:34:07 AM »

here is your plugin which does not requires a config file (avoid to make an empty one)
Logged

Tags:
Pages: [1]   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal