SHARE
TWEET

Untitled

a guest Jun 19th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import es
  2. from playerlib import getPlayer
  3. from usermsg import hudhint
  4.  
  5. class Aimbot(object):
  6.     class Player(object):
  7.         def __init__(self, userid):
  8.             self.team   = 0
  9.             self.userid = userid
  10.             self.enable = False
  11.             self.player = getPlayer(userid)
  12.        
  13.         def changeTeam(self, team):
  14.             self.team = 5 - team
  15.        
  16.         def setActive(self):
  17.             if self.enable:
  18.                 self.enable = False
  19.                 es.tell(self.userid, "#multi", "#green[#lightgreenAimbot#green] #defaultTurned off.")
  20.             else:
  21.                 self.enable = True
  22.                 es.tell(self.userid, "#multi", "#green[#lightgreenAimbot#green] #defaultTurned on.")
  23.        
  24.         def tryTurnOff(self):
  25.             if self.enable:
  26.                 self.setActive()
  27.        
  28.         def tryAimOnPlayer(self):
  29.             if self.enable:
  30.                 distance, closest = self.player.getClosestPlayer(self.team)
  31.                 if closest is not None:
  32.                     self.player.viewPlayer(closest)
  33.                     hudhint(self.userid, "BackRaw's AimBot\n--------------\n\nAiming at %s (Distance: %.2f meters)" % (es.getplayername(closest), distance * 0.0254))
  34.    
  35.     def __init__(self):
  36.         self.players = {}
  37.    
  38.     def insertUserid(self, userid):
  39.         self.players[userid] = self.Player(userid)
  40.    
  41.     def removeUserid(self, userid=0, clear=False):
  42.         if not clear:
  43.             del self.players[userid]
  44.         else:
  45.             self.players.clear()
  46.    
  47.     def roundEnd(self):
  48.         for userid in self.players:
  49.             self.players[userid].tryTurnOff()
  50.    
  51.     def playerDeath(self, userid):
  52.         self.players[userid].tryTurnOff()
  53.    
  54.     def changeTeam(self, userid, team):
  55.         if userid in self.players:
  56.             self.players[userid].changeTeam(team)
  57.    
  58.     def sayCommand(self, userid):
  59.         if userid in self.players:
  60.             self.players[userid].setActive()
  61.    
  62.     def scriptLoad(self):
  63.         for userid in map(str, es.getUseridList()):
  64.             self.insertUserid(userid)
  65.         es.regsaycmd("!ab", "aimbot/saycommand")
  66.         es.addons.registerTickListener(self._tickListener)
  67.    
  68.     def scriptUnload(self):
  69.         self.removeUserid(clear=True)
  70.         es.unregsaycmd("!ab")
  71.         es.addons.unregisterTickListener(self._tickListener)
  72.    
  73.     def _tickListener(self):
  74.         if self.players:
  75.             for userid in self.players:
  76.                 self.players[userid].tryAimOnPlayer()
  77.  
  78. aimbot = Aimbot()
  79.  
  80. def round_end(ev):
  81.     aimbot.roundEnd()
  82.  
  83. def player_activate(ev):
  84.     aimbot.insertUserid(ev["userid"])
  85.  
  86. def player_death(ev):
  87.     aimbot.playerDeath(ev["userid"])
  88.  
  89. def player_team(ev):
  90.     if not int(ev["disconnect"]):
  91.         aimbot.changeTeam(ev["userid"], int(ev["team"]))
  92.  
  93. def player_disconnect(ev):
  94.     aimbot.removeUserid(ev["userid"])
  95.  
  96. def saycommand():
  97.     aimbot.sayCommand(str(es.getcmduserid()))
  98.  
  99. def load():
  100.     aimbot.scriptLoad()
  101.  
  102. def unload():
  103.     aimbot.scriptUnload()
RAW Paste Data
Top