Rejoignez-nous sur le discord Urban Terror France !
Rejoignez-nous sur le discord Urban Terror France !
Statistiques globales et en temps réel de la totalité des serveurs d'Urban Terror. Suivez l'évolution du nombre de joueurs sur Urban Terror !
Guide rapide concernant l'inscription sur le site officiel du jeu. Créez ainsi votre compte joueur qui permet d'être authentifié sur les serveurs de jeu de la 4.2 !
Envie de parler avec les autres membres de la communauté ? Alors venez vous connecter, vous vous sentirez moins seul !
c est pas tres clair mais bonj'aimerais savoir comment faire pour savoir si un joueur est sur le server avec son pseudo
Code : Tout sélectionner
def cmd_commande(self, data, client, cmd=None):
if data:
input = self._adminPlugin.parseUserCmd(data)
else:
return
sclient = self._adminPlugin.findClientPrompt(input[0], client)
if sclient:
alors ben si ca marchej’aimerais savoir comment faire pour kicker un joueur avec son pseudo (parceque je ne pense pas que "pseudoperso.kick(reason='...')" marche)
Code : Tout sélectionner
def cmd_commande(self, data, client, cmd=None):
if data:
input = self._adminPlugin.parseUserCmd(data)
else:
return
sclient = self._adminPlugin.findClientPrompt(input[0], client)
sclient.kick("raison du kick", None)
t as une fonction dans b3 "b3.cron" qui permet de faire caet la c'est plutot une question sur python que B3 mais ... j'aimerais savoir comment faire pour effectuer une action au bout de 3 min a partir d'un moment précis
Code : Tout sélectionner
import b3.cron
c est comme j ai ecrit plus haut--> ensuite je vousrais virifier si nomdujoueur existe bien sur le server
Code : Tout sélectionner
def cmd_votekick(self, data, client, cmd=None):
if data:
input = self._adminPlugin.parseUserCmd(data)
else:
return
sclient = self._adminPlugin.findClientPrompt(input[0], client)
if sclient: //si joueur existe
if not sclient:// si joueur n existe pas
avec b3.cron pour une tache avec un interval de 20 secondes que tu peux limter a 6 fois pour avoir tes 3 minutes--> toutes les 20 secondes le bot affiche les résultats
Code : Tout sélectionner
import b3.cron
if self._cronTab:
self.console.cron - self._cronTab
self._cronTab = b3.cron.PluginCronTab(self, self.Une fonction, '*/20')
self.console.cron + self._cronTab
Code : Tout sélectionner
#
# votekick Plugin for BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2010 pierreyves258
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Changelog:
#
__version__ = '1.0.0'
__author__ = 'pierreyves258'
import b3
import b3.events
import b3.plugin
import b3.cron
class VotekickPlugin(b3.plugin.Plugin):
_clientvar_name = 'votekick'
yesvotes = 0
novotes = 0
sclientk = None
voteallow = 0
def onStartup(self):
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
# Register commands
self._adminPlugin.registerCommand(self, 'votekick', self.levelcmd, self.votekick, 'vk')
self._adminPlugin.registerCommand(self, 'kyes', self.levelcmd, self.voteyes)
self._adminPlugin.registerCommand(self, 'kno', self.levelcmd, self.voteno)
def onLoadConfig(self):
self.levelcmd = self.config.get('config', 'level')
self.reason = self.config.get('config', 'reason')
self.info('Config Loaded')
def votekick(self, data, client, cmd=None):
self.debug('votekick called')
if data:
input = self._adminPlugin.parseUserCmd(data)
else:
return
sclient = self._adminPlugin.findClientPrompt(input[0], client)
self.debug('sclient definded')
if sclient:
sclientk = sclient
voteallow = 1
self.saystatus()
if self._cronTab:
self.console.cron - self._cronTab
i=0
while i<6:
self._cronTab = b3.cron.PluginCronTab(self, self.saystatus, '*/20')
self.console.cron + self._cronTab
i+=1
if i>=6:
self.kickplayer()
if not sclient:
self.console.say('Player ', sclient.name, 'not exist')
def voteyes(self, data, client, cmd):
if voteallow == 0:
client.message('No vote allow')
else:
yesvotes += 1
self.saystatus()
def voteno(self, data, client, cmd):
if voteallow == 0:
client.message('No vote allow')
else:
novotes += 1
self.saystatus()
def saystatus(self):
self.console.say('Vote kick ' , sclientk.name , ' [' , novotes , ':' , yesvotes , ']')
def kickplayer(self):
self.voteallow = 0
if yesvote < novote:
self.console.say('Player not kicked')
else:
self.console.say('Player kicked')
sclientk.kick(self.reason, None)
voteyes = 0
voteno = 0
Code : Tout sélectionner
<configuration plugin="votekick">
<settings name="config">
<set name="level">0</set>
<set name="reason">Players vote kick you</set>
</settings>
</configuration>
Code : Tout sélectionner
110614 19:38:11 CONSOLE 1:31 say: 2 pierreyves258: !vk pierreyves258
110614 19:38:11 VERBOSE Client Found: pierreyves258 on slot 2
110614 19:38:11 VERBOSE Queueing event Say !vk pierreyves258
110614 19:38:11 VERBOSE Parsing Event: Say: CensorPlugin
110614 19:38:11 VERBOSE Parsing Event: Say: SpamcontrolPlugin
110614 19:38:11 VERBOSE Parsing Event: Say: AdminPlugin
110614 19:38:11 DEBUG AdminPlugin: OnSay handle 5:"!vk pierreyves258"
110614 19:38:11 DEBUG AdminPlugin: Handle command !vk pierreyves258
110614 19:38:11 DEBUG VotekickPlugin: votekick called
110614 19:38:11 DEBUG VotekickPlugin: sclient definded
110614 19:38:11 VERBOSE RCON sending (92.138.176.177:27960) 'tell 2 ^0(^2|KD|B3^0)^7: ^3[pm]^7 ^7There was an error processing your command'
110614 19:38:11 ERROR handler AdminPlugin could not handle event Say: NameError: global name 'sclientk' is not defined [('/home/pierre-yves/b3/b3/parser.py', 950, 'handleEvents', 'hfunc.parseEvent(event)'), ('/home/pierre-yves/b3/b3/plugin.py', 157, 'parseEvent', 'self.onEvent(event)'), ('/home/pierre-yves/b3/b3/plugin.py', 175, 'onEvent', 'self.handle(event)'), ('/home/pierre-yves/b3/b3/plugins/admin.py', 222, 'handle', 'self.OnSay(event)'), ('/home/pierre-yves/b3/b3/plugins/admin.py', 367, 'OnSay', 'results = command.execute(data, event.client)'), ('/home/pierre-yves/b3/b3/plugins/admin.py', 2009, 'execute', 'self.func(data, client, copy.copy(self))'), ('/home/pierre-yves/b3/b3/extplugins/votekick.py', 69, 'votekick', 'self.saystatus()'), ('/home/pierre-yves/b3/b3/extplugins/votekick.py', 99, 'saystatus', "self.console.say('Vote kick ' , sclientk.name , ' [' , novotes , ':' , yesvotes , ']')")]
Code : Tout sélectionner
self.saystatus(sclientk)
def saystatus(self, sclientk):
ERROR handler AdminPlugin could not handle event Say: NameError: global name 'sclientk' is not defined
Code : Tout sélectionner
#
# votekick Plugin for BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2010 pierreyves258
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Changelog:
#
__version__ = '1.0.0'
__author__ = 'pierreyves258'
import b3
import b3.events
import b3.plugin
import b3.cron
class VotekickPlugin(b3.plugin.Plugin):
_clientvar_name = 'votekick'
def onStartup(self):
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
# Register commands
self._adminPlugin.registerCommand(self, 'votekick', self.levelcmd, self.votekick, 'vk')
self._adminPlugin.registerCommand(self, 'kyes', self.levelcmd, self.voteyes)
self._adminPlugin.registerCommand(self, 'kno', self.levelcmd, self.voteno)
self.yesvotes = 0
self.novotes = 0
self.sclientk = None
self.voteallow = 0
def onLoadConfig(self):
self.levelcmd = self.config.get('config', 'level')
self.reason = self.config.get('config', 'reason')
self.info('Config Loaded')
def votekick(self, data, client, cmd=None):
self.debug('votekick called')
if data:
input = self._adminPlugin.parseUserCmd(data)
else:
return
sclient = self._adminPlugin.findClientPrompt(input[0], client)
self.debug('sclient definded')
if sclient:
self.sclientk = sclient
self.voteallow = 1
self.saystatus()
if self._cronTab:
self.console.cron - self._cronTab
i=0
while i<6:
self._cronTab = b3.cron.PluginCronTab(self, self.saystatus, '*/20')
self.console.cron + self._cronTab
i+=1
if i>=6:
self.kickplayer()
if not sclient:
self.console.say('Player ', sclient.name, 'not exist')
def voteyes(self, data, client, cmd):
if self.voteallow == 0:
client.message('No vote allow')
else:
yesvotes += 1
self.saystatus()
def voteno(self, data, client, cmd):
if self.voteallow == 0:
client.message('No vote allow')
else:
self.novotes += 1
self.saystatus()
def saystatus(self):
self.console.say('Vote kick ' , self.sclientk.name , ' [' , self.novotes , ':' , self.yesvotes , ']')
def kickplayer(self):
self.voteallow = 0
if self.yesvote < self.novote:
self.console.say('Player not kicked')
else:
self.console.say('Player kicked')
self.sclientk.kick(self.reason, None)
self.voteyes = 0
self.voteno = 0
Code : Tout sélectionner
110614 21:08:26 VERBOSE RCON sending (92.138.176.177:27960) 'tell 2 ^0(^2|KD|B3^0)^7: ^3[pm]^7 ^7There was an error processing your command'
110614 21:08:26 ERROR handler AdminPlugin could not handle event Say: TypeError: say() takes exactly 2 arguments (8 given) [('/home/pierre-yves/b3/b3/parser.py', 950, 'handleEvents', 'hfunc.parseEvent(event)'), ('/home/pierre-yves/b3/b3/plugin.py', 157, 'parseEvent', 'self.onEvent(event)'), ('/home/pierre-yves/b3/b3/plugin.py', 175, 'onEvent', 'self.handle(event)'), ('/home/pierre-yves/b3/b3/plugins/admin.py', 222, 'handle', 'self.OnSay(event)'), ('/home/pierre-yves/b3/b3/plugins/admin.py', 367, 'OnSay', 'results = command.execute(data, event.client)'), ('/home/pierre-yves/b3/b3/plugins/admin.py', 2009, 'execute', 'self.func(data, client, copy.copy(self))'), ('/home/pierre-yves/b3/b3/extplugins/votekick.py', 69, 'votekick', 'self.saystatus()'), ('/home/pierre-yves/b3/b3/extplugins/votekick.py', 99, 'saystatus', "self.console.say('Vote kick ' , self.sclientk.name , ' [' , self.novotes , ':' , self.yesvotes , ']')")]
Code : Tout sélectionner
def saystatus(self):
self.console.say('Vote kick ' , self.sclientk.name , ' [' , self.novotes , ':' , self.yesvotes , ']')
Code : Tout sélectionner
def saystatus(self):
self.console.say('Vote kick %s [%s : %s]' %(self.sclientk.name , self.novotes , self.yesvotes))
Code : Tout sélectionner
def voteyes(self, data, client, cmd):
if self.voteallow == 0:
client.message('No vote allow')
else:
yesvotes += 1
self.saystatus()
Code : Tout sélectionner
self.yesvotes += 1
Code : Tout sélectionner
#
# votekick Plugin for BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2010 pierreyves258
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Changelog:
#
__version__ = '1.0.0'
__author__ = 'pierreyves258'
import b3
import b3.events
import b3.plugin
import b3.cron
class VotekickPlugin(b3.plugin.Plugin):
_clientvar_name = 'votekick'
def onStartup(self):
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
# Register commands
self._adminPlugin.registerCommand(self, 'votekick', self.levelcmd, self.votekick, 'vk')
self._adminPlugin.registerCommand(self, 'kyes', self.levelcmd, self.voteyes)
self._adminPlugin.registerCommand(self, 'kno', self.levelcmd, self.voteno)
self.yesvotes = 0
self.novotes = 0
self.sclientk = None
self.voteallow = 0
def onLoadConfig(self):
self.levelcmd = self.config.get('config', 'level')
self.reason = self.config.get('config', 'reason')
self.info('Config Loaded')
def votekick(self, data, client, cmd=None):
self.debug('votekick called')
if data:
input = self._adminPlugin.parseUserCmd(data)
else:
return
sclient = self._adminPlugin.findClientPrompt(input[0], client)
self.debug('sclient definded')
if sclient:
self.sclientk = sclient
self.voteallow = 1
self.voteyes = 1
self.saystatus()
if self._cronTab:
self.console.cron - self._cronTab
i=0
while i<6:
self._cronTab = b3.cron.PluginCronTab(self, self.saystatus, '*/20')
self.console.cron + self._cronTab
i+=1
if i>=6:
self.kickplayer()
if not sclient:
self.console.say('Player %s not exist' %(sclient.name))
def voteyes(self, data, client, cmd):
if self.voteallow == 0:
client.message('No vote allow')
else:
self.yesvotes += 1
self.saystatus()
def voteno(self, data, client, cmd):
if self.voteallow == 0:
client.message('No vote allow')
else:
self.novotes += 1
self.saystatus()
def saystatus(self):
self.console.say('Vote kick %s [%s : %s]' %(self.sclientk.name , self.novotes , self.yesvotes))
def kickplayer(self):
self.voteallow = 0
if self.yesvote < self.novote:
self.console.say('Player not kicked')
else:
self.console.say('Player kicked')
self.sclientk.kick(self.reason, None)
self.voteyes = 0
self.voteno = 0
Code : Tout sélectionner
110615 11:48:03 ERROR handler AdminPlugin could not handle event Say: AttributeError: VotekickPlugin instance has no attribute '_cronTab' [('/home/pierre-yves/b3/b3/parser.py', 950, 'handleEvents', 'hfunc.parseEvent(event)'), ('/home/pierre-yves/b3/b3/plugin.py', 157, 'parseEvent', 'self.onEvent(event)'), ('/home/pierre-yves/b3/b3/plugin.py', 175, 'onEvent', 'self.handle(event)'), ('/home/pierre-yves/b3/b3/plugins/admin.py', 222, 'handle', 'self.OnSay(event)'), ('/home/pierre-yves/b3/b3/plugins/admin.py', 367, 'OnSay', 'results = command.execute(data, event.client)'), ('/home/pierre-yves/b3/b3/plugins/admin.py', 2009, 'execute', 'self.func(data, client, copy.copy(self))'), ('/home/pierre-yves/b3/b3/extplugins/votekick.py', 70, 'votekick', 'if self._cronTab:')]
Code : Tout sélectionner
class VotekickPlugin(b3.plugin.Plugin):
_clientvar_name = 'votekick'
_cronTab = None
Code : Tout sélectionner
if sclient:
self.sclientk = sclient
self.voteallow = 1
self.voteyes = 1
self.saystatus()
if self._cronTab:
self.console.cron - self._cronTab
i=0
while i<6:
self._cronTab = b3.cron.PluginCronTab(self, self.saystatus, '*/20')
self.console.cron + self._cronTab
i+=1
if i>=6:
self.kickplayer()
Code : Tout sélectionner
if sclient:
self.sclientk = sclient
self.voteallow = 1
self.voteyes = 1
if self._cronTab:
self.console.cron - self._cronTab
self.test = 0
self._cronTab = b3.cron.PluginCronTab(self, self.saystatus, '*/20')
self.console.cron + self._cronTab
Code : Tout sélectionner
def saystatus(self):
self.console.say('Vote kick %s [%s : %s]' %(self.sclientk.name , self.novotes , self.yesvotes))
Code : Tout sélectionner
def saystatus(self):
if self.test<6:
self.console.say('Vote kick %s [%s : %s]' %(self.sclientk.name , self.novotes , self.yesvotes))
self.test += 1
if self.test>=6:
self.kickplayer()
Code : Tout sélectionner
self._cronTab = None