Plugin B3 vérifier qu'un joueur existe

Tout ce qui concerne la configuration et l'administration des serveurs.
Rendez-vous dans Outils de communication & communautaires pour la conception de sites Internet.
pierreyves258
Messages : 35
Enregistré le : 24 mai 2011, 20:05

Plugin B3 vérifier qu'un joueur existe

Message par pierreyves258 » 13 juin 2011, 20:30

Bonjour, j'ai créer un petit plugin pour B3 et j'ai quelques questions pour savoir comment faire des choses
j'aimerais savoir comment faire pour savoir si un joueur est sur le server avec son pseudo
j’aimerais savoir comment faire pour kicker un joueur avec son pseudo (parceque je ne pense pas que "pseudoperso.kick(reason='...')" marche)
et 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

Merci de votre aide

Avatar du membre
PtitBigorneau
Messages : 516
Enregistré le : 19 oct. 2008, 13:50
Localisation : brest

Re: Plugin B3 vérifier qu'un joueur existe

Message par PtitBigorneau » 13 juin 2011, 23:34

j'aimerais savoir comment faire pour savoir si un joueur est sur le server avec son pseudo
c est pas tres clair mais bon

si c est avec une commande

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:
ca donne quand tu tape "!commande joueur" ca verifie si le joueur existe
j’aimerais savoir comment faire pour kicker un joueur avec son pseudo (parceque je ne pense pas que "pseudoperso.kick(reason='...')" marche)
alors ben si ca 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)
en gros quand tu tape la commande "!commande nom joueur" le joueur est kické avec la raison "raison kick"
et 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
t as une fonction dans b3 "b3.cron" qui permet de faire ca

Code : Tout sélectionner

import b3.cron
apres ca depend de ce que tu veux faire exactement

bref explique ce que tu veux faire dans ton plugin
ca sera un peu plus simple pour d aider
-[TPF]-PtitBigorneau
http://www.PtitBigorneau.fr

pierreyves258
Messages : 35
Enregistré le : 24 mai 2011, 20:05

Re: Plugin B3 vérifier qu'un joueur existe

Message par pierreyves258 » 14 juin 2011, 07:14

ok merci en faite je t'exlique en détail:
un joueur veut en kicker un autre il écris donc "!votelick nomdujoueur"
--> ensuite je vousrais virifier si nomdujoueur existe bien sur le server
si il existe indiquer qu'il y a la vote en cours et mettre voteencours a 1
si non ecrire le joueur n'existe pas
si il y a un vote en cours quand un joueur ecris !koui la variable oui s'incrémante
si il écirs !knon la variable non s'incrimente
--> toutes les 20 secondes le bot affiche les résultats
--> au bout de 3 minutes si il y a plus de oui on kick nomdujoueur
si non on ne le kick pas

ce que je voulait dire c'est que nomdujoueur est une string ...

J'ai des problèmes la ou il y a ce signe devant le phrase -->

je vais essayer ton code cet aprem

Merci de ton aide

Avatar du membre
PtitBigorneau
Messages : 516
Enregistré le : 19 oct. 2008, 13:50
Localisation : brest

Re: Plugin B3 vérifier qu'un joueur existe

Message par PtitBigorneau » 14 juin 2011, 12:17

y a deja un plugin vote pour b3 :)

mais bon

--> ensuite je vousrais virifier si nomdujoueur existe bien sur le server
c est comme j ai ecrit plus haut

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 
donc apres tu peux avoir le nom du joueur avec "sclient.name" ou "sclient.exactName", son ip, son guid, son id avec "sclient.ip", "sclient.guid", "sclient.id" ...

pour un message privé au joueur sclient.message et pour kicker le joueur sclient.kick
--> toutes les 20 secondes le bot affiche les résultats
avec b3.cron pour une tache avec un interval de 20 secondes que tu peux limter a 6 fois pour avoir tes 3 minutes

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
-[TPF]-PtitBigorneau
http://www.PtitBigorneau.fr

pierreyves258
Messages : 35
Enregistré le : 24 mai 2011, 20:05

Re: Plugin B3 vérifier qu'un joueur existe

Message par pierreyves258 » 14 juin 2011, 17:23

comment la limiter a 6 fois ? et au bout de le 6eme executer une autre fonction ? avec une boucle ?

Avatar du membre
PtitBigorneau
Messages : 516
Enregistré le : 19 oct. 2008, 13:50
Localisation : brest

Re: Plugin B3 vérifier qu'un joueur existe

Message par PtitBigorneau » 14 juin 2011, 18:58

n=0

if n< 6:

#fonction

n+=1

if n>=6:

#fin
-[TPF]-PtitBigorneau
http://www.PtitBigorneau.fr

pierreyves258
Messages : 35
Enregistré le : 24 mai 2011, 20:05

Re: Plugin B3 vérifier qu'un joueur existe

Message par pierreyves258 » 14 juin 2011, 19:32

Bon ... quand j'ecris la commande dans le jeu sa me met:
There was an error processing your command

j'ai essayer de chercher la cause du problème mais je ne trouve pas je poste mon plugin:

python

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
   
xml (config)

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>

B3 log

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 , ']')")]
Merci de ton aide

Avatar du membre
PtitBigorneau
Messages : 516
Enregistré le : 19 oct. 2008, 13:50
Localisation : brest

Re: Plugin B3 vérifier qu'un joueur existe

Message par PtitBigorneau » 14 juin 2011, 19:53

la c est normal tu envois 'ton client' dans ta fonction 'saystatus'

Code : Tout sélectionner

self.saystatus(sclientk)

   def saystatus(self, sclientk):
-[TPF]-PtitBigorneau
http://www.PtitBigorneau.fr

pierreyves258
Messages : 35
Enregistré le : 24 mai 2011, 20:05

Re: Plugin B3 vérifier qu'un joueur existe

Message par pierreyves258 » 14 juin 2011, 20:09

quoi ???
mais sclientk est définit en global ... il marche dnas toutes les fonctions non ?
je comprend pas ce que tu veut dire

Avatar du membre
PtitBigorneau
Messages : 516
Enregistré le : 19 oct. 2008, 13:50
Localisation : brest

Re: Plugin B3 vérifier qu'un joueur existe

Message par PtitBigorneau » 14 juin 2011, 20:53

ben non c est pas definit
ERROR handler AdminPlugin could not handle event Say: NameError: global name 'sclientk' is not defined
:D
-[TPF]-PtitBigorneau
http://www.PtitBigorneau.fr

pierreyves258
Messages : 35
Enregistré le : 24 mai 2011, 20:05

Re: Plugin B3 vérifier qu'un joueur existe

Message par pierreyves258 » 14 juin 2011, 21:04

bah alors comment on fait une variable gobale ??????
sa vaut dire que yesvote, novote, ... ne sont pas définit non plus ?

la c'est toujours le meme problème ?

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 , ']')")]

Avatar du membre
PtitBigorneau
Messages : 516
Enregistré le : 19 oct. 2008, 13:50
Localisation : brest

Re: Plugin B3 vérifier qu'un joueur existe

Message par PtitBigorneau » 15 juin 2011, 01:00

le probleme est la

Code : Tout sélectionner

   def saystatus(self):
       self.console.say('Vote kick ' , self.sclientk.name , ' [' , self.novotes , ':' , self.yesvotes , ']')
comme ca, normalement

Code : Tout sélectionner

   def saystatus(self):
       self.console.say('Vote kick %s [%s : %s]' %(self.sclientk.name ,  self.novotes , self.yesvotes))
et ca

Code : Tout sélectionner

   def voteyes(self, data, client, cmd):
      if self.voteallow == 0:
        client.message('No vote allow')
      else:
       yesvotes += 1
       self.saystatus()
manque le self.

Code : Tout sélectionner

      self.yesvotes += 1
-[TPF]-PtitBigorneau
http://www.PtitBigorneau.fr

pierreyves258
Messages : 35
Enregistré le : 24 mai 2011, 20:05

Re: Plugin B3 vérifier qu'un joueur existe

Message par pierreyves258 » 15 juin 2011, 11:44

Voila

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
   
   
Mais encore une erreur, comme je n'ais pas très bien compris cette histoire d'executer une commande toutes les 20 sec avec cron je pense qu'il sagit d'une erreur de définition je ne sait pas ou ou une erreur de boucle mal placée ...

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:')]

Avatar du membre
PtitBigorneau
Messages : 516
Enregistré le : 19 oct. 2008, 13:50
Localisation : brest

Re: Plugin B3 vérifier qu'un joueur existe

Message par PtitBigorneau » 15 juin 2011, 12:33

je vais finir par te l ecrire ton plugin :D

alors

tu rajoute "_cronTab = None" la

Code : Tout sélectionner

class VotekickPlugin(b3.plugin.Plugin):

   _clientvar_name = 'votekick'
   _cronTab = None
tu remplace ca

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()
par

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
et tu remplace

Code : Tout sélectionner

   def saystatus(self):
       self.console.say('Vote kick %s [%s : %s]' %(self.sclientk.name ,  self.novotes , self.yesvotes))
par

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()
-[TPF]-PtitBigorneau
http://www.PtitBigorneau.fr

pierreyves258
Messages : 35
Enregistré le : 24 mai 2011, 20:05

Re: Plugin B3 vérifier qu'un joueur existe

Message par pierreyves258 » 15 juin 2011, 16:38

mais .. crontab continue quand meme a s'executer après 6 fois ... il n'y a aps de vonctions ou de je ne sait pas quoi pour aretter d'executer une fonction toutes les 20 sec

je doit ecrire sa quand je veux que sa s'arette ?

Code : Tout sélectionner

self._cronTab = None

Répondre