In our support boards we aim to provide support for the B3 core in its current state. Older releases of B3 are NOT supported. Check our front page for the latest version. You may post feature requests in our General Discussion board. Modifications and Hacks of the core B3 code are NOT supported.
Before you ask for support: [ Read the Support Instructions ] - More info: [ Full Support Disclaimer ]

Pages: [1]   Go Down
  Print  
Author Topic: Where is it implemented?  (Read 637 times) Bookmark and Share
Newbie
*
OS: --No B3 installed--
Type: --No B3 installed--
Posts: 3
Offline Offline
« on: November 20, 2010, 07:24:15 PM »

Hi people and xlr!

In what file do i find the script-behavior of !kick and and the private-message-system (console: [PM] some message...)? i couldnt find some command!

and/or is some of this solved by the gsc-script-language? if so, where do i find the .gsc's?

thanks for help!

greetings,
DukeNukem
Logged

Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3478
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #1 on: November 20, 2010, 08:38:02 PM »

Hi
In what file do i find the script-behavior of !kick and and the private-message-system (console: [PM] some message...)? i couldnt find some command!
in admin.py (if you are not using the windows build of B3)

and/or is some of this solved by the gsc-script-language? if so, where do i find the .gsc's?
If I'm not mistaken gsc is a game server side script language. There is no such thing in B3. B3 is not a game mod; it stands aside the game server
Logged

Newbie
*
OS: --No B3 installed--
Type: --No B3 installed--
Posts: 3
Offline Offline
« Reply #2 on: November 21, 2010, 12:28:48 PM »

Hi Courgette!

Ive tried to find the privatemessage-code, so first i have declared what i am searching for: some kind of rcon-command send by b3.

The search started in admin.py. Search for the cmd "kick". Found in line 1108.

Code:
   def cmd_kick(self, data, client=None, cmd=None):
        """\
        <name> [<reason>] - kick a player
        """
        m = self.parseUserCmd(data)
        if not m:
            client.message('^7Invalid parameters')
            return False

        cid, keyword = m
        reason = self.getReason(keyword)

        if not reason and client.maxLevel < self.config.getint('settings', 'noreason_level'):
            client.message('^1ERROR: ^7You must supply a reason')
            return False

        sclient = self.findClientPrompt(cid, client)
        if sclient:
            if sclient.cid == client.cid:
                self.console.say(self.getMessage('kick_self', client.exactName))
                return True
            elif sclient.maxLevel >= client.maxLevel:
                if sclient.maskGroup:
                    client.message('^7%s ^7is a masked higher level player, can\'t kick' % client.exactName)
                else:
                    self.console.say(self.getMessage('kick_denied', sclient.exactName, client.exactName, sclient.exactName))
                return True
            else:
                sclient.kick(reason, keyword, client)
                return True
        elif re.match('^[0-9]+$', cid):
            # failsafe, do a manual client id ban
            self.console.kick(cid, reason, client)

the interesting line for me was: client.message('^7Invalid parameters')

a class client with the method message! that should be what im looking for. so ive searched the method and found it in file clients.py at line 541.

Code:
    def message(self, msg):
        self.console.message(self, msg)

and there my trace stops: i cant find the class console. ive searched for "class console" in the whole b3-folder but the search is endless.

could someone explain how it is working? sending a chat-message to just ONE player.

i just know: rcon("say message to all");

many thanks!
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3478
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #3 on: November 21, 2010, 02:07:16 PM »

In plugins, self.console is a reference to the "B3 parser" in use.

The B3 framework is composed of :
  • core classes (like Client) which are game independant
  • plugins (classes that inherits from the Plugin class) which can be game independant
  • parsers (classes that inherits from the Parser class)
Parsers are the interface between the B3 core and B3 plugins to communicate with a game server.

In the B3 core code, you will never see code that actually make the rcon calls. Instead the plugins and B3 core delegate to the parser that is in use the work they want to be done.

Have a look at the getCommand() from the Parser class and also the _commands property of parsers.

Code:
    def message(self, msg):
        self.console.message(self, msg)
means you are looking for the message() method of the parser that is used for your gameserver
« Last Edit: November 21, 2010, 02:10:40 PM by Courgette » Logged

Newbie
*
OS: --No B3 installed--
Type: --No B3 installed--
Posts: 3
Offline Offline
« Reply #4 on: November 21, 2010, 02:24:04 PM »

Hi Courgette!

Everything is cleared now. Thank you very much. Smiley

Ive risked a look in cod2.py which inherits from cod.py... there was the command. Its just a "tell $id $msg". Cheesy

A nice design of b3, just a bit confusing in the beginning. Smiley
Logged
Tags: !kick  private message 
Pages: [1]   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal