KillerInfo
Posted: Fri Mar 25, 2016 8:23 am
Syntax: Select all
# =============================================================================
# >> IMPORTS
# =============================================================================
# Source.Python
from menus import Text
from events import Event
from mathlib import Vector
from menus import SimpleMenu
from messages import SayText2
from players.entity import Player
from weapons.entity import Weapon
from players.helpers import index_from_userid
# =============================================================================
# >> GAME EVENTS
# =============================================================================
@Event('player_death')
def player_death(event):
victim = index_from_userid(event.get_int('userid'))
killerID = event.get_int('attacker')
#Was it a suicide?
if killerID == 0 :
return
killer = Player(index_from_userid(event.get_int('attacker')))
weapon = event.get_string('weapon')
second_player = Player(victim)
distance = killer.origin.get_distance(second_player.origin)
menu = SimpleMenu()
menu.append(' Killer Info')
menu.append('--------------------------------')
menu.append('Killer : {0}'.format(killer.name))
menu.append('Arme : {0}'.format(weapon))
menu.append('Distance : {0}'.format(distance))
menu.append('Vie restante : {0}'.format(killer.health))
menu.append('Armure restante : {0}'.format(killer.armor))
menu.append(' ')
menu.append('0. Quitter')
menu.send(victim)
Syntax: Select all
@Event('player_death')
def player_death(game_event):
userid = game_event['userid']
attacker = game_event['attacker']
# Was this a suicide?
if attacker in (0, userid):
return
victim = Player(index_from_userid(userid))
killer = Player(index_from_userid(attacker))
# Was this a team kill?
if victim.team == killer.team:
return
Yes, it's planned, but that method just returns the data for ShowMenu which requires an integer that defines the duration to show the menu. However, as far as I remember that value is not really usable. If it's greater than 0, the menu shows up for 4 seconds. If the value is 0, it's shown permantently.satoon101 wrote:Actually, as far as the Delay calling close(), do we not have the ability to set that within the menu object itself? This line seems to indicate that that was at least planned at some point.