Donate to the B3 fund!

"even a small donation helps!"
Donate with PayPal!
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!

Author Topic: Private Message Plugin request  (Read 3149 times)

Offline foxinabox

  • Sr. Member
  • ****
  • Posts: 157
    • Clan ATRS (Atreides)
Private Message Plugin request
« on: October 07, 2010, 06:40:24 AM »
Hey developers. I know the bot runs many commands via [PM]. Just wondering if there is a plugin that I may have missed, or if one of you could be so kind to create a plugin to send PMs to players via client ids. We use the !rules <player> command many times on our CoD4 servers, and sometimes would like to send a custom private message to a particular player. We'd prefer this to be an admin only command, but being able to change the cmdlevel of it would be just as great in case we'd change our minds in the future. Thanks All!

Offline Spoon

  • Sr. Member
  • ****
  • Posts: 255
    • EHD Gaming
Re: Private Message Plugin request
« Reply #1 on: October 07, 2010, 01:33:45 PM »
Alot of people wanted this but the problem is when you type !pm spoon message other people will see that your saying so its not really a private message.
EDIT: i think you can do this with BFBC2

!adm - This is kinda like a admin chat, it sends the message to all online admins.
Code: [Select]
    def cmd_adm(self, data, client=None, cmd=None):
        """\
        <message> - Send a private message to all online admins.
        """
        if not m:
            client.message('^1ERROR: ^7You must supply a message')
            return False

        self.debug('Trying to get Admins')
        clist = self._adminPlugin.getAdmins()

        if len(clist) > 0:
           for adm in clist:
            adm.message('%s' % (data))

!pm - this is what you wanted, just sends a private message to 1 player.
Code: [Select]
    def cmd_pm(self, data, client, cmd=None):
        """\
        <name> <message> - Send a private message to a player.
        """
        m = self._adminPlugin.parseUserCmd(data)
        if not m[0]:
            client.message('^1ERROR: ^7You must supply a players name')
            return False

        if not m[1]:
            client.message('^1ERROR: ^7You must supply a message')
            return False

        sclient = self._adminPlugin.findClientPrompt(m[0], client)
        if sclient:
           sclient.message('%s: %s' % (client.exactName, data))
« Last Edit: October 07, 2010, 02:31:50 PM by Spoon »

Offline foxinabox

  • Sr. Member
  • ****
  • Posts: 157
    • Clan ATRS (Atreides)
Re: Private Message Plugin request
« Reply #2 on: October 07, 2010, 08:42:38 PM »
Thank you for the response. I don't mind if everyone can see the pm when they want to send it, its just that the  [PM] tends to catch the players attention better since its colored in-game.

Offline allansantosh

  • Newbie
  • *
  • Posts: 7
Re: Private Message Plugin request
« Reply #3 on: November 09, 2014, 10:11:46 PM »
i tried to put this code in admin.py and it crashed the b3? what am i doing wrong?

 


Rate this page +1 at Google Search