Forums
BF2Statistics.com :: Forums :: Off Topic
I need a No Commander script
hi.. today i post here becouse i hate commanders in small-size maps and if someone help me posting a script who disable commander mode [completely] i will be grateful
you cannot dissable the commander without creating a mod (and disable the button there).
The only thing you can do is warn and kick players who are commanders.
Im not at home right know so i cannot help you much, but this site could help you out:
http://bf2tech.org/index.php/Scripts:BF2Oldschool
The only thing you can do is warn and kick players who are commanders.
Im not at home right know so i cannot help you much, but this site could help you out:
http://bf2tech.org/index.php/Scripts:BF2Oldschool
What you do not like the script?
- # Commander Kill System
- # Module: comdis.py
- # Author: REW
- # Version: 1.0
- import bf2
- import host
- import mm_utils
- from bf2.stats.constants import *
- from bf2 import g_debug
- #debug flag
- sks_debug = False # for verbose server console messages
- #variable settings; intervals are in seconds
- minP = 10 # max players for 'no commanders' mode
- killInterval = 5 # time before a commander is killed
- msgInterval = 90 # time between warning messages
- #timers
- msgTimer = None
- #queue lists
- killList = []
- __version__ = 1.0
- __required_modules__ = {
- 'modmanager': 1.2
- }
- __supports_reload__ = True
- __description__ = "ModManager Commander Killer v%s" % __version__
- class ComDis( object ):
- def __init__( self, modManager ):
- # ModManager reference
- self.mm = modManager
- self.__state = 0
- # Initialize the kill system i.e. register game hooks.
- def init( self ):
- if 0 == self.__state:
- host.registerHandler('PlayerSpawn', self.onPlayerSpawn, 1)
- #host.registerHandler('EnterVehicle', self.onEnterVehicle, 1)
- host.registerHandler('ChangedCommander', self.onChangedCommander, 1)
- host.registerGameStatusHandler(self.onGameStatusChanged)
- self.__state = 1
- def onChangedCommander(self, team, oldCmd, newCmd):
- self.CheckForCommander()
- # On spawn, checks if the player is a commander.
- # Player is added to kill list if player is a commander.
- def onPlayerSpawn(self, p, vehicle):
- self.CheckForCommander()
- # On enter vehicle, checks if the any player is a commander.
- # Player is added to kill list if player is a commander.
- def onEnterVehicle( self, p, vehicle, freeSoldier):
- self.CheckForCommander()
- def CheckForCommander( self ):
- global sks_debug
- global killList, killInterval, minP
- players = bf2.playerManager.getPlayers()
- numP = bf2.playerManager.getNumberOfPlayers()
- for pl in players:
- if pl.isCommander() and numP <= minP:
- # Add the player if not in kill list
- killList.append(pl.index)
- # Set timer for kill
- bf2.Timer(self.onKillTimer, killInterval, 1)
- # Issue kill warning
- mm_utils.msg_server( "§3= SCRIPT: §C1001%s§C1001, §C1001NO COMMANDERS§C1001! You will §C1001DIE§C1001 in §C1001%s§C1001 sec! =" % ( pl.getName(), killInterval ))
- # Sends out warning messages
- def onMsgTimer(self, data):
- global sks_debug
- global minP
- numP = bf2.playerManager.getNumberOfPlayers()
- commander1 = bf2.playerManager.getCommander(1)
- commander2 = bf2.playerManager.getCommander(2)
- #if ((commander1 != None) or (commander2 != None)) and (numP <= minP):
- if (numP <= minP):
- mm_utils.msg_server( "= SCRIPT: §C1001NO COMMANDERS§C1001 or you will §C1001DIE§C1001! Players: §C1001%s§C1001<§C1001%s§C1001 =" % ( numP, minP+1 ) )
- # Processes the kill list queue. The next player in queue
- # is checked again and killed if a commander.
- def onKillTimer(self, data):
- global sks_debug
- global killList
- global minP
- # Process the next player in queue.
- p = bf2.playerManager.getPlayerByIndex(killList.pop(0))
- numP = bf2.playerManager.getNumberOfPlayers()
- # Player is still a commander, kill him.
- if p.isCommander() and p.isValid() and p.isAlive() and (numP <= minP):
- #host.rcon_invoke("admin.kickPlayer " + str(p.index))
- vehicle = p.getVehicle()
- rootVehicle = getRootParent(vehicle)
- if getVehicleType(rootVehicle.templateName) == VEHICLE_TYPE_SOLDIER:
- rootVehicle.setDamage(0)
- # This should kill them !
- else:
- rootVehicle.setDamage(0.01)
- # a vehicle will likely explode within 0.3 sec killing entire crew,
- # not so sure about base defenses though
- p.score.score = p.score.score - 5
- mm_utils.msg_server( "= SCRIPT: commander §C1001%s§C1001 was punished by \'Commander Killer\' script =" % ( p.getName() ) )
- # Handles clean up and initialization between rounds.
- def onGameStatusChanged(self, status):
- global killList
- global msgInterval, msgTimer
- if status == bf2.GameStatus.Playing:
- # Set the warning timer.
- msgTimer = bf2.Timer(self.onMsgTimer, msgInterval, 1)
- msgTimer.setRecurring(msgInterval)
- elif status == bf2.GameStatus.PreGame:
- # Destroy any timers
- msgTimer.destroy()
- msgTimer = None
- # Blank the list.
- killList = []
- elif status == bf2.GameStatus.EndGame:
- pass
- def shutdown( self ):
- """Shutdown and stop processing."""
- # Unregister our handlers
- host.unregisterGameStatusHandler( self.onGameStatusChanged )
- # Unregister our game handlers
- # Flag as shutdown as there is currently way to do this
- self.__state = 2
- def mm_load( modManager ):
- """Creates your object."""
- return ComDis( modManager )
maybe ill take shark's script.. i hate BF2 old school it only works with PB...wagg but maybe someone can help me modding?? to disable the button like WYD Elite Snipers Server at V1.0
ohhhhhhhh i've found the magic key people!!!!!
i've searching at the folders of the server and i found this archive at %Battlefield2serverRoot%/mods/bf2/phyton/game/gamemodes/gpm_cq.py at line 28 and 30
host.sh_setEnable_Commander (1) [original] and i set it to 0 and vualà commander mode eliminated!!!!!
i've searching at the folders of the server and i found this archive at %Battlefield2serverRoot%/mods/bf2/phyton/game/gamemodes/gpm_cq.py at line 28 and 30
host.sh_setEnable_Commander (1) [original] and i set it to 0 and vualà commander mode eliminated!!!!!

Joined: Sun Jul 26 2009, 10:00AM
Joined: Sun Nov 26 2006, 02:56PM