Advertisement
BM_R1KO

Untitled

Nov 2nd, 2017
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public Action Command_Counter(int client, any args)
  2. {
  3.     if (client != Warden)
  4.     {
  5.         return Plugin_Handled;
  6.     }
  7.     else if ((client == Warden || (gc_bCounterDeputy.BoolValue)) && gc_bCounter.BoolValue)
  8.     {
  9.         int iTarget = GetClientAimTarget(client, true);
  10.         if(iTarget == -1)
  11.         {
  12.             PrintToChat(client, "%s Стоп! укажи прицел на заключенных чтобы посчитать",chat_tag);
  13.             return Plugin_Handled;
  14.         }
  15.         float wardenOrigin[3];
  16.         GetClientAbsOrigin(client, wardenOrigin);
  17.         int iAlives, counter = 0;
  18.         int left, i;
  19.        
  20.         int[] iLeftClients = new int[MaxClients];
  21.        
  22.         for (i = 1; i <= MaxClients; ++i) if (IsClientInGame(i))
  23.         {
  24.             if (GetClientTeam(i) == CS_TEAM_T)
  25.             {
  26.                 if(IsPlayerAlive(i))
  27.                 {
  28.                     ++iAlives;
  29.                 }
  30.                 g_bCounted[i] = false;
  31.                 g_fDistance[i] = 0.0;
  32.                
  33.                 float clientOrigin[3];
  34.                 GetClientAbsOrigin(i, clientOrigin);
  35.                
  36.                 float distance = GetVectorDistance(clientOrigin, wardenOrigin, false);
  37.                
  38.                 if (ClientViews(client, i))
  39.                 {
  40.                     counter++;
  41.                     g_bCounted[i] = true;
  42.                     g_fDistance[i] = distance;
  43.                 }
  44.                 else if(GetClientTeam(i) == CS_TEAM_T && client != counter)
  45.                 {
  46.                     iLeftClients[left++] = i;
  47.                 }
  48.             }
  49.         }
  50.         if(iAlives == counter)
  51.         {
  52.             PrintToChatAll("%s Все [%i/%i] заключенных на месте!",chat_tag, counter ,iAlives);
  53.         }
  54.         else if(counter != iAlives)
  55.         {
  56.             PrintToChatAll("%s (%i человек в бегах) в строю [%i/%i]",chat_tag, left ,counter ,iAlives);
  57.             if(left)
  58.             {
  59.                 char szBuffer[256];
  60.                 GetClientName(iLeftClients[0], szBuffer, sizeof(szBuffer));
  61.                 for(i = 1; i < left; ++i)
  62.                 {
  63.                     Format(szBuffer, sizeof(szBuffer), ", %s", iLeftClients[i])
  64.                 }
  65.                 PrintToChatAll("В бегах: %s", szBuffer);
  66.             }
  67.         }
  68.     }
  69.     return Plugin_Handled;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement