Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
2,277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. from pubg_python import *
  2.  
  3. api_key = 'YOUR SECRET KEY'
  4. api = PUBG(api_key, Shard.STEAM)
  5.  
  6. player = api.players().filter(player_names=['glmn'])[0]
  7. player_id = player.id
  8. match = api.matches().get(player.matches[1])
  9. telemetry = api.telemetry(match.assets[0].url)
  10.  
  11. attacks = telemetry.events_from_type('LogPlayerAttack')
  12. kills = telemetry.events_from_type('LogPlayerKill')
  13. damages = telemetry.events_from_type('LogPlayerTakeDamage')
  14.  
  15. player_kills = len([_ for _ in kills if _.killer.account_id == player_id])
  16. player_attacks = [_ for _ in attacks if _.attacker.account_id == player_id
  17. and _.weapon.category == 'Weapon'
  18. and _.weapon.sub_category in ['Main', 'Handgun']]
  19. player_damages = [_ for _ in damages if _.attacker.account_id == player_id]
  20. used_weapon = {_.weapon.item_id:_.fire_weapon_stack_count
  21. for _ in player_attacks}
  22.  
  23. shots = sum(used_weapon.values())
  24. hits = len([_ for _ in player_damages if _.damage_reason in [
  25. "ArmShot",
  26. "HeadShot",
  27. "LegShot",
  28. "PelvisShot",
  29. "TorsoShot"]])
  30. headshots = len([_ for _ in player_damages if _.damage_reason == 'HeadShot'])
  31. headshots_percent = (headshots / hits * 100) if hits > 0 else 0
  32. accuracy = (hits / shots * 100) if shots > 0 else 0
  33.  
  34. print('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')))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement