Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include a_samp
- #define MAX_PLAYERS 10
- new Text:Text_Draw[249]; //ñîçäàíûå ÒÄ
- new bool:ExplodeText;
- new ClickPlayer[ MAX_PLAYERS ][ 84 ],CloseRefresh[ MAX_PLAYERS ][ 84 ];
- new wins[ 3 ];
- new tts[ 40 ];
- new str[ 128 ];
- new Winxod[ 82 ][ 3 ] = {
- //----ïðîñòûå ðåøåíèÿ
- {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},
- {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},
- {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},
- //----òÿæåëûå ðåøåíèÿ
- {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},
- {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},
- {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},
- {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},
- {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},
- {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
- {2,11,20}
- };
- public OnFilterScriptInit()
- {
- new count = 0;
- Text_Draw[0] = TextDrawCreate(480.000000, 120.000000, "fon");
- TextDrawLetterSize(Text_Draw[0], 50.880000, 35.899999);
- TextDrawUseBox(Text_Draw[0], 1);
- TextDrawBoxColor(Text_Draw[0], 842282239);
- TextDrawTextSize(Text_Draw[0], 197.000000, 0.000000);
- count = 1;
- for(new r = 0; r < 9; r++)
- {
- for(new f = 0; f < 9; f++)
- {
- Text_Draw[count] = TextDrawCreate(211.0 + f * 28.3, 141.0 + r * 32.3, "LD_SPAC:white");
- TextDrawBackgroundColor(Text_Draw[count], 255);
- TextDrawFont(Text_Draw[count], 4); //òåñò ïîñòàâèò 4
- TextDrawLetterSize(Text_Draw[count], 0.500000, -5.600000);
- TextDrawColor(Text_Draw[count], 253831424);
- TextDrawSetOutline(Text_Draw[count], 0);
- TextDrawUseBox(Text_Draw[count], 1);
- TextDrawBoxColor(Text_Draw[count], 0);
- TextDrawTextSize(Text_Draw[count], 28.000000, 32.000000);
- TextDrawSetPreviewModel(Text_Draw[count], 19466);
- TextDrawSetPreviewRot(Text_Draw[count], 0.000000, 0.000000, 90.000000, 0.000099);
- TextDrawSetSelectable(Text_Draw[count], 1);
- count++;
- }
- }//81
- 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");
- 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);
- TextDrawUseBox(Text_Draw[82], 1),TextDrawUseBox(Text_Draw[83], 1),TextDrawUseBox(Text_Draw[84], 1),TextDrawUseBox(Text_Draw[85], 1);
- TextDrawBoxColor(Text_Draw[82], 842282239),TextDrawBoxColor(Text_Draw[83], 842282239),TextDrawBoxColor(Text_Draw[84], 842282239),TextDrawBoxColor(Text_Draw[85], 842282239);
- 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;
- for(new r = 0; r < 9; r++)
- {
- for(new f = 0; f < 9; f++)
- {
- Text_Draw[count] = TextDrawCreate(221.0 + f * 28.0, 151.0 + r * 32.0, "X");
- Text_Draw[count + 1] = TextDrawCreate(221.0 + f * 28.0, 151.0 + r * 32.0, "0");
- for(new j = 0; j < 2; j++)
- {
- TextDrawBackgroundColor(Text_Draw[count + j], 255);
- TextDrawFont(Text_Draw[count + j], 1);
- TextDrawLetterSize(Text_Draw[count + j], 0.500000, 1.000000);
- TextDrawColor(Text_Draw[count + j], -1);
- TextDrawSetOutline(Text_Draw[count + j], 0);
- TextDrawSetProportional(Text_Draw[count + j], 1);
- TextDrawSetShadow(Text_Draw[count + j], 1);
- TextDrawSetSelectable(Text_Draw[count + j], 0);
- }
- count += 2;
- }
- }
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i; i < 249; i++) TextDrawDestroy(Text_Draw[i]);
- }
- public OnPlayerText(playerid, text[])
- {
- if(!strcmp("game", text, true))
- {
- for(new i; i < 84; i++) ClickPlayer[playerid][i] = 0;
- SelectTextDraw(playerid,-909604865);
- for(new i; i < 86; i++) TextDrawShowForPlayer(playerid, Text_Draw[i]); // îñíîâíîå
- }
- }
- stock Resultgame(playerid, number )
- {
- for(new i = 0; i < 84; i++)
- {
- new count[3] = 0; //1 крестик 2 нолик
- for(new f = 0; f < 3; f++)
- {
- if(ClickPlayer[playerid][Winxod[i][f]] == number) count[number]++,printf("%d",Winxod[i][f]);
- }
- if(count[number] == 3)
- {
- if(number == 1) tts = "Победил крестик",wins[1]++;
- else if(number == 2) tts = "Победил нолик",wins[2]++;
- wins[0] =1,count[1] = 0,count[2] = 0;
- if(wins[1] == 3 || wins[2] == 3)
- {
- format(str,sizeof(str),"Игра окончена [Крестик: %d || Нолик: %d ] ",wins[1],wins[2]);
- SendClientMessage(playerid, 0xFF0150FF, str);
- CancelSelectTextDraw(playerid);
- wins[2] =0,wins[1] =1;
- for(new g; g < 86; g++) CloseRefresh[playerid][i] = 0;
- for(new s; s < 249; s++) TextDrawHideForPlayer(playerid, Text_Draw[s]);
- return 1;
- }
- else SendClientMessage(playerid, 0xFF0150FF, tts);
- return 1;
- }
- }
- return false;
- }
- public OnPlayerClickTextDraw(playerid, Text:clickedid)
- {
- if(!(_:clickedid ^ 0xFFFF))
- {
- wins[2] =0,wins[1] =1;
- for(new s; s < 249; s++) TextDrawHideForPlayer(playerid, Text_Draw[s]);
- for(new i; i < 86; i++) CloseRefresh[playerid][i] = 0;
- }
- for(new i = 1; i < 82; i++)
- {
- if(clickedid == Text_Draw[i])
- {
- if(wins[0] == 1)
- {
- for(new v = 0; v < 84; v++) ClickPlayer[playerid][v] = 0;
- wins[0] = 0;
- }
- if(ClickPlayer[playerid][i] == 0)
- {
- if(CloseRefresh[playerid][i] == i) return 1;//ïîâòîðíîå êëèêàíüå
- СloseRefresh[playerid][i] = i;
- if(!ExplodeText) TextDrawShowForPlayer(playerid, Text_Draw[84 + 2 * i]),ExplodeText = true,ClickPlayer[playerid][i] = 1,SetPVarInt(playerid,"Sta",1); //85 = 0
- else TextDrawShowForPlayer(playerid, Text_Draw[85 + 2 * i]),ExplodeText = false,ClickPlayer[playerid][i] = 2,SetPVarInt(playerid,"Sta",2);
- if(Resultgame(playerid, GetPVarInt(playerid,"Sta") ) )
- {
- for(new f; f < 82; f++) ClickPlayer[playerid][f] = 1;
- return 1;
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement