Advertisement
Simon_Italy

Memory MiniGame FS [IT]

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