Advertisement
Simon_Italy

Memory MiniGame FS [EN]

Oct 10th, 2011
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 29.96 KB | None | 0 0
  1. /*
  2.  
  3.     Memory MiniGame FS
  4.     Simon_Italy
  5.     09/2011
  6.  
  7.     Thanks:
  8.         <zcmd>              Zeex
  9.         <TextDraw Editor>   Zamaroth
  10.  
  11. */
  12.  
  13. #include <a_samp>
  14. #define FILTERSCRIPT
  15. #include <zcmd>
  16.  
  17. #define COLOR_WHITE     0xFFFFFFFF
  18. #define COLOR_ORANGE    0xFFAF02FF
  19. #define COLOR_RED       0xFF0000FF
  20.  
  21. #define MEM_TAB         4
  22.  
  23. //------------------------------------------------------------------------------
  24.  
  25. new Text:MemoryLine[10];
  26. new Text:MemoryBox[16];
  27. new Text:MemoryExtra[5];
  28. new Text:CorrectTD;
  29. new Text:WrongTD;
  30. new Text:CompletedTD;
  31. new Text:MemoryTimer[MAX_PLAYERS];
  32.  
  33. new MemoryColor[MAX_PLAYERS][MEM_TAB][MEM_TAB char];
  34. #define MemoryColor[%0][%1][%2] MemoryColor[%0][%1]{%2}
  35. new MemoryVehicle[MAX_PLAYERS][MEM_TAB*MEM_TAB];
  36. new MemoryTime[MAX_PLAYERS];
  37.  
  38. new BestTime = 99999;
  39.  
  40. new PlayingMemory[MAX_PLAYERS char];
  41. #define PlayingMemory[%0] PlayingMemory{%0}
  42.  
  43. new PlayerX[MAX_PLAYERS];
  44. new PlayerY[MAX_PLAYERS];
  45.  
  46. new PlayerClickX[MAX_PLAYERS char];
  47. #define PlayerClicX[%0] PlayerClicX{%0}
  48. new PlayerClickY[MAX_PLAYERS char];
  49. #define PlayerClicY[%0] PlayerClicY{%0}
  50.  
  51. new KeyTimer[MAX_PLAYERS];
  52. new ScoreTimer[MAX_PLAYERS];
  53.  
  54. enum plps
  55. {
  56.     Float:PPX,
  57.     Float:PPY,
  58.     Float:PPZ,
  59.     PPInt,
  60.     PPVW
  61. }
  62. new PlayerPos[MAX_PLAYERS][plps];
  63.  
  64. new TDO[MEM_TAB][MEM_TAB] =
  65. {
  66.     {0,1,2,3},
  67.     {4,5,6,7},
  68.     {8,9,10,11},
  69.     {12,13,14,15}
  70. };
  71.  
  72. new MapCover;
  73.  
  74. forward KeyCheck(playerid);
  75. forward ScoreCheck(playerid);
  76. forward CoverMem(playerid, Text:TD1, Text:TD2);
  77.  
  78. //------------------------------------------------------------------------------
  79.  
  80. public OnFilterScriptInit()
  81. {
  82.     new a[][] =
  83.     {
  84.         "Unarmed (Fist)",
  85.         "Brass K"
  86.     };
  87.     #pragma unused a
  88.  
  89.     MemoryLine[0] = TextDrawCreate(246.000000, 111.000000, "_");
  90.     TextDrawBackgroundColor(MemoryLine[0], 255);
  91.     TextDrawFont(MemoryLine[0], 1);
  92.     TextDrawLetterSize(MemoryLine[0], 0.500000, 29.500001);
  93.     TextDrawColor(MemoryLine[0], -1);
  94.     TextDrawSetOutline(MemoryLine[0], 0);
  95.     TextDrawSetProportional(MemoryLine[0], 1);
  96.     TextDrawSetShadow(MemoryLine[0], 1);
  97.     TextDrawUseBox(MemoryLine[0], 1);
  98.     TextDrawBoxColor(MemoryLine[0], -1);
  99.     TextDrawTextSize(MemoryLine[0], 239.000000, 0.000000);
  100.  
  101.     MemoryLine[1] = TextDrawCreate(320.000000, 111.000000, "_");
  102.     TextDrawBackgroundColor(MemoryLine[1], 255);
  103.     TextDrawFont(MemoryLine[1], 1);
  104.     TextDrawLetterSize(MemoryLine[1], 0.500000, 29.500001);
  105.     TextDrawColor(MemoryLine[1], -1);
  106.     TextDrawSetOutline(MemoryLine[1], 0);
  107.     TextDrawSetProportional(MemoryLine[1], 1);
  108.     TextDrawSetShadow(MemoryLine[1], 1);
  109.     TextDrawUseBox(MemoryLine[1], 1);
  110.     TextDrawBoxColor(MemoryLine[1], -1);
  111.     TextDrawTextSize(MemoryLine[1], 313.000000, 0.000000);
  112.  
  113.     MemoryLine[2] = TextDrawCreate(384.000000, 111.000000, "_");
  114.     TextDrawBackgroundColor(MemoryLine[2], 255);
  115.     TextDrawFont(MemoryLine[2], 1);
  116.     TextDrawLetterSize(MemoryLine[2], 0.500000, 29.500001);
  117.     TextDrawColor(MemoryLine[2], -1);
  118.     TextDrawSetOutline(MemoryLine[2], 0);
  119.     TextDrawSetProportional(MemoryLine[2], 1);
  120.     TextDrawSetShadow(MemoryLine[2], 1);
  121.     TextDrawUseBox(MemoryLine[2], 1);
  122.     TextDrawBoxColor(MemoryLine[2], -1);
  123.     TextDrawTextSize(MemoryLine[2], 383.000000, 0.000000);
  124.  
  125.     MemoryLine[3] = TextDrawCreate(170.000000, 111.000000, "_");
  126.     TextDrawBackgroundColor(MemoryLine[3], 255);
  127.     TextDrawFont(MemoryLine[3], 1);
  128.     TextDrawLetterSize(MemoryLine[3], 0.500000, 29.500001);
  129.     TextDrawColor(MemoryLine[3], -1);
  130.     TextDrawSetOutline(MemoryLine[3], 0);
  131.     TextDrawSetProportional(MemoryLine[3], 1);
  132.     TextDrawSetShadow(MemoryLine[3], 1);
  133.     TextDrawUseBox(MemoryLine[3], 1);
  134.     TextDrawBoxColor(MemoryLine[3], -1);
  135.     TextDrawTextSize(MemoryLine[3], 169.000000, 0.000000);
  136.  
  137.     MemoryLine[4] = TextDrawCreate(454.000000, 111.000000, "_");
  138.     TextDrawBackgroundColor(MemoryLine[4], 255);
  139.     TextDrawFont(MemoryLine[4], 1);
  140.     TextDrawLetterSize(MemoryLine[4], 0.500000, 29.500001);
  141.     TextDrawColor(MemoryLine[4], -1);
  142.     TextDrawSetOutline(MemoryLine[4], 0);
  143.     TextDrawSetProportional(MemoryLine[4], 1);
  144.     TextDrawSetShadow(MemoryLine[4], 1);
  145.     TextDrawUseBox(MemoryLine[4], 1);
  146.     TextDrawBoxColor(MemoryLine[4], -1);
  147.     TextDrawTextSize(MemoryLine[4], 453.000000, 0.000000);
  148.  
  149.     MemoryLine[5] = TextDrawCreate(170.000000, 109.000000, "_");
  150.     TextDrawBackgroundColor(MemoryLine[5], 255);
  151.     TextDrawFont(MemoryLine[5], 1);
  152.     TextDrawLetterSize(MemoryLine[5], 1.399999, -0.199999);
  153.     TextDrawColor(MemoryLine[5], -1);
  154.     TextDrawSetOutline(MemoryLine[5], 0);
  155.     TextDrawSetProportional(MemoryLine[5], 1);
  156.     TextDrawSetShadow(MemoryLine[5], 1);
  157.     TextDrawUseBox(MemoryLine[5], 1);
  158.     TextDrawBoxColor(MemoryLine[5], -1);
  159.     TextDrawTextSize(MemoryLine[5], 453.000000, -3.000000);
  160.  
  161.     MemoryLine[6] = TextDrawCreate(170.000000, 172.000000, "_");
  162.     TextDrawBackgroundColor(MemoryLine[6], 255);
  163.     TextDrawFont(MemoryLine[6], 1);
  164.     TextDrawLetterSize(MemoryLine[6], 1.399999, -0.199999);
  165.     TextDrawColor(MemoryLine[6], -1);
  166.     TextDrawSetOutline(MemoryLine[6], 0);
  167.     TextDrawSetProportional(MemoryLine[6], 1);
  168.     TextDrawSetShadow(MemoryLine[6], 1);
  169.     TextDrawUseBox(MemoryLine[6], 1);
  170.     TextDrawBoxColor(MemoryLine[6], -1);
  171.     TextDrawTextSize(MemoryLine[6], 453.000000, -3.000000);
  172.  
  173.     MemoryLine[7] = TextDrawCreate(170.000000, 240.000000, "_");
  174.     TextDrawBackgroundColor(MemoryLine[7], 255);
  175.     TextDrawFont(MemoryLine[7], 1);
  176.     TextDrawLetterSize(MemoryLine[7], 1.399999, -0.199999);
  177.     TextDrawColor(MemoryLine[7], -1);
  178.     TextDrawSetOutline(MemoryLine[7], 0);
  179.     TextDrawSetProportional(MemoryLine[7], 1);
  180.     TextDrawSetShadow(MemoryLine[7], 1);
  181.     TextDrawUseBox(MemoryLine[7], 1);
  182.     TextDrawBoxColor(MemoryLine[7], -1);
  183.     TextDrawTextSize(MemoryLine[7], 453.000000, -3.000000);
  184.  
  185.     MemoryLine[8] = TextDrawCreate(170.000000, 310.000000, "_");
  186.     TextDrawBackgroundColor(MemoryLine[8], 255);
  187.     TextDrawFont(MemoryLine[8], 1);
  188.     TextDrawLetterSize(MemoryLine[8], 1.399999, -0.199999);
  189.     TextDrawColor(MemoryLine[8], -1);
  190.     TextDrawSetOutline(MemoryLine[8], 0);
  191.     TextDrawSetProportional(MemoryLine[8], 1);
  192.     TextDrawSetShadow(MemoryLine[8], 1);
  193.     TextDrawUseBox(MemoryLine[8], 1);
  194.     TextDrawBoxColor(MemoryLine[8], -1);
  195.     TextDrawTextSize(MemoryLine[8], 453.000000, -3.000000);
  196.  
  197.     MemoryLine[9] = TextDrawCreate(170.000000, 380.000000, "_");
  198.     TextDrawBackgroundColor(MemoryLine[9], 255);
  199.     TextDrawFont(MemoryLine[9], 1);
  200.     TextDrawLetterSize(MemoryLine[9], 1.399999, -0.199999);
  201.     TextDrawColor(MemoryLine[9], -1);
  202.     TextDrawSetOutline(MemoryLine[9], 0);
  203.     TextDrawSetProportional(MemoryLine[9], 1);
  204.     TextDrawSetShadow(MemoryLine[9], 1);
  205.     TextDrawUseBox(MemoryLine[9], 1);
  206.     TextDrawBoxColor(MemoryLine[9], -1);
  207.     TextDrawTextSize(MemoryLine[9], 453.000000, -3.000000);
  208.  
  209.     MemoryBox[0] = TextDrawCreate(173.000000, 112.000000, "_");//1
  210.     TextDrawBackgroundColor(MemoryBox[0], 255);
  211.     TextDrawFont(MemoryBox[0], 0);
  212.     TextDrawLetterSize(MemoryBox[0], 0.500000, 6.199998);
  213.     TextDrawColor(MemoryBox[0], 255);
  214.     TextDrawSetOutline(MemoryBox[0], 0);
  215.     TextDrawSetProportional(MemoryBox[0], 1);
  216.     TextDrawSetShadow(MemoryBox[0], 0);
  217.     TextDrawUseBox(MemoryBox[0], 1);
  218.     TextDrawBoxColor(MemoryBox[0], 255);
  219.     TextDrawTextSize(MemoryBox[0], 239.000000, 0.000000);
  220.  
  221.     MemoryBox[1] = TextDrawCreate(246.000000, 112.000000, "_");//2
  222.     TextDrawBackgroundColor(MemoryBox[1], 255);
  223.     TextDrawFont(MemoryBox[1], 0);
  224.     TextDrawLetterSize(MemoryBox[1], 0.500000, 6.199998);
  225.     TextDrawColor(MemoryBox[1], 255);
  226.     TextDrawSetOutline(MemoryBox[1], 0);
  227.     TextDrawSetProportional(MemoryBox[1], 1);
  228.     TextDrawSetShadow(MemoryBox[1], 0);
  229.     TextDrawUseBox(MemoryBox[1], 1);
  230.     TextDrawBoxColor(MemoryBox[1], 255);
  231.     TextDrawTextSize(MemoryBox[1], 313.000000, 0.000000);
  232.  
  233.     MemoryBox[2] = TextDrawCreate(320.000000, 112.000000, "_");//3
  234.     TextDrawBackgroundColor(MemoryBox[2], 255);
  235.     TextDrawFont(MemoryBox[2], 0);
  236.     TextDrawLetterSize(MemoryBox[2], 0.500000, 6.199998);
  237.     TextDrawColor(MemoryBox[2], 255);
  238.     TextDrawSetOutline(MemoryBox[2], 0);
  239.     TextDrawSetProportional(MemoryBox[2], 1);
  240.     TextDrawSetShadow(MemoryBox[2], 0);
  241.     TextDrawUseBox(MemoryBox[2], 1);
  242.     TextDrawBoxColor(MemoryBox[2], 255);
  243.     TextDrawTextSize(MemoryBox[2], 379.000000, 0.000000);
  244.  
  245.     MemoryBox[3] = TextDrawCreate(387.000000, 112.000000, "_");//4
  246.     TextDrawBackgroundColor(MemoryBox[3], 255);
  247.     TextDrawFont(MemoryBox[3], 0);
  248.     TextDrawLetterSize(MemoryBox[3], 0.500000, 6.199998);
  249.     TextDrawColor(MemoryBox[3], 255);
  250.     TextDrawSetOutline(MemoryBox[3], 0);
  251.     TextDrawSetProportional(MemoryBox[3], 1);
  252.     TextDrawSetShadow(MemoryBox[3], 0);
  253.     TextDrawUseBox(MemoryBox[3], 1);
  254.     TextDrawBoxColor(MemoryBox[3], 255);
  255.     TextDrawTextSize(MemoryBox[3], 450.000000, 0.000000);
  256.  
  257.     MemoryBox[4] = TextDrawCreate(173.000000, 175.000000, "_");//5
  258.     TextDrawBackgroundColor(MemoryBox[4], 255);
  259.     TextDrawFont(MemoryBox[4], 0);
  260.     TextDrawLetterSize(MemoryBox[4], 0.500000, 6.699998);
  261.     TextDrawColor(MemoryBox[4], 255);
  262.     TextDrawSetOutline(MemoryBox[4], 0);
  263.     TextDrawSetProportional(MemoryBox[4], 1);
  264.     TextDrawSetShadow(MemoryBox[4], 0);
  265.     TextDrawUseBox(MemoryBox[4], 1);
  266.     TextDrawBoxColor(MemoryBox[4], 255);
  267.     TextDrawTextSize(MemoryBox[4], 239.000000, 0.000000);
  268.  
  269.     MemoryBox[5] = TextDrawCreate(246.000000, 175.000000, "_");//6
  270.     TextDrawBackgroundColor(MemoryBox[5], 255);
  271.     TextDrawFont(MemoryBox[5], 0);
  272.     TextDrawLetterSize(MemoryBox[5], 0.500000, 6.699998);
  273.     TextDrawColor(MemoryBox[5], 255);
  274.     TextDrawSetOutline(MemoryBox[5], 0);
  275.     TextDrawSetProportional(MemoryBox[5], 1);
  276.     TextDrawSetShadow(MemoryBox[5], 0);
  277.     TextDrawUseBox(MemoryBox[5], 1);
  278.     TextDrawBoxColor(MemoryBox[5], 255);
  279.     TextDrawTextSize(MemoryBox[5], 313.000000, 0.000000);
  280.  
  281.     MemoryBox[6] = TextDrawCreate(321.000000, 175.000000, "_");//7
  282.     TextDrawBackgroundColor(MemoryBox[6], 255);
  283.     TextDrawFont(MemoryBox[6], 0);
  284.     TextDrawLetterSize(MemoryBox[6], 0.500000, 6.699997);
  285.     TextDrawColor(MemoryBox[6], 255);
  286.     TextDrawSetOutline(MemoryBox[6], 0);
  287.     TextDrawSetProportional(MemoryBox[6], 1);
  288.     TextDrawSetShadow(MemoryBox[6], 0);
  289.     TextDrawUseBox(MemoryBox[6], 1);
  290.     TextDrawBoxColor(MemoryBox[6], 255);
  291.     TextDrawTextSize(MemoryBox[6], 379.000000, 0.000000);
  292.  
  293.     MemoryBox[7] = TextDrawCreate(387.000000, 175.000000, "_");//8
  294.     TextDrawBackgroundColor(MemoryBox[7], 255);
  295.     TextDrawFont(MemoryBox[7], 0);
  296.     TextDrawLetterSize(MemoryBox[7], 0.500000, 6.699997);
  297.     TextDrawColor(MemoryBox[7], 255);
  298.     TextDrawSetOutline(MemoryBox[7], 0);
  299.     TextDrawSetProportional(MemoryBox[7], 1);
  300.     TextDrawSetShadow(MemoryBox[7], 0);
  301.     TextDrawUseBox(MemoryBox[7], 1);
  302.     TextDrawBoxColor(MemoryBox[7], 255);
  303.     TextDrawTextSize(MemoryBox[7], 450.000000, 1.000000);
  304.  
  305.     MemoryBox[8] = TextDrawCreate(173.000000, 243.000000, "_");//9
  306.     TextDrawBackgroundColor(MemoryBox[8], 255);
  307.     TextDrawFont(MemoryBox[8], 0);
  308.     TextDrawLetterSize(MemoryBox[8], 0.500000, 6.899998);
  309.     TextDrawColor(MemoryBox[8], 255);
  310.     TextDrawSetOutline(MemoryBox[8], 0);
  311.     TextDrawSetProportional(MemoryBox[8], 1);
  312.     TextDrawSetShadow(MemoryBox[8], 0);
  313.     TextDrawUseBox(MemoryBox[8], 1);
  314.     TextDrawBoxColor(MemoryBox[8], 255);
  315.     TextDrawTextSize(MemoryBox[8], 239.000000, 1.000000);
  316.  
  317.     MemoryBox[9] = TextDrawCreate(246.000000, 243.000000, "_");//10
  318.     TextDrawBackgroundColor(MemoryBox[9], 255);
  319.     TextDrawFont(MemoryBox[9], 0);
  320.     TextDrawLetterSize(MemoryBox[9], 0.500000, 6.899998);
  321.     TextDrawColor(MemoryBox[9], 255);
  322.     TextDrawSetOutline(MemoryBox[9], 0);
  323.     TextDrawSetProportional(MemoryBox[9], 1);
  324.     TextDrawSetShadow(MemoryBox[9], 0);
  325.     TextDrawUseBox(MemoryBox[9], 1);
  326.     TextDrawBoxColor(MemoryBox[9], 255);
  327.     TextDrawTextSize(MemoryBox[9], 313.000000, 1.000000);
  328.  
  329.     MemoryBox[10] = TextDrawCreate(321.000000, 243.000000, "_");//11
  330.     TextDrawBackgroundColor(MemoryBox[10], 255);
  331.     TextDrawFont(MemoryBox[10], 0);
  332.     TextDrawLetterSize(MemoryBox[10], 0.500000, 6.899998);
  333.     TextDrawColor(MemoryBox[10], 255);
  334.     TextDrawSetOutline(MemoryBox[10], 0);
  335.     TextDrawSetProportional(MemoryBox[10], 1);
  336.     TextDrawSetShadow(MemoryBox[10], 0);
  337.     TextDrawUseBox(MemoryBox[10], 1);
  338.     TextDrawBoxColor(MemoryBox[10], 255);
  339.     TextDrawTextSize(MemoryBox[10], 380.000000, 1.000000);
  340.  
  341.     MemoryBox[11] = TextDrawCreate(387.000000, 243.000000, "_");//12
  342.     TextDrawBackgroundColor(MemoryBox[11], 255);
  343.     TextDrawFont(MemoryBox[11], 0);
  344.     TextDrawLetterSize(MemoryBox[11], 0.500000, 6.899998);
  345.     TextDrawColor(MemoryBox[11], 255);
  346.     TextDrawSetOutline(MemoryBox[11], 0);
  347.     TextDrawSetProportional(MemoryBox[11], 1);
  348.     TextDrawSetShadow(MemoryBox[11], 0);
  349.     TextDrawUseBox(MemoryBox[11], 1);
  350.     TextDrawBoxColor(MemoryBox[11], 255);
  351.     TextDrawTextSize(MemoryBox[11], 450.000000, 1.000000);
  352.  
  353.     MemoryBox[12] = TextDrawCreate(174.000000, 313.000000, "_");//13
  354.     TextDrawBackgroundColor(MemoryBox[12], 255);
  355.     TextDrawFont(MemoryBox[12], 0);
  356.     TextDrawLetterSize(MemoryBox[12], 0.509998, 6.999998);
  357.     TextDrawColor(MemoryBox[12], 255);
  358.     TextDrawSetOutline(MemoryBox[12], 0);
  359.     TextDrawSetProportional(MemoryBox[12], 1);
  360.     TextDrawSetShadow(MemoryBox[12], 0);
  361.     TextDrawUseBox(MemoryBox[12], 1);
  362.     TextDrawBoxColor(MemoryBox[12], 255);
  363.     TextDrawTextSize(MemoryBox[12], 239.000000, 1.000000);
  364.  
  365.     MemoryBox[13] = TextDrawCreate(246.000000, 313.000000, "_");//14
  366.     TextDrawBackgroundColor(MemoryBox[13], 255);
  367.     TextDrawFont(MemoryBox[13], 0);
  368.     TextDrawLetterSize(MemoryBox[13], 0.509998, 6.999998);
  369.     TextDrawColor(MemoryBox[13], 255);
  370.     TextDrawSetOutline(MemoryBox[13], 0);
  371.     TextDrawSetProportional(MemoryBox[13], 1);
  372.     TextDrawSetShadow(MemoryBox[13], 0);
  373.     TextDrawUseBox(MemoryBox[13], 1);
  374.     TextDrawBoxColor(MemoryBox[13], 255);
  375.     TextDrawTextSize(MemoryBox[13], 313.000000, 1.000000);
  376.  
  377.     MemoryBox[14] = TextDrawCreate(320.000000, 313.000000, "_");//15
  378.     TextDrawBackgroundColor(MemoryBox[14], 255);
  379.     TextDrawFont(MemoryBox[14], 0);
  380.     TextDrawLetterSize(MemoryBox[14], 0.509998, 6.999998);
  381.     TextDrawColor(MemoryBox[14], 255);
  382.     TextDrawSetOutline(MemoryBox[14], 0);
  383.     TextDrawSetProportional(MemoryBox[14], 1);
  384.     TextDrawSetShadow(MemoryBox[14], 0);
  385.     TextDrawUseBox(MemoryBox[14], 1);
  386.     TextDrawBoxColor(MemoryBox[14], 255);
  387.     TextDrawTextSize(MemoryBox[14], 380.000000, 1.000000);
  388.  
  389.     MemoryBox[15] = TextDrawCreate(387.000000, 313.000000, "_");//16
  390.     TextDrawBackgroundColor(MemoryBox[15], 255);
  391.     TextDrawFont(MemoryBox[15], 0);
  392.     TextDrawLetterSize(MemoryBox[15], 0.509998, 6.999998);
  393.     TextDrawColor(MemoryBox[15], 255);
  394.     TextDrawSetOutline(MemoryBox[15], 0);
  395.     TextDrawSetProportional(MemoryBox[15], 1);
  396.     TextDrawSetShadow(MemoryBox[15], 0);
  397.     TextDrawUseBox(MemoryBox[15], 1);
  398.     TextDrawBoxColor(MemoryBox[15], 255);
  399.     TextDrawTextSize(MemoryBox[15], 450.000000, 1.000000);
  400.  
  401.     MemoryExtra[0] = TextDrawCreate(213.000000, 69.000000, "Memory MiniGame");
  402.     TextDrawBackgroundColor(MemoryExtra[0], 255);
  403.     TextDrawFont(MemoryExtra[0], 0);
  404.     TextDrawLetterSize(MemoryExtra[0], 0.889999, 3.000000);
  405.     TextDrawColor(MemoryExtra[0], -1);
  406.     TextDrawSetOutline(MemoryExtra[0], 1);
  407.     TextDrawSetProportional(MemoryExtra[0], 1);
  408.  
  409.     MemoryExtra[1] = TextDrawCreate(509.000000, 130.000000, "_____");
  410.     TextDrawBackgroundColor(MemoryExtra[1], 255);
  411.     TextDrawFont(MemoryExtra[1], 1);
  412.     TextDrawLetterSize(MemoryExtra[1], 0.500000, 3.000000);
  413.     TextDrawColor(MemoryExtra[1], -1);
  414.     TextDrawSetOutline(MemoryExtra[1], 1);
  415.     TextDrawSetProportional(MemoryExtra[1], 1);
  416.     TextDrawUseBox(MemoryExtra[1], 1);
  417.     TextDrawBoxColor(MemoryExtra[1], 255);
  418.     TextDrawTextSize(MemoryExtra[1], 600.000000, 0.000000);
  419.  
  420.     MemoryExtra[2] = TextDrawCreate(511.000000, 132.000000, "_____");
  421.     TextDrawBackgroundColor(MemoryExtra[2], 255);
  422.     TextDrawFont(MemoryExtra[2], 1);
  423.     TextDrawLetterSize(MemoryExtra[2], 0.500000, 2.599999);
  424.     TextDrawColor(MemoryExtra[2], -1);
  425.     TextDrawSetOutline(MemoryExtra[2], 1);
  426.     TextDrawSetProportional(MemoryExtra[2], 1);
  427.     TextDrawUseBox(MemoryExtra[2], 1);
  428.     TextDrawBoxColor(MemoryExtra[2], -1);
  429.     TextDrawTextSize(MemoryExtra[2], 598.000000, 1.000000);
  430.  
  431.     MemoryExtra[3] = TextDrawCreate(512.000000, 133.000000, "_____");
  432.     TextDrawBackgroundColor(MemoryExtra[3], 255);
  433.     TextDrawFont(MemoryExtra[3], 1);
  434.     TextDrawLetterSize(MemoryExtra[3], 0.000000, 2.400000);
  435.     TextDrawColor(MemoryExtra[3], -1);
  436.     TextDrawSetOutline(MemoryExtra[3], 1);
  437.     TextDrawSetProportional(MemoryExtra[3], 1);
  438.     TextDrawUseBox(MemoryExtra[3], 1);
  439.     TextDrawBoxColor(MemoryExtra[3], 255);
  440.     TextDrawTextSize(MemoryExtra[3], 596.000000, 1.000000);
  441.  
  442.     MemoryExtra[4] = TextDrawCreate(527.000000, 125.000000, "Time");
  443.     TextDrawBackgroundColor(MemoryExtra[4], 255);
  444.     TextDrawFont(MemoryExtra[4], 1);
  445.     TextDrawLetterSize(MemoryExtra[4], 0.500000, 1.000000);
  446.     TextDrawColor(MemoryExtra[4], -1);
  447.     TextDrawSetOutline(MemoryExtra[4], 1);
  448.     TextDrawSetProportional(MemoryExtra[4], 1);
  449.  
  450.     CorrectTD = TextDrawCreate(516.000000, 182.000000, "~g~Correct !");
  451.     TextDrawBackgroundColor(CorrectTD, 255);
  452.     TextDrawFont(CorrectTD, 1);
  453.     TextDrawLetterSize(CorrectTD, 0.600000, 2.000000);
  454.     TextDrawColor(CorrectTD, -1);
  455.     TextDrawSetOutline(CorrectTD, 1);
  456.     TextDrawSetProportional(CorrectTD, 1);
  457.  
  458.     WrongTD = TextDrawCreate(516.000000, 182.000000, "~r~Wrong !");
  459.     TextDrawBackgroundColor(WrongTD, 255);
  460.     TextDrawFont(WrongTD, 1);
  461.     TextDrawLetterSize(WrongTD, 0.600000, 2.000000);
  462.     TextDrawColor(WrongTD, -1);
  463.     TextDrawSetOutline(WrongTD, 1);
  464.     TextDrawSetProportional(WrongTD, 1);
  465.  
  466.     CompletedTD = TextDrawCreate(500.000000, 182.000000, "~y~Completed !");
  467.     TextDrawBackgroundColor(CompletedTD, 255);
  468.     TextDrawFont(CompletedTD, 1);
  469.     TextDrawLetterSize(CompletedTD, 0.600000, 2.000000);
  470.     TextDrawColor(CompletedTD, -1);
  471.     TextDrawSetOutline(CompletedTD, 1);
  472.     TextDrawSetProportional(CompletedTD, 1);
  473.  
  474.     for(new i, j = GetMaxPlayers(); i < j; i++)
  475.     {
  476.         MemoryTimer[i] = TextDrawCreate(518.000000, 139.000000, "00 : 00");
  477.         TextDrawBackgroundColor(MemoryTimer[i], 255);
  478.         TextDrawFont(MemoryTimer[i], 0);
  479.         TextDrawLetterSize(MemoryTimer[i], 0.500000, 1.000000);
  480.         TextDrawColor(MemoryTimer[i], -1);
  481.         TextDrawSetOutline(MemoryTimer[i], 1);
  482.         TextDrawSetProportional(MemoryTimer[i], 1);
  483.     }
  484.  
  485.     MapCover = GangZoneCreate(-3000, -3000, 3000, 3000);
  486.  
  487.     new string[5];
  488.     new File: file = fopen("memory_best.log", io_read);
  489.     if (file)
  490.     {
  491.         fread(file, string);
  492.         BestTime = strval(string);
  493.     }
  494.  
  495.     SendClientMessageToAll(COLOR_ORANGE, "• Memory MiniGame FS loaded, part of it by typing /memory");
  496.     print("\n¤ Memory MiniGame FS successfully loaded !\n");
  497.     return 1;
  498. }
  499.  
  500. //------------------------------------------------------------------------------
  501.  
  502. public OnFilterScriptExit()
  503. {
  504.     new i;
  505.     for(new j = GetMaxPlayers(); i < j; i++)
  506.     {
  507.         if(PlayingMemory[i])
  508.         {
  509.             MemoryEndForPlayer(i);
  510.             TextDrawDestroy(MemoryTimer[i]);
  511.             KillTimer(ScoreTimer[i]);
  512.         }
  513.     }
  514.     for(i=0; i<5; i++)
  515.     {
  516.         TextDrawDestroy(MemoryLine[i]);
  517.         TextDrawDestroy(MemoryBox[i]);
  518.         TextDrawDestroy(MemoryExtra[i]);
  519.     }
  520.     for(; i<10; i++)
  521.     {
  522.         TextDrawDestroy(MemoryLine[i]);
  523.         TextDrawDestroy(MemoryBox[i]);
  524.     }
  525.     for(; i<16; i++)
  526.     {
  527.         TextDrawDestroy(MemoryBox[i]);
  528.     }
  529.     TextDrawDestroy(CorrectTD);
  530.     TextDrawDestroy(WrongTD);
  531.     TextDrawDestroy(CompletedTD);
  532.     GangZoneDestroy(MapCover);
  533.  
  534.     new string[5];
  535.     format(string, sizeof(string), "%d", BestTime);
  536.     new File: file = fopen("memory_best.log", io_write);
  537.     fwrite(file, string);
  538.     fclose(file);
  539.  
  540.     SendClientMessageToAll(COLOR_ORANGE, "• You can no longer use the Memory MiniGame FS, thanks for participating !");
  541.     print("\n¤ Memory MiniGame FS successfully unloaded !\n");
  542.     return 1;
  543. }
  544.  
  545. //------------------------------------------------------------------------------
  546.  
  547. public OnPlayerDisconnect(playerid, reason)
  548. {
  549.     if(PlayingMemory[playerid])
  550.     {
  551.         cmd_memory(playerid, "");
  552.     }
  553. }
  554.  
  555. //------------------------------------------------------------------------------
  556.  
  557. COMMAND:memory(playerid, params[])
  558. {
  559.     new string[128], i, j, k;
  560.     if(PlayingMemory[playerid])
  561.     {
  562.         GetPlayerName(playerid, string, 128);
  563.         for(; i<10; i++) SendClientMessage(playerid, 0, " ");
  564.         if(PlayingMemory[playerid] == 2)
  565.         {
  566.             if(MemoryTime[playerid] < BestTime)
  567.             {
  568.                 BestTime = MemoryTime[playerid];
  569.                 format(string, 128, "%s obtained the best result at the {FFAF02}Memory MiniGame{FFFFFF} with a time of {FF0000}%d minutes e %d seconds !", string, MemoryTime[playerid]/60, MemoryTime[playerid] - (60*(MemoryTime[playerid]/60)));
  570.             }
  571.             else format(string, 128, "%s has completed the {FFAF02}Memory MiniGame{FFFFFF} with a time of %d minutes e %d seconds", string, MemoryTime[playerid]/60, MemoryTime[playerid] - (60*(MemoryTime[playerid]/60)));
  572.         }
  573.         else
  574.         {
  575.             format(string, 128, "%s has stopped playing the {FFAF02}Memory MiniGame", string);
  576.             KillTimer(ScoreTimer[playerid]);
  577.         }
  578.         SendClientMessageToAll(COLOR_WHITE, string);
  579.  
  580.         for(i=0; i<5; i++)
  581.         {
  582.             TextDrawHideForPlayer(playerid, MemoryLine[i]);
  583.             TextDrawHideForPlayer(playerid, MemoryBox[i]);
  584.             TextDrawHideForPlayer(playerid, MemoryExtra[i]);
  585.         }
  586.         for(; i<10; i++)
  587.         {
  588.             TextDrawHideForPlayer(playerid, MemoryLine[i]);
  589.             TextDrawHideForPlayer(playerid, MemoryBox[i]);
  590.         }
  591.         for(; i<16; i++)
  592.         {
  593.             TextDrawHideForPlayer(playerid, MemoryBox[i]);
  594.         }
  595.         TextDrawHideForPlayer(playerid, MemoryTimer[playerid]);
  596.         TextDrawHideForPlayer(playerid, CorrectTD);
  597.         TextDrawHideForPlayer(playerid, WrongTD);
  598.         TextDrawHideForPlayer(playerid, CompletedTD);
  599.         for(j = 0; j < MEM_TAB; j++)
  600.         {
  601.             for(k = 0; k < MEM_TAB; k++)
  602.             {
  603.                 MemoryColor[playerid][j][k] = 0;
  604.             }
  605.         }
  606.         PlayingMemory[playerid] = 0;
  607.         GangZoneHideForPlayer(playerid, MapCover);
  608.         MemoryEndForPlayer(playerid);
  609.     }
  610.     else
  611.     {
  612.         PlayingMemory[playerid] = 1;
  613.         MemoryTime[playerid] = 0;
  614.         GetPlayerName(playerid, string, 128);
  615.         for(; i<10; i++) SendClientMessage(playerid, 0, " ");
  616.         format(string, 128, "%s started playing the {FFAF02}Memory MiniGame", string);
  617.         SendClientMessageToAll(COLOR_WHITE, string);
  618.  
  619.         PlayerPos[playerid][PPInt] = GetPlayerInterior(playerid);
  620.         PlayerPos[playerid][PPVW] = GetPlayerVirtualWorld(playerid);
  621.         GetPlayerPos(playerid, PlayerPos[playerid][PPX], PlayerPos[playerid][PPY], PlayerPos[playerid][PPZ]);
  622.  
  623.         SetPlayerVirtualWorld(playerid, playerid);
  624.         SetPlayerPos(playerid, 1947.6558,-2404.1008,13.5469);
  625.  
  626.         TogglePlayerControllable(playerid, 0);
  627.  
  628.         SetPlayerCameraPos(playerid,1939.224,-2405.605,30.239);
  629.         SetPlayerCameraLookAt(playerid,1939.260,-2401.041,-1.453);
  630.  
  631.         PlayerClickX[playerid] = PlayerClickY[playerid] = MEM_TAB;
  632.         PlayerX[playerid] = PlayerX[playerid] = 0;
  633.  
  634.         KeyTimer[playerid] = SetTimerEx("KeyCheck", 150, 1, "i", playerid);
  635.         ScoreTimer[playerid] = SetTimerEx("ScoreCheck", 1000, 1, "i", playerid);
  636.  
  637.         GangZoneShowForPlayer(playerid, MapCover, 0x000000FF);
  638.  
  639.         for(i=0; i<5; i++)
  640.         {
  641.             TextDrawShowForPlayer(playerid, MemoryLine[i]);
  642.             TextDrawShowForPlayer(playerid, MemoryBox[i]);
  643.             TextDrawShowForPlayer(playerid, MemoryExtra[i]);
  644.         }
  645.         for(; i<10; i++)
  646.         {
  647.             TextDrawShowForPlayer(playerid, MemoryLine[i]);
  648.             TextDrawShowForPlayer(playerid, MemoryBox[i]);
  649.         }
  650.         for(; i<16; i++)
  651.         {
  652.             TextDrawShowForPlayer(playerid, MemoryBox[i]);
  653.         }
  654.         TextDrawShowForPlayer(playerid, MemoryTimer[playerid]);
  655.  
  656.         new C1_ranx, C1_rany, C2_ranx, C2_rany, check, full, col,
  657.             Colors[8] = {1,2,3,5,6,16,40,77};
  658.  
  659.         do
  660.         {
  661.             do
  662.             {
  663.                 C1_ranx = random(MEM_TAB);
  664.                 C1_rany = random(MEM_TAB);
  665.                 if(MemoryColor[playerid][C1_ranx][C1_rany] == 0)
  666.                 {
  667.                     MemoryColor[playerid][C1_ranx][C1_rany] = Colors[col];
  668.                     do
  669.                     {
  670.                         C2_ranx = random(MEM_TAB);
  671.                         C2_rany = random(MEM_TAB);
  672.                         if(MemoryColor[playerid][C2_ranx][C2_rany] == 0)
  673.                         {
  674.                             MemoryColor[playerid][C2_ranx][C2_rany] = Colors[col];
  675.                             col++;
  676.  
  677.                             check = 1;
  678.                         }
  679.                     }
  680.                     while(!check);
  681.                 }
  682.             }
  683.             while(!check);
  684.  
  685.             check = 0;
  686.             full = 0;
  687.  
  688.             /*for(j = 0; j < MEM_TAB; j++)
  689.             {
  690.                 printf("%d|%d|%d|%d",
  691.                 MemoryColor[playerid][j][0],
  692.                 MemoryColor[playerid][j][1],
  693.                 MemoryColor[playerid][j][2],
  694.                 MemoryColor[playerid][j][3]);
  695.                 print ("-------");
  696.             }*/
  697.  
  698.             for(j = 0; j < MEM_TAB; j++)
  699.             {
  700.                 for(k = 0; k < MEM_TAB; k++)
  701.                 {
  702.                     if(MemoryColor[playerid][j][k] == 0) full = 1;
  703.                 }
  704.             }
  705.         }
  706.         while(full);
  707.  
  708.         for(j = 0; j < MEM_TAB; j++)
  709.         {
  710.             for(k = 0; k < MEM_TAB; k++)
  711.             {
  712.                 MemoryVehicle[playerid][check] = CreateVehicle(471, 1934.917+(2.7*k), -2399.522-(2.8*j), 13.024,0, MemoryColor[playerid][j][k], MemoryColor[playerid][j][k], 30000);
  713.                 SetVehicleVirtualWorld(MemoryVehicle[playerid][check], playerid);
  714.                 check++;
  715.             }
  716.         }
  717.     }
  718.     return 1;
  719. }
  720.  
  721. //------------------------------------------------------------------------------
  722.  
  723. stock MemoryEndForPlayer(playerid)
  724. {
  725.     KillTimer(KeyTimer[playerid]);
  726.     SetCameraBehindPlayer(playerid);
  727.     SetPlayerInterior(playerid, PlayerPos[playerid][PPInt]);
  728.     SetPlayerVirtualWorld(playerid, PlayerPos[playerid][PPVW]);
  729.     SetPlayerPos(playerid, PlayerPos[playerid][PPX], PlayerPos[playerid][PPY], PlayerPos[playerid][PPZ]);
  730.     TogglePlayerControllable(playerid, 1);
  731.     for(new j; j<MEM_TAB*MEM_TAB; j++) DestroyVehicle(MemoryVehicle[playerid][j]);
  732. }
  733.  
  734. //------------------------------------------------------------------------------
  735.  
  736. public KeyCheck(playerid)
  737. {
  738.     new keys, updown, leftright;
  739.     new i, j;
  740.     GetPlayerKeys(playerid, keys, updown, leftright);
  741.  
  742.     if(keys & KEY_FIRE)
  743.     {
  744.         if(MemoryColor[playerid][PlayerX[playerid]][PlayerY[playerid]] != 0)
  745.         {
  746.             if(PlayerClickX[playerid] == MEM_TAB && PlayerClickX[playerid] == MEM_TAB)
  747.             {
  748.                 TextDrawHideForPlayer(playerid, MemoryBox[ TDO[ PlayerX[playerid] ] [ PlayerY[playerid] ] ]);
  749.                 PlayerClickX[playerid] = PlayerX[playerid];
  750.                 PlayerClickY[playerid] = PlayerY[playerid];
  751.                 TextDrawHideForPlayer(playerid, CorrectTD);
  752.                 TextDrawHideForPlayer(playerid, WrongTD);
  753.             }
  754.             else if(PlayerClickX[playerid] != PlayerX[playerid] || PlayerClickY[playerid] != PlayerY[playerid])
  755.             {
  756.                 if(MemoryColor[playerid][PlayerClickX[playerid]][PlayerClickY[playerid]] == MemoryColor[playerid][PlayerX[playerid]][PlayerY[playerid]])
  757.                 {
  758.                     TextDrawHideForPlayer(playerid, MemoryBox[ TDO[ PlayerX[playerid] ] [ PlayerY[playerid] ] ]);
  759.                     TextDrawHideForPlayer(playerid, MemoryBox[ TDO[ PlayerClickX[playerid] ] [ PlayerClickY[playerid] ] ]);
  760.  
  761.                     TextDrawShowForPlayer(playerid, CorrectTD);
  762.  
  763.                     MemoryColor[playerid][PlayerX[playerid]][PlayerY[playerid]] = 0;
  764.                     MemoryColor[playerid][PlayerClickX[playerid]][PlayerClickY[playerid]] = 0;
  765.                     PlayerClickX[playerid] = PlayerClickY[playerid] = MEM_TAB;
  766.                     new flag;
  767.                     for(; i < MEM_TAB; i++)
  768.                     {
  769.                         for(j = 0; j < MEM_TAB; j++)
  770.                         {
  771.                             if(MemoryColor[playerid][i][j] != 0) flag = 1;
  772.                         }
  773.                     }
  774.                     if(!flag)
  775.                     {
  776.                         TextDrawHideForPlayer(playerid, CorrectTD);
  777.                         TextDrawHideForPlayer(playerid, WrongTD);
  778.                         TextDrawShowForPlayer(playerid, CompletedTD);
  779.                         PlayingMemory[playerid] = 2;
  780.                         KillTimer(ScoreTimer[playerid]);
  781.                         SetTimerEx("cmd_memory", 3500, 0, "is", playerid, " ");
  782.                     }
  783.                 }
  784.                 else
  785.                 {
  786.                     TextDrawShowForPlayer(playerid, WrongTD);
  787.  
  788.                     TextDrawHideForPlayer(playerid, MemoryBox[ TDO[ PlayerX[playerid] ] [ PlayerY[playerid] ] ]);
  789.                     SetTimerEx("CoverMem", 1000, 0, "iii", playerid, _:MemoryBox[ TDO[ PlayerX[playerid] ] [ PlayerY[playerid] ] ], _:MemoryBox[ TDO[ PlayerClickX[playerid] ] [ PlayerClickY[playerid] ] ]);
  790.                     PlayerClickX[playerid] = PlayerClickY[playerid] = MEM_TAB;
  791.                 }
  792.             }
  793.         }
  794.     }
  795.     else if(updown != 0 || leftright != 0)
  796.     {
  797.         for(; i < MEM_TAB; i++)
  798.         {
  799.             for(j = 0; j < MEM_TAB; j++)
  800.             {
  801.                 if(MemoryColor[playerid][i][j] != 0)
  802.                 {
  803.                     TextDrawHideForPlayer(playerid, MemoryBox[TDO[i][j]]);
  804.                     TextDrawUseBox(MemoryBox[TDO[i][j]], 1);
  805.                     TextDrawBoxColor(MemoryBox[TDO[i][j]], 255);
  806.                     TextDrawShowForPlayer(playerid, MemoryBox[TDO[i][j]]);
  807.                 }
  808.                 else TextDrawHideForPlayer(playerid, MemoryBox[TDO[i][j]]);
  809.             }
  810.         }
  811.  
  812.         if(PlayerClickX[playerid] != MEM_TAB) TextDrawHideForPlayer(playerid, MemoryBox[TDO[PlayerClickX[playerid]][PlayerClickY[playerid]]]);
  813.  
  814.         if(leftright == KEY_RIGHT)
  815.         {
  816.             PlayerY[playerid]++;
  817.         }
  818.         else if(leftright == KEY_LEFT)
  819.         {
  820.             PlayerY[playerid]--;
  821.         }
  822.         else if(updown == KEY_UP)
  823.         {
  824.             PlayerX[playerid]--;
  825.         }
  826.         else if(updown == KEY_DOWN)
  827.         {
  828.             PlayerX[playerid]++;
  829.         }
  830.  
  831.         if(PlayerX[playerid] < 0) PlayerX[playerid] = MEM_TAB-1;
  832.         else if(PlayerX[playerid] == MEM_TAB) PlayerX[playerid] = 0;
  833.  
  834.         if(PlayerY[playerid] < 0) PlayerY[playerid] = MEM_TAB-1;
  835.         else if(PlayerY[playerid] == MEM_TAB) PlayerY[playerid] = 0;
  836.  
  837.         TextDrawHideForPlayer(playerid, MemoryBox[TDO[PlayerX[playerid]][PlayerY[playerid]]]);
  838.         TextDrawUseBox(MemoryBox[TDO[PlayerX[playerid]][PlayerY[playerid]]], 1);
  839.         TextDrawBoxColor(MemoryBox[TDO[PlayerX[playerid]][PlayerY[playerid]]], COLOR_WHITE);
  840.         TextDrawShowForPlayer(playerid, MemoryBox[TDO[PlayerX[playerid]][PlayerY[playerid]]]);
  841.  
  842.         //new string[64];
  843.         //format(string, 64, "TDO: %d || X-Y: %d-%d || OX-OY: %d-%d", TDO[PlayerX[playerid]][PlayerY[playerid]], PlayerX[playerid], PlayerY[playerid], PlayerClickX[playerid], PlayerClickY[playerid]);
  844.         //SendClientMessage(playerid, COLOR_WHITE, string);
  845.     }
  846. }
  847.  
  848. //------------------------------------------------------------------------------
  849.  
  850. public ScoreCheck(playerid)
  851. {
  852.     new string[32];
  853.     format(string, 32, "00 : %02d", MemoryTime[playerid]);
  854.     if(MemoryTime[playerid] > 59) format(string, 32, "%02d : %02d", MemoryTime[playerid]/60, MemoryTime[playerid] - (60*(MemoryTime[playerid]/60)));
  855.     TextDrawSetString(MemoryTimer[playerid], string);
  856.     MemoryTime[playerid]++;
  857. }
  858.  
  859. //------------------------------------------------------------------------------
  860.  
  861. public CoverMem(playerid, Text:TD1, Text:TD2)
  862. {
  863.     TextDrawShowForPlayer(playerid, TD1), TextDrawShowForPlayer(playerid, TD2);
  864. }
  865.  
  866. //------------------------------------------------------------------------------
  867.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement