Advertisement
errur

Get bots

Sep 18th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. function GetPlayers()
  2. {
  3.     //This doesn't find bots, only players
  4.     PLAYERS <- {}
  5.    
  6.     ent <- null
  7.     while((ent = Entities.FindByClassname(ent, "player")) != null)
  8.     {
  9.         PLAYERS[ent] <- 1;
  10.     }
  11.     return PLAYERS;
  12. }
  13.  
  14. function GetBots()
  15. {
  16.     BOTS <- {};
  17.     PLAYERS = GetPlayers();
  18.    
  19.     //This finds both bots and players
  20.     bot <- null;
  21.     while((bot = Entities.FindByModel(bot, "models/player/custom_player/legacy/ctm_st6.mdl")) != null)
  22.     {  
  23.         try
  24.         {
  25.             if(PLAYERS[bot] == null)
  26.                 continue;
  27.         }
  28.         catch(exception)
  29.         {
  30.             BOTS[bot] <- 1;
  31.         }
  32.     }
  33.  
  34.     while((bot = Entities.FindByModel(bot, "models/player/custom_player/legacy/tm_phoenix.mdl")) != null)
  35.     {  
  36.         try
  37.         {
  38.             if(PLAYERS[bot] == null)
  39.                 continue;
  40.         }
  41.         catch(exception)
  42.         {
  43.             BOTS[bot] <- 1;
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement