Most of the plugins here are made by B3 users and the authors may not visit frequently. If you need support for plugins or if questions remain unanswered, you will have to contact the author directly. Read the full Support Disclaimer here
NOTE: Do not attach plugins to your forumtopics! Attachements are periodically removed by maintenance tasks. Upload your plugins to our Downloads section instead!

You are here: Big Brother Bot ForumAdd-OnsPlugins Discussion (Moderator: MordyT)admin plugin and second command for rules
Pages: [1]   Go Down
  Print  
Author Topic: admin plugin and second command for rules  (Read 686 times) Bookmark and Share
Jr. Member
**
OS: --No B3 installed--
Type: --No B3 installed--
Posts: 20
Offline Offline
« on: July 29, 2011, 12:12:36 PM »

My server is a multilingual, so I would like to add a new command in a different language rules.
I added them to the configuration and wprzeklei?em admin_plugin.xml wyedytowa?em command and rules in admin.py
when you type! rules and nothing happens

Rules in english - works fine comands !rules, !r

(( in admin_plugin.xml
<set name="rule1">^3Rule ^2#1: No racism of any kind</set>
<set name="rule2">^3Rule ^2#2:^3 No arguing with admins (listen and learn or ^1leave^3)</set>

etc ))
Code:
def cmd_rules(self, data, client=None, cmd=None):
        """\
        - say the rules
        """
        if not self.aquireCmdLock(cmd, client, 60, True):
            client.message('^7Do not spam commands')
            return

        m = self.parseUserCmd(data)
        if m:
            if client.maxLevel >= self.config.getint('settings', 'admins_level'):
                sclient = self.findClientPrompt(m[0], client)
                if not sclient:
                    return

                if sclient.maxLevel >= client.maxLevel:
                    client.message('%s ^7already knows the rules' % sclient.exactName)
                    return
                else:
                    client.message('^7Sir, Yes Sir!, spamming rules to %s' % sclient.exactName)
            else:
                client.message('^7Stop trying to spam other players')
                return
        elif cmd.loud:
            thread.start_new_thread(self._sendRules, (None,))
            return
        else:
            sclient = client

        thread.start_new_thread(self._sendRules, (sclient,))

    def _sendRules(self, sclient):
        rules = []

        for i in range(1, 20):
            try:
                rule = self.config.getTextTemplate('spamages', 'rule%s' % i)
                rules.append(rule)
            except:
                break

        if sclient:
            for rule in rules:
                sclient.message(rule)
                time.sleep(1)
        else:
            for rule in rules:
                self.console.say(rule)
                time.sleep(1)

Rules in Polish - commands !zasady !z

(( in admin_plugin.xml
<set name="zasada1"> TEXT1</set>
<set name="zasada2">TEXT2</set> ))

Code:
def cmd_zasady(self, data, client=None, cmd=None):
        """\
        - say the zasady
        """
        if not self.aquireCmdLock(cmd, client, 60, True):
            client.message('^7Do not spam commands')
            return

        m = self.parseUserCmd(data)
        if m:
            if client.maxLevel >= self.config.getint('settings', 'admins_level'):
                sclient = self.findClientPrompt(m[0], client)
                if not sclient:
                    return

                if sclient.maxLevel >= client.maxLevel:
                    client.message('%s ^7juz znasz wszystkie zasady' % sclient.exactName)
                    return
                else:
                    client.message('^7Sir, Tak jest!, spamuje zasady %s' % sclient.exactName)
            else:
                client.message('^7Przestan spamowac zasady innym gracza')
                return
        elif cmd.loud:
            thread.start_new_thread(self._sendZasady, (None,))
            return
        else:
            sclient = client

        thread.start_new_thread(self._sendZasady, (sclient,))

    def _sendZasady(self, sclient):
        zasady = []

        for i in range(1, 10):
            try:
                zasada = self.config.getTextTemplate('spamages', 'zasada', 'zasady' % i)
                zasady.append(zasada)
            except:
                break

        if sclient:
            for zasada in zasady:
                sclient.message(zasada)
                time.sleep(1)
        else:
            for zasada in zasady:
                self.console.say(zasada)
                time.sleep(1)

Could someone correct the possible error in the code?
Logged

Dev. Team
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: COD2,COD4,COD5
Posts: 1098
Offline Offline
« Reply #1 on: July 29, 2011, 12:24:53 PM »

Try https://github.com/Rhidalin-Bytes/International-rules
Logged
Jr. Member
**
OS: --No B3 installed--
Type: --No B3 installed--
Posts: 20
Offline Offline
« Reply #2 on: July 29, 2011, 12:34:55 PM »

too much for players to combine language setting, etc.
potzrebuje simple command! rules - eng
! xxxx - another language
This is much simpler - server is used to playing and not configuring the properties of languages ??and commands

;/
Logged
Dev. Team
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: COD2,COD4,COD5
Posts: 1098
Offline Offline
« Reply #3 on: July 29, 2011, 01:36:02 PM »

What errors do you get? You need to post your b3 log.
Logged
Moderator
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: 2x CoD4, 1x BF3
Posts: 2627
Offline Offline
Owner of Host4B3.com - Over 70 bots hosted!
WWW
« Reply #4 on: July 29, 2011, 02:32:32 PM »

Also you could set a alias for the rules command...
Logged

Need B3 Bot hosting? Check out Host4B3.com
Check Twitter.com/Host4B3 for updates if the site it down.

Help will be given to those with a b3.log

System: Python 2.7.1 - B3 Source Code - Locally hosted MySQL & Apache - Win 2k3
Jr. Member
**
OS: --No B3 installed--
Type: --No B3 installed--
Posts: 20
Offline Offline
« Reply #5 on: July 30, 2011, 06:08:15 AM »

Also you could set a alias for the rules command...

Hmm... but how? i totaly newbie in these things
Logged
Dev. Team
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: COD2,COD4,COD5
Posts: 1098
Offline Offline
« Reply #6 on: July 30, 2011, 09:36:14 AM »

Also you could set a alias for the rules command...

I don't think that would work, as I think he wants the rules to be in another language as well, not just the command to spam them. Have I understood correctly?
Logged
Jr. Member
**
OS: --No B3 installed--
Type: --No B3 installed--
Posts: 20
Offline Offline
« Reply #7 on: July 31, 2011, 03:09:59 PM »

As a topic, I command that works like the !Rules commands. I copied the command operation rules and I put the parameters for my command, but does not work .. and I do not understand why
Logged
Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 244
Offline Offline
« Reply #8 on: August 01, 2011, 02:22:13 AM »

First of all, you are mixing languages here:) I'm from Poland, so I get what you're saying,  but others might have troubles.

Second - if something is not working, paste b3.log. Otherwise we can't really do much:)

Third - I have better solution for You. Leave the original plugin, but modify the rules to the form:
<set name="rule1">^3Rule ^2#1: No racism of any kind | ^3Zasada ^2#1: Zakaz rasizmu w jakiejkolwiek postaci</set>
But take care about the length of the rules. Dont make them too long, because they would split into serveral lines.
Logged

Jr. Member
**
OS: --No B3 installed--
Type: Renting Server with B3
Gameservers: cod4
Posts: 21
Offline Offline
« Reply #9 on: August 24, 2011, 03:16:15 PM »

I can see this topic hasnt been discussed much recently but stumbled upon it and decided to take a look,
can see a possible issue
on the line where you have wrote:

zasada = self.config.getTextTemplate('spamages', 'zasada', 'zasady' % i)

i believe it should be

zasada = self.config.getTextTemplate('spamages', 'zasada%s' % i)

doubt i have helped but maybe i have so :p
Logged
Tags:
Pages: [1]   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal