- Beranda
- Komunitas
- Tech
- Programmer Forum
momod tolong hapus thread saya


TS
seanman
momod tolong hapus thread saya
Mungkin dari agan2 disini ada yg mengerti kesalahan saya dimana?
memang ini module untuk game server battlefield 2 tapi
kejadiannya infantry dan vehicle tidak terkena warning saat menyerang bendera yg tidak bisa dicuri (safe base uncapturable). mudah2an ada yg bisa bantu
# ------------------------------------------------------------------------
# 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
# Set the description of your module here
__description__ = "AntiBaseRape v%s" % __version__
# ------------------------------------------------------------------------
# Constants
# ------------------------------------------------------------------------
DEFAULT_SAFEBASE_RADIUS = 100 # Default safe area radius (normal commandpoint radius = 10)
ALLOWED_SAFEBASEKILLS = 0
SAFEBASEKILL_TIMER_INTERVAL = 300 # Intervals between removing a point from players.baseRapeWarning
# ------------------------------------------------------------------------
# Variables
# ------------------------------------------------------------------------
WarnReduceTimer = None # 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
# ------------------------------------------------------------------------
#bersambung
memang ini module untuk game server battlefield 2 tapi
kejadiannya infantry dan vehicle tidak terkena warning saat menyerang bendera yg tidak bisa dicuri (safe base uncapturable). mudah2an ada yg bisa bantu
Spoiler for antibaserape:
# ------------------------------------------------------------------------
# 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
# Set the description of your module here
__description__ = "AntiBaseRape v%s" % __version__
# ------------------------------------------------------------------------
# Constants
# ------------------------------------------------------------------------
DEFAULT_SAFEBASE_RADIUS = 100 # Default safe area radius (normal commandpoint radius = 10)
ALLOWED_SAFEBASEKILLS = 0
SAFEBASEKILL_TIMER_INTERVAL = 300 # Intervals between removing a point from players.baseRapeWarning
# ------------------------------------------------------------------------
# Variables
# ------------------------------------------------------------------------
WarnReduceTimer = None # 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
# ------------------------------------------------------------------------
#bersambung
0
944
Kutip
1
Balasan


Komentar yang asik ya
Urutan
Terbaru
Terlama


Komentar yang asik ya
Komunitas Pilihan