documentation
download & extend
community & support
B3 hosting
May 24, 2012, 02:47:25 PM
Home
Features
Get Started
Supported Games
Forums
Help
Search
Tags
Groupware
Login
Register
Activation Mail
It appears you have not registered with our community. To register please click here ...
You are here:
Big Brother Bot Forum
Community Developers
The Code Bin
spawn kill detector help
Pages: [
1
]
2
Go Down
« previous
next »
Print
Author
Topic: spawn kill detector help (Read 1102 times)
virtus
Jr. Member
OS: Windows
Type: Gameserver Rental Co.
Gameservers:
Homefront
Posts: 13
Offline
spawn kill detector help
«
on:
July 15, 2011, 10:38:31 AM »
Hey everyone. I am making a spawn kill detector for Homefront. This is my very first attempt at a plugin (and python but I know php and c++ so i have the hang of it) so I'm sure it has tons of errors.
Any advice/tips are more then welcome.
thanks
so here is my code.
What i am aiming for is:
user spawns
associative array with the unix timestamp gets set
player dies
code checks current unix time and compares with timestamp in the array
if time difference is less then 5 seconds warn the killer
Code:
__version__ = '1.0'
__author__ = 'Courgette'
import b3
import b3.events
import b3.plugin
import time
class Tutorial1Plugin(b3.plugin.Plugin):
spawntime = {}
def onStartup(self):
# get the admin plugin so we can register commands
self._adminPlugin = self.console.getPlugin('admin')
if not self._adminPlugin:
# something is wrong, can't start without admin plugin
self.error('Could not find admin plugin')
return
def onStartup(self):
if self.console.gameName not in SUPPORTED_PARSERS:
self.error("This game is not supported by this plugin")
self.disable()
return
self.registerEvent(EVT_CLIENT_AUTH)
self._workerThread = threading.Thread(target=self._worker)
self._workerThread.setDaemon(True)
self._workerThread.start()
self._checkConnectedPlayers()
def onEvent(self,event, client)
if event.type == b3.events.EVT_CLIENT_SPAWN:
spawntime[client.guid] = int(time.time())
self.console.write('bigtext "test %s"' % (spawntime[client.guid]))
if event.type == b3.events.EVT_CLIENT_DISCONNECT:
del spawntime[client.guide]
if event.type == event.type == b3.events.EVT_CLIENT_KILL:
if int(time.time()) <= (spawntime[event.target] + 5):
self.console.write('bigtext "DO NOT SPAWN KILL"')
Logged
Freelander
XLRstats dev.
Dev. Team
OS: Linux
Type: Home user
Gameservers:
COD5, COD7, BF3
Posts: 947
Offline
Support Specialty:
XLRstats webfront
Re: spawn kill detector help
«
Reply #1 on:
July 15, 2011, 01:01:11 PM »
Game engine doesn't provide player spawn information to B3. So there's no way to produce a player spawn event I guess.
However in weapon list I remember seeing spawn kill. If this is really spawn kills then you can use this information and warn the attacker for spawn killing.
Logged
Follow Me
@fps_gamer_net
- Github:
XLRstats
|
BigBrotherBot
|
Aimbotdetector
|
Poweradmincod7
Courgette
Senior Dev.
OS: Linux
Type: Home user
Posts: 3485
Offline
Support Specialty:
B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
Re: Re: spawn kill detector help
«
Reply #2 on:
July 15, 2011, 02:13:09 PM »
Also have a look at Client.var() or .setvar() (I don't remember) which would allow you to save the timestamp on the client object. IIRC, the tk and Spam plugins use this
Sent from my HTC Legend using Tapatalk
Logged
Follow me :
@cucurb
.~. new
Smokin' guns official website
virtus
Jr. Member
OS: Windows
Type: Gameserver Rental Co.
Gameservers:
Homefront
Posts: 13
Offline
Re: spawn kill detector help
«
Reply #3 on:
July 15, 2011, 02:16:45 PM »
ok, so, homefront engine doesn't spit out when player spawns?
so EVT_CLIENT_SPAWN won't work
sorry, there is a lot i do not known but eager to learn.
what is weapon list and where can I find it/look at it?
clients.var and server() where can I see what these hold?
sorry for the noobiness and thanks for the help
Logged
Courgette
Senior Dev.
OS: Linux
Type: Home user
Posts: 3485
Offline
Support Specialty:
B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
Re: Re: spawn kill detector help
«
Reply #4 on:
July 15, 2011, 11:16:36 PM »
Client.var() is meant for plugins to store any data they want on a client object. This has the advantage of not requiring you to monitor clients disconnections to free up the memory
Sent from my HTC Legend using Tapatalk
Logged
Follow me :
@cucurb
.~. new
Smokin' guns official website
Freelander
XLRstats dev.
Dev. Team
OS: Linux
Type: Home user
Gameservers:
COD5, COD7, BF3
Posts: 947
Offline
Support Specialty:
XLRstats webfront
Re: spawn kill detector help
«
Reply #5 on:
July 16, 2011, 02:40:27 AM »
The name of the weapon is "SpawnCamp". That's the console name so you can check for this name in your code. It's here in xlrstats output.
http://gs2.snt.utwente.nl/xlr/xlrstatsdev/index.php?func=show&page=4&pagenumber=4
But like I said I'm not sure if this is really for spawn kills.
Logged
Follow Me
@fps_gamer_net
- Github:
XLRstats
|
BigBrotherBot
|
Aimbotdetector
|
Poweradmincod7
virtus
Jr. Member
OS: Windows
Type: Gameserver Rental Co.
Gameservers:
Homefront
Posts: 13
Offline
Re: spawn kill detector help
«
Reply #6 on:
July 16, 2011, 08:40:01 AM »
yup, there isn't one, so I'm going to make a rough one that checks the time between the first and second kill.
Not ideal but it will pick up most.
ok so...after tweaking my code, also testing and getting used to it this is what I have, i don't get any errors but it doesn't output anything either. Any ideas?
Thanks
Code:
import b3
import b3.events
import b3.plugin
import time
class SpawnkillPlugin(b3.plugin.Plugin):
requiresConfigFile = False
_adminPlugin = None
def onStartup(self):
self._adminPlugin = self.console.getPlugin('admin')
if not self._adminPlugin:
self.error('Could not find admin plugin')
return False
self.registerEvent(b3.events.EVT_CLIENT_KILL)
def onEvent(self, event, client):
client.message('^1First TeamKill ^3:%s killed %s' % (client.exactName, client.exactName))
if event.type == b3.events.EVT_CLIENT_SPAWN:
spawntime[client.guid] = int(time.time())
self.console.write('bigtext "test %s"' % (spawntime[client.guid]))
if event.type == b3.events.EVT_CLIENT_DISCONNECT:
del spawntime[client.guide]
if event.type == b3.events.EVT_CLIENT_KILL:
client.message('^1First TeamKill ^3:%s killed %s' % (client.exactName, client.exactName))
Logged
lolasaurous
Jr. Member
OS: Windows
Type: Gameserver Rental Co.
Gameservers:
Homefront
Posts: 22
Offline
Re: spawn kill detector help
«
Reply #7 on:
July 17, 2011, 12:41:49 AM »
I too am curious on this and if this worked it would be beneficial to our server for sure.
Logged
gabarram
Beta Testers
OS: Windows
Type: Owner dedicated server(s)
Gameservers:
MW2 (aIW)
Posts: 187
Offline
Re: spawn kill detector help
«
Reply #8 on:
July 17, 2011, 08:55:13 AM »
Hi
I´m actually running a MW2 server and I´m pretty much interested in this plugin.
Nevertheless, I don´t see 'EVT_CLIENT_SPAWN' listed in events.py of the bot.
Do you have an idea if the code above could be working for MW2?
Thanks in advance.
Logged
lolasaurous
Jr. Member
OS: Windows
Type: Gameserver Rental Co.
Gameservers:
Homefront
Posts: 22
Offline
Re: spawn kill detector help
«
Reply #9 on:
July 17, 2011, 09:29:42 AM »
Quote from: virtus on July 16, 2011, 08:40:01 AM
yup, there isn't one, so I'm going to make a rough one that checks the time between the first and second kill.
Not ideal but it will pick up most.
ok so...after tweaking my code, also testing and getting used to it this is what I have, i don't get any errors but it doesn't output anything either. Any ideas?
Thanks
I think what he means is that he's gonna ignore the whole spawn camp feature in the game and just look for a event to occur when" player a" is killed and then say if "player a" is killed again with in 10 seconds for it to issue a warning about spawn camping.
Logged
virtus
Jr. Member
OS: Windows
Type: Gameserver Rental Co.
Gameservers:
Homefront
Posts: 13
Offline
Re: spawn kill detector help
«
Reply #10 on:
July 17, 2011, 02:45:50 PM »
Quote from: gabarram on July 17, 2011, 08:55:13 AM
Hi
I´m actually running a MW2 server and I´m pretty much interested in this plugin.
Nevertheless, I don´t see 'EVT_CLIENT_SPAWN' listed in events.py of the bot.
Do you have an idea if the code above could be working for MW2?
Thanks in advance.
I did see it, somewhere, but it doesn't work for Homefront because Homefront doesn't announce when a player spawns in, you would have to check your B3 logs to see if Cod announces spawn.
yes, lol is correct, thats how I plan to do it.
If someone could tell me why my test code isn't working i would greatly appreciate it!
this is what i put in my B3.xml
Code:
<plugin name="spawnkill" />
found this in the log:
Quote
handler SpawnkillPlugin could not handle event Client Kill: TypeError: onEvent() takes exactly 3 arguments (2 given) [('C:\\\\UserFiles\\\\hoos\\\\B3Homefront\\\\b3\\\\parser.py', 961, 'handleEvents', 'hfunc.parseEvent(event)'), ('C:\\\\UserFiles\\\\hoos\\\\B3Homefront\\\\b3\\\\plugin.py', 157, 'parseEvent', 'self.onEvent(event)')]"
«
Last Edit: July 17, 2011, 03:03:41 PM by virtus
»
Logged
gabarram
Beta Testers
OS: Windows
Type: Owner dedicated server(s)
Gameservers:
MW2 (aIW)
Posts: 187
Offline
Re: spawn kill detector help
«
Reply #11 on:
July 17, 2011, 02:57:21 PM »
Why don´t you add the path to the xml plugin in that sentence?
Code:
<plugin name="spawnkill" config="@b3/extplugins/conf/plugin_spawnkill.xml />
«
Last Edit: July 17, 2011, 02:59:30 PM by gabarram
»
Logged
virtus
Jr. Member
OS: Windows
Type: Gameserver Rental Co.
Gameservers:
Homefront
Posts: 13
Offline
Re: spawn kill detector help
«
Reply #12 on:
July 17, 2011, 03:04:24 PM »
updated last post.
I don't have an xml file and in the plugin i declared one didn't exist.
Logged
gabarram
Beta Testers
OS: Windows
Type: Owner dedicated server(s)
Gameservers:
MW2 (aIW)
Posts: 187
Offline
Re: spawn kill detector help
«
Reply #13 on:
July 17, 2011, 03:27:14 PM »
Quote from: virtus on July 17, 2011, 03:04:24 PM
updated last post.
I don't have an xml file and in the plugin i declared one didn't exist.
How B3 knows there´s a plugin without your declaring here or there that the file exists?
Logged
virtus
Jr. Member
OS: Windows
Type: Gameserver Rental Co.
Gameservers:
Homefront
Posts: 13
Offline
Re: spawn kill detector help
«
Reply #14 on:
July 17, 2011, 03:34:09 PM »
this line, which i commented above
Quote
<plugin name="spawnkill" />
Logged
Tags:
Pages: [
1
]
2
Go Up
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News (Read Only)
===> News Archive
===> Website News
=> General Discussion
===> Servers
=> Shared Services
-----------------------------
Support Forums
-----------------------------
=> Support Instructions
=> Installation Support
=> General Usage Support
=> Game specific Support
===> Battle Field 3
=====> BF3/B3 beta board
===> Battle Field Bad Company 2
===> Call of Duty series
=====> CoD, CoD:UO, CoD2
=====> Call of Duty 4 (Modern Warfare)
=====> Call of Duty 5 (World at War)
=====> Call of Duty 6 (Modern Warfare 2)
=====> Call of Duty 7 (Black Ops)
=======> AlterOps
===> Frontlines, Fuel of War
===> Enemy Territory
===> Homefront
===> Medal of Honor 2010
===> Open Arena
===> Red Orchestra 2
===> Smokin' Guns
===> Soldier of Fortune 2
===> Urban Terror
===> World of Padman
===> Other games
-----------------------------
Add-Ons
-----------------------------
=> Plugins Discussion
===> Plugin Releases!
===> Plugins by xlr8or
===> Plugins by Courgette
===> Plugins by Freelander
===> Plugins by Bakes
===> Plugins by Ismael
===> Plugins by flinkaflenkaflrsk
===> Plugins by Anubis
===> Plugins by Spoon
===> Plugins by PtitBigorneau
===> Plugins by BlackMamba
===> Plugins by Beber888
===> Plugins by grosbedo
=> XLRstats
===> Weaponmodifiers
=> Echelon
===> Echelon version 2
=> Configurations
=> Installers
-----------------------------
Community Developers
-----------------------------
=> Plugin Developers
=> The Code Bin
Rate this page +1 at Google Search
Web Toolbar by Wibiya
SimplePortal 2.3.1 © 2008-2009, SimplePortal