Ejemplo n.º 1
0
	player.ip = event.ip
	player.lastconnect = time.time()

def player_weaponstats(event,ip,port,timestamp):
	player = Stats.getPlayer(event.steamid,ip,port)

	player.checkName(event.name)

	curWeapon = player.getWeapon(event.weapon)
	
	curWeapon.kills += event.kills
	curWeapon.headshots += event.headshots
	curWeapon.damage += event.damage
	curWeapon.tks += event.tks

def player_attacked(event,ip,port,timestamp):
	attacker = Stats.getPlayer(event.attacker_steamid,ip,port)

	attacker.checkName(event.attacker_name)

	curWeapon = attacker.getWeapon(event.weapon)
        curWeapon.damage += event.damage


from eventhandler import eventhandler
eventhandler.registerCallback(player_killed,['player_killed'])
eventhandler.registerCallback(player_suicide,['player_suicide'])
eventhandler.registerCallback(player_connect,['player_connect'])
eventhandler.registerCallback(player_weaponstats,['player_weaponstats'])
eventhandler.registerCallback(player_attacked,['player_attacked'])
Ejemplo n.º 2
0

def player_triggered(event, ip, port, timestamp):
    player = Stats.getPlayer(event.steamid, ip, port)
    curevent = player.getEvent(event.event)

    curevent.trigger_count += 1


def player_joinedteam(event, ip, port, timestamp):
    player = Stats.getPlayer(event.steamid, ip, port)

    player.getTeam(event.newteam).join_count += 1


def server_map(event, ip, port, timestamp):
    curmap = Stats.getServerMap(ip, port)

    players = Stats.getPlayers(ip, port)
    for cur in players:
        players[cur].savePlayer(ip, port, curmap)

    Stats.setServerMap(ip, port, event.map)


from eventhandler import eventhandler

eventhandler.registerCallback(player_triggered, ["player_triggered"])
eventhandler.registerCallback(player_joinedteam, ["player_joinedteam"])
eventhandler.registerCallback(server_map, ["server_map"])
Ejemplo n.º 3
0
import logging
main_log = logging.getLogger("main_log")

player_count = 0
def player_connect(event,ip,port,timestamp):
	global player_count
	player_count += 1
	main_log.debug("%i players have connected so far" % player_count)

from eventhandler import eventhandler
eventhandler.registerCallback(player_connect,['player_connect'])