Advertisement
Guest User

Untitled

a guest
Dec 10th, 2015
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.17 KB | None | 0 0
  1. #include a_samp
  2. #define MAX_PLAYERS 10
  3. new Text:Text_Draw[249]; //ñîçäàíûå ÒÄ
  4. new bool:ExplodeText;
  5. new ClickPlayer[ MAX_PLAYERS ][ 84 ],CloseRefresh[ MAX_PLAYERS ][ 84 ];
  6. new wins[ 3 ];
  7. new tts[ 40 ];
  8. new str[ 128 ];
  9. new Winxod[ 82 ][ 3 ] = {
  10. //----ïðîñòûå ðåøåíèÿ
  11. {1,2,3},        {4,5,6},        {7,8,9},    {10,11,12},         {13,14,15},     {16,17,18},     {19,20,21},     {22,23,24},     {25,26,27},
  12. {28,29,30},     {31,32,33},     {34,35,36}, {37,38,39},     {40,41,42},     {43,44,45},     {46,47,48},     {49,50,51},     {52,53,54},
  13. {64,65,66},     {67,68,69},     {70,71,72}, {73,74,75},     {76,77,78},     {79,80,81},     {58,59,60},     {61,62,63},     {55,56,57},
  14. //----òÿæåëûå ðåøåíèÿ
  15. {28,37,46},     {29,38,47},     {30,39,48}, {46,38,30},     {48,38,28},     {31,40,49},     {32,41,50},     {33,42,51},     {51,41,31},
  16. {49,41,33},     {34,43,52},     {35,44,53}, {36,45,54},     {34,44,54},     {52,44,36},     {28,29,30},     {31,32,33},     {34,35,36},
  17. {37,38,39},     {40,41,42},     {43,44,45}, {46,47,48},     {49,50,51},     {52,53,54},     {1,10,19},      {20,11,2},      {3,12,21},
  18. {19,11,3},      {1,11,21},      {4,13,22}{5,14,23},      {6,15,24},      {24,14,4},      {22,14,6},      {7,16,25},      {8,17,26},
  19. {9,18,27},      {25,17,9},      {7,17,27}{55,64,73},     {56,65,74},     {57,66,75},     {75,65,55},     {73,65,57},         {58,67,76},
  20. {59,68,77},     {60,69,78},     {78,68,58}, {76,68,60},         {61,70,79},     {62,71,80},     {63,72,81},     {81,71,61},     {79,71,63}, //55
  21. {2,11,20}
  22. };
  23.  
  24. public OnFilterScriptInit()
  25. {
  26.     new count = 0;
  27.     Text_Draw[0] = TextDrawCreate(480.000000, 120.000000, "fon");
  28.     TextDrawLetterSize(Text_Draw[0], 50.880000, 35.899999);
  29.     TextDrawUseBox(Text_Draw[0], 1);
  30.     TextDrawBoxColor(Text_Draw[0], 842282239);
  31.     TextDrawTextSize(Text_Draw[0], 197.000000, 0.000000);
  32.     count = 1;
  33.     for(new r = 0; r < 9; r++)
  34.     {
  35.         for(new f = 0; f < 9; f++)
  36.         {
  37.             Text_Draw[count] = TextDrawCreate(211.0 + f * 28.3, 141.0 + r * 32.3, "LD_SPAC:white");
  38.             TextDrawBackgroundColor(Text_Draw[count], 255);
  39.             TextDrawFont(Text_Draw[count], 4); //òåñò ïîñòàâèò 4
  40.             TextDrawLetterSize(Text_Draw[count], 0.500000, -5.600000);
  41.             TextDrawColor(Text_Draw[count], 253831424);
  42.             TextDrawSetOutline(Text_Draw[count], 0);
  43.             TextDrawUseBox(Text_Draw[count], 1);
  44.             TextDrawBoxColor(Text_Draw[count], 0);
  45.             TextDrawTextSize(Text_Draw[count], 28.000000, 32.000000);
  46.             TextDrawSetPreviewModel(Text_Draw[count], 19466);
  47.             TextDrawSetPreviewRot(Text_Draw[count], 0.000000, 0.000000, 90.000000, 0.000099);
  48.             TextDrawSetSelectable(Text_Draw[count], 1);
  49.             count++;
  50.         }
  51.     }//81
  52.     Text_Draw[82] = TextDrawCreate(480.000000, 238.000000, "fon"),Text_Draw[83] = TextDrawCreate(480.000000, 334.000000, "fon"),Text_Draw[84] = TextDrawCreate(383.000000, 120.000000, "fon"),Text_Draw[85] = TextDrawCreate(299.000000, 120.000000, "fon");
  53.     TextDrawLetterSize(Text_Draw[82], 0.880000, 0.0),TextDrawLetterSize(Text_Draw[83], 0.880000, 0.0),TextDrawLetterSize(Text_Draw[84], 0.880000, 35.0),TextDrawLetterSize(Text_Draw[85], 0.880000, 35.0);
  54.     TextDrawUseBox(Text_Draw[82], 1),TextDrawUseBox(Text_Draw[83], 1),TextDrawUseBox(Text_Draw[84], 1),TextDrawUseBox(Text_Draw[85], 1);
  55.     TextDrawBoxColor(Text_Draw[82], 842282239),TextDrawBoxColor(Text_Draw[83], 842282239),TextDrawBoxColor(Text_Draw[84], 842282239),TextDrawBoxColor(Text_Draw[85], 842282239);
  56.     TextDrawTextSize(Text_Draw[82], 197.000000, 0.000000),TextDrawTextSize(Text_Draw[83], 197.000000, 0.000000),TextDrawTextSize(Text_Draw[84], 377.000000, 0.000000),TextDrawTextSize(Text_Draw[85], 293.000000, 0.000000); count = 86;
  57.     for(new r = 0; r < 9; r++)
  58.     {
  59.         for(new f = 0; f < 9; f++)
  60.         {
  61.             Text_Draw[count] = TextDrawCreate(221.0 + f * 28.0, 151.0 + r * 32.0, "X");
  62.             Text_Draw[count + 1] = TextDrawCreate(221.0 + f * 28.0, 151.0 + r * 32.0, "0");
  63.             for(new j = 0; j < 2; j++)
  64.             {
  65.                 TextDrawBackgroundColor(Text_Draw[count + j], 255);
  66.                 TextDrawFont(Text_Draw[count + j], 1);
  67.                 TextDrawLetterSize(Text_Draw[count + j], 0.500000, 1.000000);
  68.                 TextDrawColor(Text_Draw[count + j], -1);
  69.                 TextDrawSetOutline(Text_Draw[count + j], 0);
  70.                 TextDrawSetProportional(Text_Draw[count + j], 1);
  71.                 TextDrawSetShadow(Text_Draw[count + j], 1);
  72.                 TextDrawSetSelectable(Text_Draw[count + j], 0);
  73.             }
  74.             count += 2;
  75.         }
  76.     }
  77.     return 1;
  78. }
  79.  
  80. public OnFilterScriptExit()
  81. {
  82.     for(new i; i < 249; i++) TextDrawDestroy(Text_Draw[i]);
  83. }
  84. public OnPlayerText(playerid, text[])
  85. {
  86.     if(!strcmp("game", text, true))
  87.     {
  88.         for(new i; i < 84; i++) ClickPlayer[playerid][i] = 0;
  89.         SelectTextDraw(playerid,-909604865);
  90.         for(new i; i < 86; i++) TextDrawShowForPlayer(playerid, Text_Draw[i]); // îñíîâíîå
  91.      }
  92. }
  93.  
  94. stock Resultgame(playerid, number )
  95. {
  96.     for(new i = 0; i < 84; i++)
  97.     {
  98.         new count[3] = 0; //1 крестик 2 нолик
  99.         for(new f = 0; f < 3; f++)
  100.         {
  101.             if(ClickPlayer[playerid][Winxod[i][f]] == number) count[number]++,printf("%d",Winxod[i][f]);
  102.         }
  103.         if(count[number] == 3)
  104.     {
  105.         if(number == 1) tts = "Победил крестик",wins[1]++;
  106.         else if(number == 2) tts = "Победил нолик",wins[2]++;
  107.         wins[0] =1,count[1] = 0,count[2] = 0;
  108.         if(wins[1] == 3 || wins[2] == 3)
  109.         {
  110.             format(str,sizeof(str),"Игра окончена [Крестик: %d || Нолик: %d ] ",wins[1],wins[2]);
  111.             SendClientMessage(playerid, 0xFF0150FF, str);
  112.             CancelSelectTextDraw(playerid);
  113.             wins[2] =0,wins[1] =1;
  114.             for(new g; g < 86; g++) CloseRefresh[playerid][i] = 0;
  115.                 for(new s; s < 249; s++) TextDrawHideForPlayer(playerid, Text_Draw[s]);
  116.                 return 1;
  117.         }
  118.         else SendClientMessage(playerid, 0xFF0150FF, tts);
  119.         return 1;
  120.     }
  121.     }
  122.     return false;
  123. }
  124. public OnPlayerClickTextDraw(playerid, Text:clickedid)
  125. {
  126.     if(!(_:clickedid ^ 0xFFFF))
  127.     {
  128.         wins[2] =0,wins[1] =1;
  129.         for(new s; s < 249; s++) TextDrawHideForPlayer(playerid, Text_Draw[s]);
  130.         for(new i; i < 86; i++) CloseRefresh[playerid][i] = 0;
  131.     }
  132.     for(new i = 1; i < 82; i++)
  133.     {
  134.         if(clickedid == Text_Draw[i])
  135.         {
  136.              if(wins[0] == 1)
  137.          {
  138.           for(new v = 0; v < 84; v++) ClickPlayer[playerid][v] = 0;
  139.           wins[0] = 0;
  140.          }
  141.              if(ClickPlayer[playerid][i] == 0)
  142.              {
  143.                   if(CloseRefresh[playerid][i] == i) return 1;//ïîâòîðíîå êëèêàíüå
  144.           СloseRefresh[playerid][i] = i;
  145.                   if(!ExplodeText) TextDrawShowForPlayer(playerid, Text_Draw[84 + 2 * i]),ExplodeText = true,ClickPlayer[playerid][i] = 1,SetPVarInt(playerid,"Sta",1); //85 = 0
  146.           else TextDrawShowForPlayer(playerid, Text_Draw[85 + 2 * i]),ExplodeText = false,ClickPlayer[playerid][i] = 2,SetPVarInt(playerid,"Sta",2);
  147.           if(Resultgame(playerid, GetPVarInt(playerid,"Sta") ) )
  148.                   {
  149.                          for(new f; f < 82; f++) ClickPlayer[playerid][f] = 1;
  150.                          return 1;
  151.                   }
  152.              }
  153.         }
  154.     }
  155.     return 1;
  156. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement