· 6 years ago · Sep 19, 2019, 06:02 PM
1from pubg_python import *
2
3api_key = 'YOUR SECRET KEY'
4api = PUBG(api_key, Shard.STEAM)
5
6player = api.players().filter(player_names=['glmn'])[0]
7player_id = player.id
8match = api.matches().get(player.matches[1])
9telemetry = api.telemetry(match.assets[0].url)
10
11attacks = telemetry.events_from_type('LogPlayerAttack')
12kills = telemetry.events_from_type('LogPlayerKill')
13damages = telemetry.events_from_type('LogPlayerTakeDamage')
14
15player_kills = len([_ for _ in kills if _.killer.account_id == player_id])
16player_attacks = [_ for _ in attacks if _.attacker.account_id == player_id
17 and _.weapon.category == 'Weapon'
18 and _.weapon.sub_category in ['Main', 'Handgun']]
19player_damages = [_ for _ in damages if _.attacker.account_id == player_id]
20used_weapon = {_.weapon.item_id:_.fire_weapon_stack_count
21 for _ in player_attacks}
22
23shots = sum(used_weapon.values())
24hits = len([_ for _ in player_damages if _.damage_reason in [
25 "ArmShot",
26 "HeadShot",
27 "LegShot",
28 "PelvisShot",
29 "TorsoShot"]])
30headshots = len([_ for _ in player_damages if _.damage_reason == 'HeadShot'])
31headshots_percent = (headshots / hits * 100) if hits > 0 else 0
32accuracy = (hits / shots * 100) if shots > 0 else 0
33
34print('Kills: {} Shots: {} Hits: {} HS: {} HS%: {} ACC%: {}'.format(
35 player_kills,
36 shots,
37 hits,
38 headshots,
39 format(headshots_percent, '.2f'),
40 format(accuracy, '.2f')))