Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pubg_python import *
- api_key = 'YOUR SECRET KEY'
- api = PUBG(api_key, Shard.STEAM)
- player = api.players().filter(player_names=['glmn'])[0]
- player_id = player.id
- match = api.matches().get(player.matches[1])
- telemetry = api.telemetry(match.assets[0].url)
- attacks = telemetry.events_from_type('LogPlayerAttack')
- kills = telemetry.events_from_type('LogPlayerKill')
- damages = telemetry.events_from_type('LogPlayerTakeDamage')
- player_kills = len([_ for _ in kills if _.killer.account_id == player_id])
- player_attacks = [_ for _ in attacks if _.attacker.account_id == player_id
- and _.weapon.category == 'Weapon'
- and _.weapon.sub_category in ['Main', 'Handgun']]
- player_damages = [_ for _ in damages if _.attacker.account_id == player_id]
- used_weapon = {_.weapon.item_id:_.fire_weapon_stack_count
- for _ in player_attacks}
- shots = sum(used_weapon.values())
- hits = len([_ for _ in player_damages if _.damage_reason in [
- "ArmShot",
- "HeadShot",
- "LegShot",
- "PelvisShot",
- "TorsoShot"]])
- headshots = len([_ for _ in player_damages if _.damage_reason == 'HeadShot'])
- headshots_percent = (headshots / hits * 100) if hits > 0 else 0
- accuracy = (hits / shots * 100) if shots > 0 else 0
- print('Kills: {} Shots: {} Hits: {} HS: {} HS%: {} ACC%: {}'.format(
- player_kills,
- shots,
- hits,
- headshots,
- format(headshots_percent, '.2f'),
- format(accuracy, '.2f')))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement