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)Bug in admin plugin with !seen and forceteam addon
Pages: [1] 2   Go Down
  Print  
Author Topic: Bug in admin plugin with !seen and forceteam addon  (Read 1158 times) Bookmark and Share
Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« on: August 12, 2010, 04:37:57 PM »

Hi there,

I spotted a bug in the admin plugin, in the !seen command :

Code:
100813 04:36:40 VERBOSE Queueing event Say !seen 1hp
100813 04:36:40 VERBOSE Parsing Event: Say: AdminPlugin
100813 04:36:40 DEBUG AdminPlugin: OnSay handle 5:"!seen 1hp"
100813 04:36:40 DEBUG AdminPlugin: Handle command !seen 1hp
100813 04:36:40 DEBUG Storage: getClientsMatching {'%name%': '1'}

It seems that numbers are [****]ing up the regex detection pattern. Could someone fix it please ?

/EDIT : Would it be possible too to add the /forceteam command ? It seems to be available in all Q3 based games. It works like :

/forceteam <cid> <team>

team can be red, blue or spectator. It permits to switch any player to any team.
« Last Edit: August 14, 2010, 06:08:40 AM by grosbedo » Logged

Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #1 on: August 12, 2010, 05:38:02 PM »

Ok fixed, see the admin.py file attached.

I had to modify the regex and to edit parseUserCmd, so I think other commands were also affected by this bug.

The only inelegant hack I had to do is :

Code:
return (fullparms, fullparms)

Because I'm too lazy to change all the rest of the code, please forgive me XD

[attachment deleted by maintenance]
Logged
Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #2 on: August 12, 2010, 06:15:18 PM »

Update again ! Added cmd_forceteam to force a player to a team. I added it directly to admin.py since it is a very generic command. Please feel free to edit my changes.

/PS : you should disable the 'You already posted !' verification, when the filetype is wrong and the system ask me to change the attached files, I can't repost after because on saving it says 'You already posted !'. I need to copy and paste my text each time in a new post !

[attachment deleted by maintenance]
« Last Edit: August 12, 2010, 06:16:59 PM by grosbedo » Logged
Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #3 on: August 12, 2010, 06:34:59 PM »

Last thing : there is still a bug with !seen :

Imagine 2 players named : ThemHell, TheWorstPlayer and The1hp

If you type "!seen the1", you will only The1hp (which is normal). But now, if you type "!seen the", it will find TheWorstPlayer and ThemHell, but not The1hp !
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #4 on: August 12, 2010, 11:46:15 PM »

Hi,
!seen
Can you describe more precisely in which conditions you manage to break !seen ?
This command is working all good on my server for years now. So you must have met special conditions that raised your issue.

'You already posted !'
We not Simple Machines forum developers Smiley

cmd_forceteam
Thanks for the code. Although the foceteam command is already used and abused in various plugins. Take a look at poweradminurt for instance. The team balance mechanism take advantage of the \rcon forceteam command and add much more power to it like the ability to lock a player to a given team.
Maybe now that the OA parser seems functional, it is time for someone to build poweradminoa.py
I'm not sure if we should make it part of the admin plugin as this plugin is used for all parsers and some of the game we support do not have the forceteam command.

_parseUserCmdRE
I'm afraid your fix will have side effects. Maybe what you were after was the getByMagic() method of Clients class ? Also make sure you understand the section titled "Player Identification" from the doc
Logged

Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #5 on: August 13, 2010, 11:28:00 AM »

Hi,
!seen
Can you describe more precisely in which conditions you manage to break !seen ?
This command is working all good on my server for years now. So you must have met special conditions that raised your issue.

When an issued name begins by a number, !seen recognize only the number and not the name.

For example, if a player is named "59isDAnumber!", you will NEVER ever find it, because when you will type !seen 59isDAnumber (or any other command using the parseUserCmd function), it will detect 59 as being the cid, and will throw out all the rest.
So to summary, with names beginning by a number, these commands will look up for a cid instead of a name.

'You already posted !'
We not Simple Machines forum developers Smiley

Ok I understand but I couldn't know if it was configurable or not, I just feedback Smiley

_parseUserCmdRE
I'm afraid your fix will have side effects. Maybe what you were after was the getByMagic() method of Clients class ? Also make sure you understand the section titled "Player Identification" from the doc

No no, it really comes from the regex (and the function has to be evolved), because if a name begins by a number, the regex will _necessarily_ return a cid, while it should detect if there are letters after the number, and if true, return a name. That's what my regex do, you can edit it if you want to make it more elegant Smiley But I think this is a major flaw.

Try to do !seen 5pla, and look at debug lines : it will detect 5 and not 5pla.
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #6 on: August 13, 2010, 04:15:35 PM »

I tried to reproduce on my side, but it went all fine for me as you can see :

Quote
console: (b3): www.BigBrotherBot.com (b3) v1.3.4b [nt] (Daniel) [ONLINE]
courgette was in the wrong place.
courgette: *iamgod
console: (b3): [pm] You are now a Super Admin
courgette: *lt
console: (b3): [pm] courgette (@15) is a Super Admin [100] since 05:49PM CST
08/13/10
courgette: *seen 4test
console: (b3): [pm] No players found matching 4
courgette: *seen 5pla
console: (b3): [pm] No players found matching 5
Timelimit hit.
007bond connected
007bond entered the game
courgette: *makereg bond
console: (b3): [pm] 007bond put in group Regular
007bond: *seen courget
console: (b3): [pm] courgette was last seen on 06:06PM CST 08/13/10
]*seen 007
courgette: *seen 007
console: (b3): [pm] 007bond was last seen on 06:10PM CST 08/13/10
007bond disconnected
]*seen 007
courgette: *seen 007
console: (b3): [pm] 007bond was last seen on 06:10PM CST 08/13/10
]*seen 007bon
courgette: *seen 007bon
console: (b3): [pm] 007bond was last seen on 06:10PM CST 08/13/10
]*seen 7bon
courgette: *seen 7bon
console: (b3): [pm] 007bond was last seen on 06:10PM CST 08/13/10
]\condump test2.log
Dumped console text to test2.log.
Logged

Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #7 on: August 14, 2010, 03:46:13 AM »

Very weird.

Here is my log :

Code:
100814 13:42:02 BOT    www.BigBrotherBot.com (b3) v1.3.3 [nt] (Daniel)
100814 13:42:23 CONSOLE 1:02 say: UnnamedPlayer: !seen
100814 13:42:23 DEBUG XLR--------> line matched ^(?P<action>[a-z_]+):\s*(?P<data>.*)$
100814 13:42:23 DEBUG AdminPlugin: OnSay handle 5:"!seen"
100814 13:42:23 DEBUG AdminPlugin: Handle command !seen
100814 13:42:29 CONSOLE 1:08 say: UnnamedPlayer: !seen 007bond
100814 13:42:29 DEBUG XLR--------> line matched ^(?P<action>[a-z_]+):\s*(?P<data>.*)$
100814 13:42:29 DEBUG AdminPlugin: OnSay handle 5:"!seen 007bond"
100814 13:42:29 DEBUG AdminPlugin: Handle command !seen 007bond
100814 13:42:29 DEBUG Storage: getClientsMatching {'%name%': '007'}
100814 13:42:37 CONSOLE 1:16 say: UnnamedPlayer: !seen bond007
100814 13:42:37 DEBUG XLR--------> line matched ^(?P<action>[a-z_]+):\s*(?P<data>.*)$
100814 13:42:37 DEBUG AdminPlugin: OnSay handle 5:"!seen bond007"
100814 13:42:37 DEBUG AdminPlugin: Handle command !seen bond007
100814 13:42:37 DEBUG Storage: getClientsMatching {'%name%': 'bond007'}
100814 13:42:43 CONSOLE 1:22 say: UnnamedPlayer: !seen the7bond
100814 13:42:43 DEBUG XLR--------> line matched ^(?P<action>[a-z_]+):\s*(?P<data>.*)$
100814 13:42:43 DEBUG AdminPlugin: OnSay handle 5:"!seen the7bond"
100814 13:42:43 DEBUG AdminPlugin: Handle command !seen the7bond
100814 13:42:43 DEBUG Storage: getClientsMatching {'%name%': 'the7bond'}
100814 13:42:49 CONSOLE 1:28 say: UnnamedPlayer: !seen 7bond
100814 13:42:49 DEBUG XLR--------> line matched ^(?P<action>[a-z_]+):\s*(?P<data>.*)$
100814 13:42:49 DEBUG AdminPlugin: OnSay handle 5:"!seen 7bond"
100814 13:42:49 DEBUG AdminPlugin: Handle command !seen 7bond
100814 13:42:49 DEBUG Storage: getClientsMatching {'%name%': '7'}

I tried with the last version I could find on Github, but it seems yours is newer (v1.3.4b, mine is v1.3.3). Maybe your admin.py is different than mine ?

Here is attached the version I downloaded (v1.7)

--------------

About forceteam, I edited admin.py because I thought that this command should be pretty much generic to all games using q3a engine, but I can't find an equivalent with COD. Do you know of any similar command in those games ?

[attachment deleted by maintenance]
Logged
Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #8 on: August 14, 2010, 04:22:30 AM »

Ive googled about forceteam some more, and it seems that it is really widespread : it exists as is for Jedi Academy and Knight, SOF2, iourt, etpro, TrackMania Forever, BattleField Bad Company 2 - I don't know exactly the command for this one but Ive found 2 tools that can do it :
http://www.brothersoft.com/games/battlefield-bad-company-2-bc2-php-commander.html
http://www.totalgamingnetwork.com/showthread.php?75056-Superfluous-BF2-rcon-client

For CoD, I didn't find (yet) but Im pretty sure such a command exists too. It's just a logical expansion of the "team" command.

But if you really want it, I can make it as an external plugin, but I really do think it's so widespread it should be included in the admin plugin...
« Last Edit: August 14, 2010, 04:32:45 AM by grosbedo » Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #9 on: August 14, 2010, 04:27:14 AM »

Code:
[code]100814 14:23:06 CONSOLE 2:00 say: courgette: *seen 7bon
100814 14:23:06 DEBUG XLR--------> line matched ^(?P<action>[a-z_]+):\s*(?P<data>.*)$
100814 14:23:06 VERBOSE Queueing event Say *seen 7bon
100814 14:23:06 VERBOSE Parsing Event: Say: AdminPlugin
100814 14:23:06 DEBUG AdminPlugin: OnSay handle 5:"*seen 7bon"
100814 14:23:06 DEBUG AdminPlugin: Handle command *seen 7bon
100814 14:23:06 VERBOSE RCON sending (178.32.122.248:27960) say ^0(^2b3^0)^7: ^3[pm]^7 ^7007bond^7 ^7was last seen on 06:21AM CST 08/14/10
100814 14:23:07 VERBOS2 RCON: Received
The difference with your log is that I do not have :
Quote
Storage: getClientsMatching {'%name%': '7'}
on my side.

This means on my side
Code:
# first check connected users
        c = self.getClientLikeName(name)
returns something in lookupByName (clients.py) while it seems not on your side.

Was a player named 007bond on your sever during your tests ? [/code]
Logged

Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #10 on: August 14, 2010, 04:41:45 AM »

can you do 2 more tests :

try : !seen '007bon' (note the single quotes)

and try with the following regexp :
Code: python
_parseUserCmdRE = re.compile(r"^(?P'[^']{2,}'|[0-9]+|[^\s]{2,}|@[0-9]+)(\s+(?P.*))?$")
making sure any else of the B3 code remain unchanged


About /forceteam, will have a talk about this with the core devs
Logged

Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #11 on: August 14, 2010, 05:17:33 AM »

Both of your tests worked !

I tried with the single quotes + original regexp.

Then I tried without single quotes + your newregexp.

Both worked.

Thank's a lot ! I think that fixes the problem Wink

PS : no there wasn't any player on the server, Im testing that locally Smiley
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #12 on: August 14, 2010, 05:39:18 AM »

thanks for you tests and pointing out the regexp as the culprit Smiley

A tip for you to test with multiple OA clients on your server :
 * start a first OA client in 640x800 non-fullscreen
 * start a second OA client adding on the command line :
Code:
+set fs_homepath c:\somewhere\else\baseoa

That way both clients can seat on your computer but still have different homepaths and as such different qkey files (and thus guids)
Logged

Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #13 on: August 14, 2010, 06:08:06 AM »

Thank you for the tip ! Cheesy

Ive compiled my changes for forceteam into a tiny forceteam plugin, to not change the core files and break compatibility until the command make it (or not) into the admin.py plugin.

See attached file for download.

[attachment deleted by maintenance]
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 #14 on: August 14, 2010, 06:09:20 AM »

Will that work in cod 4?

*Via my HTC EvO 4G*
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
Tags:
Pages: [1] 2   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal