Advertisement
Guest User

err

a guest
Nov 5th, 2011
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4. #include <fakemeta>
  5. #include <hamsandwich>
  6. #include <fun>
  7. #include <cstrike>
  8.  
  9. new gp_TeamRatio
  10. new gp_CtMax
  11. new CTCount
  12. new TCount
  13.  
  14.  
  15.         gp_TeamRatio = register_cvar("jb_teamratio", "3")
  16.         gp_CtMax = register_cvar("jb_maxct", "6")
  17.  
  18.  
  19.  
  20. public count_teams()
  21.  
  22. {
  23.     CTCount = 0
  24.     TCount = 0
  25.  
  26.     new Players[32]
  27.     new playerCount, i
  28.     get_players(Players, playerCount, "")
  29.     for (i=0; i<playerCount; i++)
  30.     {
  31.         if (is_user_connected(Players[i]))
  32.         {
  33.             if (cs_get_user_team(Players[i]) == CS_TEAM_CT) CTCount++;
  34.             if (cs_get_user_team(Players[i]) == CS_TEAM_T) TCount++;
  35.         }
  36.     }
  37.    
  38.    
  39.    
  40.    
  41. }
  42.  
  43. bool:is_ct_allowed()
  44. {
  45.  
  46.  
  47.  
  48. new count
  49. count = ((TCount + CTCount) / get_pcvar_num(gp_TeamRatio))
  50. if(count < 2)
  51.     count = 2
  52.    
  53.     else if(count > get_pcvar_num(gp_CtMax))
  54.         count = get_pcvar_num(gp_CtMax)
  55.          if( count > CTCount )
  56.     {
  57.              remove_task(id)
  58.         return PLUGIN_CONTINUE
  59.  
  60.     }  
  61.          else
  62.     {
  63.              engclient_cmd(id, "chooseteam")
  64.         return PLUGIN_HANDLED  
  65.          }
  66. }
  67.  
  68. public client_disconnect(id)
  69.         {
  70.         count_teams()
  71.         }
  72.  
  73. public jointeam(id)
  74.         {
  75.         return PLUGIN_HANDLED
  76.         }
  77.  
  78.  
  79.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement