Добро пожаловать на форумы Боевого Народа (бывший форум Live.CNews.ru)!

ВАЖНЫЕ ТЕМЫ: FAQ по переезду и восстановлению учеток | Ошибки и глюки форума.
О проблемах с учетными записями писать СЮДА.
Modmanager - Форумы Боевого Народа
IPB

Здравствуйте, гость ( Вход | Регистрация )

Modmanager, Помогите найти скрипты!
сообщение 26.12.2010, 16:42
Сообщение #1





Группа:
Сообщений: 0
Регистрация: --
Пользователь №:



Увидел в нете описание скрипта для Модмэнеджера mm_squadlesskick . И теперь я хочу его найти!

Также необходим скрипт для запрета атаки незахватываемых баз (НБ)!

Плизз помогите если у кого такое есть!
Перейти в начало страницы
Вставить ник
+Цитировать сообщение
 
Начать новую тему
Ответов
сообщение 6.1.2011, 1:03
Сообщение #2





Группа:
Сообщений: 0
Регистрация: --
Пользователь №:



По ссылке выше скрипты не под "MM", а под "default". Так-то оно роли не играет, подправил и работает.
mm_antirape.py
Раскрывающийся текст
Код
# ------------------------------------------------------------------------
# Module: AntiBaseRape.py
# Author: SHAnders
# Port to bf2cc/mm: graag42
#
# Version 1.11
#
# Changes:
#   v1.1 -> 1.11
#   Fixed the timer to only be started once
#   v1.0 -> 1.1
#   Implemted a baseRapeWarning attribute on players to count safe base kills
#   Implemted allowed amount of safe base kills (3)
#      up to this amount player only loses kill points + 1 score pr baseRapeWarning
#      over this amount player is allso killed
#   Implemtes a timer for removing 1 baseRapeWarning every 2 minutes
#
# Description:
#   Server side only admin script
#
#   This script will punish players who kill enemy within the area of a safe base
#  
# Requirements:
#   None.
#
# Installation as Admin script:
#   1: Save this script as 'AntiBaseRape.py' in your <bf2>/admin/standard_admin directory.
#   2: Add the lines 'import AntiBaseRape' and 'AntiBaseRape.init()' to the file
#      '<bf2>/admin/standard_admin/__init__.py'.
#
# TODO:
#   Since not all maps are alike, the requirements for base rape protiction
#   should be able to be altered individualy for each control point.
#
# Thanks to:
#   Battlefield.no for inspiration from their pingkick.py script
#
# ------------------------------------------------------------------------

import host
import bf2
import math
import mm_utils
from bf2.stats.constants import *
from bf2 import g_debug

# Set the version of your module here
__version__ = 1.11

# Set the required module versions here
__required_modules__ = {
    'modmanager': 1.0
}

# Does this module support reload ( are all its reference closed on shutdown? )
__supports_reload__ = True


__supported_games__ = {
    'bf2': True,
    'bf2142': True,
    'bfheroes': False
}

# Set the description of your module here
__description__ = "AntiBaseRape v%s" % __version__

# ------------------------------------------------------------------------
# Constants
# ------------------------------------------------------------------------

DEFAULT_SAFEBASE_RADIUS = 30 # Default safe area radius (normal commandpoint radius = 10)
ALLOWED_SAFEBASEKILLS = 3
SAFEBASEKILL_TIMER_INTERVAL = 120 # Intervals between removing a point from players.baseRapeWarning

# ------------------------------------------------------------------------
# Variables
# ------------------------------------------------------------------------

WarnReduceTimer = 100 # Timer that reduces the warnings at intervals

# ------------------------------------------------------------------------
# Init
# ------------------------------------------------------------------------

class BaseRape( object ) :

   def __init__( self, modManager ):
      # ModManager reference
      self.mm = modManager
    
      # Internal shutdown state
      self.__state = 0

   def init( self ):
      if g_debug: print "AntiBaseRape init"
      if 0 == self.__state:
         host.registerHandler('PlayerConnect', self.onPlayerConnect, 1)  
         host.registerHandler('PlayerKilled', self.onPlayerKilled)
          
         # Update to the running state
         self.__state = 1
        
         # Start the timer that reduces warnings on the SAFEBASEKILL_TIMER_INTERVAL
         WarnReduceTimer = bf2.Timer(self.onSafeBaseKillTimer, SAFEBASEKILL_TIMER_INTERVAL, 1)
         WarnReduceTimer.setRecurring(SAFEBASEKILL_TIMER_INTERVAL)
        
         # Connect already connected players if reinitializing
         for p in bf2.playerManager.getPlayers():
            self.onPlayerConnect(p)
   # ------------------------------------------------------------------------


   # ------------------------------------------------------------------------
   #  onPlayerConnect
   # ------------------------------------------------------------------------
   def onPlayerConnect(self, player):
      self.resetPlayer(player)
   # ------------------------------------------------------------------------


   # ------------------------------------------------------------------------
   # onPlayerKilled
   # ------------------------------------------------------------------------
   def onPlayerKilled(self, victim, attacker, weapon, assists, object):
      # killed by self
      if attacker == victim:
         pass
        
      # killed by enemy
      elif attacker != None and attacker.getTeam() != victim.getTeam():
         self.checkForSafeBase(attacker, victim)
   # ------------------------------------------------------------------------


   def shutdown( self ):
      """Shutdown and stop processing."""
      
      # Unregister game handlers and do any other
      # other actions to ensure your module no longer affects
      # the game in anyway
      if WarnReduceTimer:
        WarnReduceTimer.destroy()
        WarnReduceTimer = None
        
      # Flag as shutdown as there is currently way to:
      # host.unregisterHandler
      self.__state = 2

   # ------------------------------------------------------------------------
   # Reset the number of warnings
   # ------------------------------------------------------------------------
   def resetPlayer(self, player):
      player.baseRapeWarning = 0
   # ------------------------------------------------------------------------


   # ------------------------------------------------------------------------
   # Check if victim was killed within safebase area
   # ------------------------------------------------------------------------
   def checkForSafeBase(self, attacker, victim):
      victimVehicle = victim.getVehicle()
      controlPoints = bf2.objectManager.getObjectsOfType('dice.hfe.world.ObjectTemplate.ControlPoint')
      for cp in controlPoints:
         if cp.cp_getParam('unableToChangeTeam') != 0 and cp.cp_getParam('team') != attacker.getTeam():
            distanceTo = self.getVectorDistance(victimVehicle.getPosition(), cp.getPosition())
            if DEFAULT_SAFEBASE_RADIUS > float(distanceTo):
               self.justify(attacker, victim, cp, distanceTo)
   # ------------------------------------------------------------------------


   # ------------------------------------------------------------------------
   # Punish attacker, give victim life back and inform all
   # ------------------------------------------------------------------------
   def justify(self, attacker, victim, controlPoint, distanceTo):
      victim.score.deaths += -1
      attacker.score.kills += -10
      attacker.score.score += -20 - attacker.baseRapeWarning
      attacker.baseRapeWarning += 1
      self.sendWarning(attacker, controlPoint, distanceTo)
      if attacker.baseRapeWarning > ALLOWED_SAFEBASEKILLS:
         attacker.score.TKs += 1
         if attacker.isAlive():
            vehicle = attacker.getVehicle()
            rootVehicle = getRootParent(vehicle)
            if getVehicleType(rootVehicle.templateName) == VEHICLE_TYPE_SOLDIER:
               rootVehicle.setDamage(0)
               # This should kill them !
            else:
               rootVehicle.setDamage(1)
               # a vehicle will likely explode within 1 sec killing entire crew,
               # not so sure about base defenses though
   # ------------------------------------------------------------------------


   # ------------------------------------------------------------------------
   # Send Warning
   # ------------------------------------------------------------------------
   def sendWarning(self, player, controlPoint, distanceTo):
      mapName = bf2.gameLogic.getMapName()
      if player.baseRapeWarning > ALLOWED_SAFEBASEKILLS:
         mm_utils.msg_server(player.getName() + "§c1001 is punished for repeated violating of the no kill rules within safe base area")
      else:
         mm_utils.msg_server(player.getName() + "§c1001 has violated the no kill rules within safe base area " + str(player.baseRapeWarning) + " times now")
   # ------------------------------------------------------------------------


   # ------------------------------------------------------------------------
   # remove baseRapeWarnings over time
   # ------------------------------------------------------------------------
   def onSafeBaseKillTimer(self, data):
      for p in bf2.playerManager.getPlayers():
         if p.baseRapeWarning <= 0:
            p.baseRapeWarning = 0
         else:
            p.baseRapeWarning += -1
   # ------------------------------------------------------------------------


   # ------------------------------------------------------------------------
   # get distance between two positions
   # ------------------------------------------------------------------------
   def getVectorDistance(self, pos1, pos2):
      diffVec = [0.0, 0.0, 0.0]
      diffVec[0] = math.fabs(pos1[0] - pos2[0])
      diffVec[1] = math.fabs(pos1[1] - pos2[1])
      diffVec[2] = math.fabs(pos1[2] - pos2[2])
      
      return math.sqrt(diffVec[0] * diffVec[0] + diffVec[1] * diffVec[1] + diffVec[2] * diffVec[2])
   # ------------------------------------------------------------------------


# ------------------------------------------------------------------------
# ModManager Init
# ------------------------------------------------------------------------
def mm_load( modManager ):
    """Creates and returns your object."""
    return BaseRape( modManager )
Перейти в начало страницы
Вставить ник
+Цитировать сообщение

Сообщений в этой теме
- bobby86   Modmanager   26.12.2010, 16:42
- - Chitinec   Скрипты для сервера BF2 - Вот тут есть скрипты и н...   29.12.2010, 13:28
- - bobby86   Спасибо за ссылку!   4.1.2011, 8:22
- - bobby86   Не могу запустить скрипт AntiBaseRape. Пишет что о...   6.1.2011, 0:24
- - Excavator   По ссылке выше скрипты не под "MM", а по...   6.1.2011, 1:03
|- - DrroneZZ   Цитата(Excavator @ Четверг, 6 Января 2011, 01...   21.4.2011, 22:44
- - bobby86   Спасибо большое!   7.1.2011, 21:49
- - serg005   при заходе на 1 забугорный сервер видел надпись вв...   15.1.2011, 19:08
- - Daimon_   по моему скрипт хедшот подобную хрень пишет.   15.1.2011, 19:16
- - serg005   Daimon_ он пишет хед шот а мультикилл вроде другое...   15.1.2011, 21:11
- - Rafaraf   помогите со скриптом который отслеживает PID=0 а т...   29.3.2011, 1:44
- - Daimon_   Цитатапомогите со скриптом который отслеживает PID...   29.3.2011, 9:29
- - Rafaraf   просто при переходе умножается на -1 перешел минус...   29.3.2011, 16:09
|- - dofamin   Цитата(Rafaraf @ Вторник, 29 Марта 2011, 15...   29.3.2011, 16:59
- - Rafaraf   в принципе есть готовый ивент, надо только написат...   29.3.2011, 20:37
- - Rafaraf   чат то я вижу в bf2cc вопрос как его оттуда сбрасы...   30.3.2011, 0:34
|- - Daimon_   Цитата(Rafaraf @ Среда, 30 Марта 2011, 00...   30.3.2011, 7:07
- - Rafaraf   как в демоне запустить не bf2, а мод brw ? не наше...   30.3.2011, 17:31
|- - dofamin   Цитата(Rafaraf @ Среда, 30 Марта 2011, 16...   30.3.2011, 17:58
- - sh@rk   ну да чата я использую mm_iga команда переброса та...   31.3.2011, 8:48
- - Rafaraf   да что то попытка запустить bf2ccd кончилась восс...   1.4.2011, 0:12
- - Daimon_   вот http://depositfiles.com/files/s92he2cj5 то, чт...   22.4.2011, 7:47
- - Neon_nm   Привет Всем! Парни выручайте, полетел винт , н...   19.5.2011, 23:16
- - GIGABIT   Здравствуйте! Помогите пожалуйста,а проблема т...   1.8.2011, 8:20
- - sh@rk   mm_comdis.py - куда кинул?   1.8.2011, 13:01
- - GIGABIT   sh@rk Ребята,Спасибо большое что обратили внимание...   2.8.2011, 8:04
- - uks_serg   нет у кого скрипта автобаланса под мод манагер что...   23.9.2011, 9:32
- - sh@rk   Код# # ModManager Team autobalance # mm_autobalanc...   23.9.2011, 15:57
- - uks_serg   у меня так и настроено, 2 раунда на карте. после к...   23.9.2011, 16:05
- - sh@rk   так это нормально! так и должно быть   23.9.2011, 18:05
- - uks_serg   ненормально)) кто подскажет, как сделать чтобы хот...   23.9.2011, 18:10
- - sh@rk   не кому такая штука случаем не попадалась?!   14.10.2011, 23:01
- - DeniM_FAGoT   Тоже ищу... у кого есть поделитесь плиз   16.11.2011, 22:12
- - Rafaraf   я взял скрипт автобаланса из AD manager он правда ...   18.11.2011, 2:00
- - sh@rk   а поделися скриптом? Интересно глянуть что ты там ...   18.11.2011, 6:28
- - DeniM_FAGoT   поддерживаю! охота посмотреть скриптик   19.11.2011, 1:11
- - Rafaraf   http://forum.povet.ru/files/file/40-ad-manager/ ко...   26.11.2011, 23:05
- - DeniM_FAGoT   спасибо :+:   26.11.2011, 23:37
- - $korpi()n   дайте другую сылку на этот скрипт   1.2.2012, 9:23
- - sh@rk   зерколо - если вдруг ещё кому нужен этот скрипт......   1.2.2012, 11:09
- - Vostok3Bit   Обе ссылки не работают. Может быть обновите , мужи...   19.5.2012, 14:54
- - sh@rk   если уточнишь что нужно)   20.5.2012, 7:10
- - oleg-sn   Народ дайте ктонить ссыль на скрипт который добавл...   13.4.2013, 22:52


Ответить в данную темуНачать новую тему
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 



Текстовая версия Сейчас: 24.9.2024, 15:52
Консультации адвоката по уголовным делам. Бесплатно. По всей России