Advertisement
Simon_Italy

Rubik's Cube (incomplete)

May 27th, 2014
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 16.65 KB | None | 0 0
  1. /*
  2.     Filterscript:
  3.         Rubik's Cube (Incomplete)
  4.     Author:
  5.         Simon_Italy
  6.         forum.lifeofsf.org
  7.    
  8.     Release Date:
  9.         May 2014
  10. */
  11.  
  12. #define FILTERSCRIPT
  13.  
  14. #include <a_samp>
  15.  
  16. #define SetInvisibleTexture(%0,%1) \
  17.     SetObjectMaterial(%0, %1, 19341, "none", "none", 0x00FFFFFF)
  18.  
  19. #define SetObjectColour(%0,%1,%2) \
  20.     SetObjectMaterial(%0, %1, 18646, "matcolours", "white", %2)
  21.  
  22. //
  23.  
  24. static const Float:HEIGHT_1 = 10.0;
  25.  
  26. #define     HEIGHT_2        (HEIGHT_1 + 3.5)
  27. #define     HEIGHT_3        (HEIGHT_1 + 7.0)
  28.  
  29. #define     HEIGHT_UP       (HEIGHT_1 + 8.78)
  30. #define         HEIGHT_DOWN     (HEIGHT_1 - 1.73)
  31.  
  32. enum eRubik1
  33. {
  34.     rUp,
  35.     rFront,
  36.     rBehind,
  37.     rLeft,
  38.     rRight,
  39.     rDown
  40. };
  41.  
  42. enum eRubik2
  43. {
  44.     rOriz,
  45.     rVert,
  46.     rLate
  47. };
  48.  
  49. new stock
  50.     rubikObject[6][9],
  51.         rubikRotate[3][3],
  52.     rubikColour[6][9],
  53.     rubikRotateStep[3][3];
  54.  
  55. new selectedRow;
  56.  
  57. //
  58.  
  59. stock AttachObjectsForRotation(idx)
  60. {
  61.     switch(idx)
  62.     {
  63.         case rOriz:
  64.         {
  65.             AttachObjectToObject(rubikObject[rUp][0], rubikRotate[rOriz][2], -2.821000, 2.9, 1.729+0.001, 0, 90, 0);
  66.             AttachObjectToObject(rubikObject[rUp][1], rubikRotate[rOriz][2],  -0.081000, 2.9, 1.729, 0, 90, 0);
  67.             AttachObjectToObject(rubikObject[rUp][2], rubikRotate[rOriz][2],  2.688999, 2.9, 1.729+0.001, 0, 90, 0);
  68.             AttachObjectToObject(rubikObject[rUp][3], rubikRotate[rOriz][2], 2.688999, 0, 1.729, 0, 90, 0);
  69.             AttachObjectToObject(rubikObject[rUp][4], rubikRotate[rOriz][2],  -0.081000, 0, 1.729-0.001, 0, 90, 0);
  70.             AttachObjectToObject(rubikObject[rUp][5], rubikRotate[rOriz][2],  -2.821000, 0, 1.729, 0, 90, 0);
  71.             AttachObjectToObject(rubikObject[rUp][6], rubikRotate[rOriz][2], -2.821000, -2.9, 1.729+0.001, 0, 90, 0);
  72.             AttachObjectToObject(rubikObject[rUp][7], rubikRotate[rOriz][2],  -0.081000, -2.9, 1.729, 0, 90, 0);
  73.             AttachObjectToObject(rubikObject[rUp][8], rubikRotate[rOriz][2],  2.688999, -2.9, 1.729+0.001, 0, 90, 0);
  74.  
  75.             AttachObjectToObject(rubikObject[rDown][0], rubikRotate[rOriz][0], -2.821000, 2.9, -1.729+0.001, 0, 90, 0);
  76.             AttachObjectToObject(rubikObject[rDown][1], rubikRotate[rOriz][0],  -0.081000, 2.9, -1.729, 0, 90, 0);
  77.             AttachObjectToObject(rubikObject[rDown][2], rubikRotate[rOriz][0],  2.688999, 2.9, -1.729+0.001, 0, 90, 0);
  78.             AttachObjectToObject(rubikObject[rDown][3], rubikRotate[rOriz][0], 2.688999, 0, -1.729, 0, 90, 0);
  79.             AttachObjectToObject(rubikObject[rDown][4], rubikRotate[rOriz][0],  -0.081000, 0, -1.729-0.001, 0, 90, 0);
  80.             AttachObjectToObject(rubikObject[rDown][5], rubikRotate[rOriz][0],  -2.821000, 0, -1.729, 0, 90, 0);
  81.             AttachObjectToObject(rubikObject[rDown][6], rubikRotate[rOriz][0], -2.821000, -2.9, -1.729+0.001, 0, 90, 0);
  82.             AttachObjectToObject(rubikObject[rDown][7], rubikRotate[rOriz][0],  -0.081000, -2.9, -1.729, 0, 90, 0);
  83.             AttachObjectToObject(rubikObject[rDown][8], rubikRotate[rOriz][0],  2.688999, -2.9, -1.729+0.001, 0, 90, 0);
  84.  
  85.                     AttachObjectToObject(rubikObject[rRight][0], rubikRotate[rOriz][2],  4.509, -2.9, 0, 0, 0, 0);
  86.             AttachObjectToObject(rubikObject[rRight][1], rubikRotate[rOriz][2],  4.5, 0, 0, 0, 0, 0);
  87.             AttachObjectToObject(rubikObject[rRight][2], rubikRotate[rOriz][2],  4.509, 2.9, 0, 0, 0, 0);
  88.             AttachObjectToObject(rubikObject[rRight][3], rubikRotate[rOriz][1],  4.509, -2.9, 0, 0, 0, 0);
  89.             AttachObjectToObject(rubikObject[rRight][4], rubikRotate[rOriz][1],  4.5, 0, 0, 0, 0, 0);
  90.             AttachObjectToObject(rubikObject[rRight][5], rubikRotate[rOriz][1],  4.509, 2.9, 0, 0, 0, 0);
  91.             AttachObjectToObject(rubikObject[rRight][6], rubikRotate[rOriz][0],  4.509, -2.9, 0, 0, 0, 0);
  92.             AttachObjectToObject(rubikObject[rRight][7], rubikRotate[rOriz][0],  4.5, 0, 0, 0, 0, 0);
  93.             AttachObjectToObject(rubikObject[rRight][8], rubikRotate[rOriz][0],  4.509, 2.9, 0, 0, 0, 0);
  94.  
  95.                     AttachObjectToObject(rubikObject[rBehind][0], rubikRotate[rOriz][2], -2.9, -4.509, 0, 0, 0, 90);
  96.             AttachObjectToObject(rubikObject[rBehind][1], rubikRotate[rOriz][2],    0,   -4.5, 0, 0, 0, 90);
  97.             AttachObjectToObject(rubikObject[rBehind][2], rubikRotate[rOriz][2],  2.9, -4.509, 0, 0, 0, 90);
  98.             AttachObjectToObject(rubikObject[rBehind][3], rubikRotate[rOriz][1], -2.9, -4.509, 0, 0, 0, 90);
  99.             AttachObjectToObject(rubikObject[rBehind][4], rubikRotate[rOriz][1],    0,   -4.5, 0, 0, 0, 90);
  100.             AttachObjectToObject(rubikObject[rBehind][5], rubikRotate[rOriz][1],  2.9, -4.509, 0, 0, 0, 90);
  101.             AttachObjectToObject(rubikObject[rBehind][6], rubikRotate[rOriz][0], -2.9, -4.509, 0, 0, 0, 90);
  102.             AttachObjectToObject(rubikObject[rBehind][7], rubikRotate[rOriz][0],    0,   -4.5, 0, 0, 0, 90);
  103.             AttachObjectToObject(rubikObject[rBehind][8], rubikRotate[rOriz][0],  2.9, -4.509, 0, 0, 0, 90);
  104.  
  105.             AttachObjectToObject(rubikObject[rFront][0], rubikRotate[rOriz][2], -2.9, 4.509, 0, 0, 0, 90);
  106.             AttachObjectToObject(rubikObject[rFront][1], rubikRotate[rOriz][2],    0,    4.5, 0, 0, 0, 90);
  107.             AttachObjectToObject(rubikObject[rFront][2], rubikRotate[rOriz][2],  2.9, 4.509, 0, 0, 0, 90);
  108.             AttachObjectToObject(rubikObject[rFront][3], rubikRotate[rOriz][1], -2.9, 4.509, 0, 0, 0, 90);
  109.             AttachObjectToObject(rubikObject[rFront][4], rubikRotate[rOriz][1],    0,    4.5, 0, 0, 0, 90);
  110.             AttachObjectToObject(rubikObject[rFront][5], rubikRotate[rOriz][1],  2.9, 4.509, 0, 0, 0, 90);
  111.             AttachObjectToObject(rubikObject[rFront][6], rubikRotate[rOriz][0], -2.9, 4.509, 0, 0, 0, 90);
  112.             AttachObjectToObject(rubikObject[rFront][7], rubikRotate[rOriz][0],    0,    4.5, 0, 0, 0, 90);
  113.             AttachObjectToObject(rubikObject[rFront][8], rubikRotate[rOriz][0],  2.9, 4.509, 0, 0, 0, 90);
  114.  
  115.                     AttachObjectToObject(rubikObject[rLeft][0], rubikRotate[rOriz][2], -4.509, -2.9, 0, 0, 0, 0);
  116.             AttachObjectToObject(rubikObject[rLeft][1], rubikRotate[rOriz][2],  -4.5, 0, 0, 0, 0, 0);
  117.             AttachObjectToObject(rubikObject[rLeft][2], rubikRotate[rOriz][2],  -4.509, 2.9, 0, 0, 0, 0);
  118.             AttachObjectToObject(rubikObject[rLeft][3], rubikRotate[rOriz][1], -4.509, -2.9, 0, 0, 0, 0);
  119.             AttachObjectToObject(rubikObject[rLeft][4], rubikRotate[rOriz][1],  -4.5, 0, 0, 0, 0, 0);
  120.             AttachObjectToObject(rubikObject[rLeft][5], rubikRotate[rOriz][1],  -4.509, 2.9, 0, 0, 0, 0);
  121.             AttachObjectToObject(rubikObject[rLeft][6], rubikRotate[rOriz][0], -4.509, -2.9, 0, 0, 0, 0);
  122.             AttachObjectToObject(rubikObject[rLeft][7], rubikRotate[rOriz][0],  -4.5, 0, 0, 0, 0, 0);
  123.             AttachObjectToObject(rubikObject[rLeft][8], rubikRotate[rOriz][0],  -4.509, 2.9, 0, 0, 0, 0);
  124.         }
  125.         case rVert:
  126.         {
  127.             //Missing feature
  128.         }
  129.         case rLate:
  130.         {
  131.             //Missing feature
  132.         }
  133.     }
  134. }
  135.  
  136. public OnFilterScriptInit()
  137. {
  138.     new a[][] =
  139.     {
  140.         "Unarmed (Fist)",
  141.         "Brass K"
  142.     };
  143.     #pragma unused a
  144.  
  145.     //Internal Parts
  146.     //rOriz
  147.  
  148.     rubikRotate[rOriz][0] = CreateObject(3095, 0, 0, HEIGHT_1, 0, 0, 0);
  149.     rubikRotate[rOriz][1] = CreateObject(3095, 0, 0, HEIGHT_2, 0, 0, 0);
  150.     rubikRotate[rOriz][2] = CreateObject(3095, 0, 0, HEIGHT_3, 0, 0, 0);
  151.     SetInvisibleTexture(rubikRotate[rOriz][0], 0);
  152.     SetInvisibleTexture(rubikRotate[rOriz][1], 0);
  153.     SetInvisibleTexture(rubikRotate[rOriz][2], 0);
  154.     SetInvisibleTexture(rubikRotate[rOriz][0], 1);
  155.     SetInvisibleTexture(rubikRotate[rOriz][1], 1);
  156.     SetInvisibleTexture(rubikRotate[rOriz][2], 1);
  157.    
  158.     //rVert
  159.    
  160.     rubikRotate[rVert][0] = CreateObject(3095, -2.7, 0, HEIGHT_2, 0, 90, 0);
  161.     rubikRotate[rVert][1] = CreateObject(3095, 0, 0, HEIGHT_2, 0, 90, 0);
  162.     rubikRotate[rVert][2] = CreateObject(3095, 2.7, 0, HEIGHT_2, 0, 90, 0);
  163.     SetInvisibleTexture(rubikRotate[rVert][0], 0);
  164.     SetInvisibleTexture(rubikRotate[rVert][1], 0);
  165.     SetInvisibleTexture(rubikRotate[rVert][2], 0);
  166.     SetInvisibleTexture(rubikRotate[rVert][0], 1);
  167.     SetInvisibleTexture(rubikRotate[rVert][1], 1);
  168.     SetInvisibleTexture(rubikRotate[rVert][2], 1);
  169.  
  170.     //rLate
  171.  
  172.     rubikRotate[rLate][0] = CreateObject(3095, 0, 0, HEIGHT_2, 0, 90, 90);
  173.     rubikRotate[rLate][1] = CreateObject(3095, 0, 2.7, HEIGHT_2, 0, 90, 90);
  174.     rubikRotate[rLate][2] = CreateObject(3095, 0, -2.7, HEIGHT_2, 0, 90, 90);
  175.         SetInvisibleTexture(rubikRotate[rLate][0], 0);
  176.     SetInvisibleTexture(rubikRotate[rLate][1], 0);
  177.     SetInvisibleTexture(rubikRotate[rLate][2], 0);
  178.     SetInvisibleTexture(rubikRotate[rLate][0], 1);
  179.     SetInvisibleTexture(rubikRotate[rLate][1], 1);
  180.     SetInvisibleTexture(rubikRotate[rLate][2], 1);
  181.    
  182.     //Faces
  183.     //rUp
  184.  
  185.     rubikObject[rUp][0] = CreateObject(19355, -2.821000, 2.9, HEIGHT_UP+0.001, 0.000000, 90.000000, 0.000000);
  186.         rubikObject[rUp][1] = CreateObject(19355, -0.081000, 2.9, HEIGHT_UP, 0.000000, 90.000000, 0.000000);
  187.         rubikObject[rUp][2] = CreateObject(19355, 2.688999, 2.9, HEIGHT_UP+0.001, 0, 90, 0);
  188.    
  189.         rubikObject[rUp][3] = CreateObject(19355, 2.688999, 0, HEIGHT_UP, 0, 90, 0);
  190.         rubikObject[rUp][4] = CreateObject(19355, -0.081000, 0, HEIGHT_UP-0.001, 0.000000, 90.000000, 0.000000);
  191.         rubikObject[rUp][5] = CreateObject(19355, -2.821000, 0, HEIGHT_UP, 0.000000, 90.000000, 0.000000);
  192.  
  193.     rubikObject[rUp][6] = CreateObject(19355, -2.821000, -2.9, HEIGHT_UP+0.001, 0.000000, 90.000000, 0.000000);
  194.     rubikObject[rUp][7] = CreateObject(19355, -0.081000, -2.9, HEIGHT_UP, 0.000000, 90.000000, 0.000000);
  195.     rubikObject[rUp][8] = CreateObject(19355, 2.688999, -2.9, HEIGHT_UP+0.001, 0, 90, 0);
  196.  
  197.     //rDown
  198.    
  199.     rubikObject[rDown][0] = CreateObject(19355, -2.821000, 2.9, HEIGHT_DOWN+0.001, 0.000000, 90.000000, 0.000000);
  200.         rubikObject[rDown][1] = CreateObject(19355, -0.081000, 2.9, HEIGHT_DOWN, 0.000000, 90.000000, 0.000000);
  201.         rubikObject[rDown][2] = CreateObject(19355, 2.688999, 2.9, HEIGHT_DOWN+0.001, 0, 90, 0);
  202.  
  203.         rubikObject[rDown][3] = CreateObject(19355, 2.688999, 0, HEIGHT_DOWN, 0, 90, 0);
  204.     rubikObject[rDown][4] = CreateObject(19355, -0.081000, 0, HEIGHT_DOWN-0.001, 0.000000, 90.000000, 0.000000);
  205.         rubikObject[rDown][5] = CreateObject(19355, -2.821000, 0, HEIGHT_DOWN, 0.000000, 90.000000, 0.000000);
  206.    
  207.     rubikObject[rDown][6] = CreateObject(19355, -2.821000, -2.9, HEIGHT_DOWN+0.001, 0.000000, 90.000000, 0.000000);
  208.     rubikObject[rDown][7] = CreateObject(19355, -0.081000, -2.9, HEIGHT_DOWN, 0.000000, 90.000000, 0.000000);
  209.     rubikObject[rDown][8] = CreateObject(19355, 2.688999, -2.9, HEIGHT_DOWN+0.001, 0, 90, 0);
  210.  
  211.     //rRight
  212.  
  213.     rubikObject[rRight][0] = CreateObject(19355, 4.509, -2.9, HEIGHT_3, 0, 0, 0);
  214.     rubikObject[rRight][1] = CreateObject(19355, 4.5, 0, HEIGHT_3, 0, 0, 0);
  215.     rubikObject[rRight][2] = CreateObject(19355, 4.509, 2.9, HEIGHT_3, 0, 0, 0);
  216.    
  217.         rubikObject[rRight][3] = CreateObject(19355, 4.509, -2.9, HEIGHT_2, 0, 0, 0);
  218.     rubikObject[rRight][4] = CreateObject(19355, 4.5, 0, HEIGHT_2, 0, 0, 0);
  219.     rubikObject[rRight][5] = CreateObject(19355, 4.509, 2.9, HEIGHT_2, 0, 0, 0);
  220.    
  221.     rubikObject[rRight][6] = CreateObject(19355, 4.509, -2.9, HEIGHT_1, 0, 0, 0);
  222.     rubikObject[rRight][7] = CreateObject(19355, 4.5, 0, HEIGHT_1, 0, 0, 0);
  223.     rubikObject[rRight][8] = CreateObject(19355, 4.509, 2.9, HEIGHT_1, 0, 0, 0);
  224.    
  225.     //rLeft
  226.  
  227.     rubikObject[rLeft][0] = CreateObject(19355, -4.509, -2.9, HEIGHT_3, 0, 0, 0);
  228.     rubikObject[rLeft][1] = CreateObject(19355, -4.5, 0, HEIGHT_3, 0, 0, 0);
  229.     rubikObject[rLeft][2] = CreateObject(19355, -4.509, 2.9, HEIGHT_3, 0, 0, 0);
  230.  
  231.     rubikObject[rLeft][3] = CreateObject(19355, -4.509, -2.9, HEIGHT_2, 0, 0, 0);
  232.     rubikObject[rLeft][4] = CreateObject(19355, -4.5, 0, HEIGHT_2, 0, 0, 0);
  233.     rubikObject[rLeft][5] = CreateObject(19355, -4.509, 2.9, HEIGHT_2, 0, 0, 0);
  234.    
  235.     rubikObject[rLeft][6] = CreateObject(19355, -4.509, -2.9, HEIGHT_1, 0, 0, 0);
  236.     rubikObject[rLeft][7] = CreateObject(19355, -4.5, 0, HEIGHT_1, 0, 0, 0);
  237.     rubikObject[rLeft][8] = CreateObject(19355, -4.509, 2.9, HEIGHT_1, 0, 0, 0);
  238.  
  239.     //rFront
  240.  
  241.     rubikObject[rFront][0] = CreateObject(19355, -2.9, 4.509, HEIGHT_3, 0, 0, 90);
  242.     rubikObject[rFront][1] = CreateObject(19355, 0,    4.5, HEIGHT_3, 0, 0, 90);
  243.     rubikObject[rFront][2] = CreateObject(19355,  2.9, 4.509, HEIGHT_3, 0, 0, 90);
  244.    
  245.     rubikObject[rFront][3] = CreateObject(19355, -2.9, 4.509, HEIGHT_2, 0, 0, 90);
  246.     rubikObject[rFront][4] = CreateObject(19355, 0,    4.5, HEIGHT_2, 0, 0, 90);
  247.     rubikObject[rFront][5] = CreateObject(19355,  2.9, 4.509, HEIGHT_2, 0, 0, 90);
  248.    
  249.     rubikObject[rFront][6] = CreateObject(19355, -2.9, 4.509, HEIGHT_1, 0, 0, 90);
  250.     rubikObject[rFront][7] = CreateObject(19355, 0,    4.5, HEIGHT_1, 0, 0, 90);
  251.     rubikObject[rFront][8] = CreateObject(19355,  2.9, 4.509, HEIGHT_1, 0, 0, 90);
  252.  
  253.     //rBehind
  254.  
  255.     rubikObject[rBehind][0] = CreateObject(19355, -2.9, -4.509, HEIGHT_3, 0, 0, 90);
  256.     rubikObject[rBehind][1] = CreateObject(19355, 0,    -4.5, HEIGHT_3, 0, 0, 90);
  257.     rubikObject[rBehind][2] = CreateObject(19355,  2.9, -4.509, HEIGHT_3, 0, 0, 90);
  258.    
  259.     rubikObject[rBehind][3] = CreateObject(19355, -2.9, -4.509, HEIGHT_2, 0, 0, 90);
  260.     rubikObject[rBehind][4] = CreateObject(19355, 0,    -4.5, HEIGHT_2, 0, 0, 90);
  261.     rubikObject[rBehind][5] = CreateObject(19355,  2.9, -4.509, HEIGHT_2, 0, 0, 90);
  262.    
  263.     rubikObject[rBehind][6] = CreateObject(19355, -2.9, -4.509, HEIGHT_1, 0, 0, 90);
  264.     rubikObject[rBehind][7] = CreateObject(19355, 0,    -4.5, HEIGHT_1, 0, 0, 90);
  265.     rubikObject[rBehind][8] = CreateObject(19355,  2.9, -4.509, HEIGHT_1, 0, 0, 90);
  266.  
  267.     //Init
  268.  
  269.         AttachObjectsForRotation(rOriz);
  270.         RandomizeCube();
  271.  
  272.     return 1;
  273. }
  274.  
  275. stock RandomizeCube()
  276. {
  277.     static const rubikHex[6] = {
  278.         0xFFFF0000, //Red
  279.         0xFF00FF00, //Blue
  280.         0xFF0000FF, //Green
  281.         0xFFFFFF00, //Yellow
  282.         0xFFFFA500, //Orange
  283.         0xFFFFFFFF, //White
  284.     };
  285.     new canAssign[6] = { 9, ... };
  286.  
  287.     for(new i, j, rnd; i < 6; i++)
  288.     {
  289.         for(j = 0; j < 9; j++)
  290.         {
  291.             rnd = random(6);
  292.             if(canAssign[rnd])
  293.             {
  294.                 canAssign[rnd]--;
  295.                 rubikColour[i][j] = rubikHex[rnd];
  296.                 SetObjectColour(rubikObject[i][j], 0, rubikColour[i][j]);
  297.             }
  298.             else j--;
  299.         }
  300.     }
  301. }
  302.  
  303. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  304. {
  305.     if(newkeys & KEY_YES)
  306.     {
  307.         selectedRow++;
  308.         if(selectedRow > 2)
  309.         {
  310.             selectedRow = 0;
  311.         }
  312.     }
  313.     else if(newkeys & KEY_NO)
  314.     {
  315.         selectedRow--;
  316.         if(selectedRow < 0)
  317.         {
  318.             selectedRow = 2;
  319.         }
  320.     }
  321.     else if(newkeys & KEY_ANALOG_RIGHT)
  322.     {
  323.         rOriz_RotateRight();
  324.     }
  325.     else if(newkeys & KEY_ANALOG_LEFT)
  326.     {
  327.         rOriz_RotateLeft();
  328.     }
  329.     return 1;
  330. }
  331.  
  332. //
  333.  
  334. stock rOriz_RotateRight()
  335. {
  336.     new Float:gHeights[3];
  337.     gHeights[0] = HEIGHT_1;
  338.     gHeights[1] = HEIGHT_2;
  339.     gHeights[2] = HEIGHT_3;
  340.         new Float:temp, Float:rot;
  341.     GetObjectRot(rubikRotate[rOriz][selectedRow], temp, temp, rot);
  342.     rubikRotateStep[rOriz][selectedRow] = !(rubikRotateStep[rOriz][selectedRow]);
  343.         MoveObject(rubikRotate[rOriz][selectedRow], 0, 0, gHeights[selectedRow] + 0.001*(-1 * rubikRotateStep[rOriz][selectedRow]), 0.0006, 0, 0, rot-90);
  344. }
  345.  
  346. stock rOriz_RotateLeft()
  347. {
  348.     new Float:gHeights[3];
  349.     gHeights[0] = HEIGHT_1;
  350.     gHeights[1] = HEIGHT_2;
  351.     gHeights[2] = HEIGHT_3;
  352.         new Float:temp, Float:rot;
  353.     GetObjectRot(rubikRotate[rOriz][selectedRow], temp, temp, rot);
  354.     rubikRotateStep[rOriz][selectedRow] = !(rubikRotateStep[rOriz][selectedRow]);
  355.         MoveObject(rubikRotate[rOriz][selectedRow], 0, 0, gHeights[selectedRow] + 0.001*(-1 * rubikRotateStep[rOriz][selectedRow]), 0.0006, 0, 0, rot+90);
  356. }
  357.  
  358. //
  359.  
  360. stock rVert_RotateRight()
  361. {
  362.         new Float:temp, Float:rot;
  363.     GetObjectRot(rubikRotate[rVert][selectedRow], rot, temp, temp);
  364.     rubikRotateStep[rVert][0] = !(rubikRotateStep[rVert][0]);
  365.     MoveObject(rubikRotate[rVert][selectedRow], 0, 0, HEIGHT_2 + 0.001*(-1 * rubikRotateStep[rVert][selectedRow]), 0.0006, rot+90, 90, 0);
  366. }
  367.  
  368. stock rVert_RotateLeft()
  369. {
  370.         new Float:temp, Float:rot;
  371.     GetObjectRot(rubikRotate[rVert][selectedRow], rot, temp, temp);
  372.     rubikRotateStep[rVert][selectedRow] = !(rubikRotateStep[rVert][selectedRow]);
  373.         MoveObject(rubikRotate[rVert][selectedRow], 0, 0, HEIGHT_2 + 0.001*(-1 * rubikRotateStep[rVert][selectedRow]), 0.0006, rot-90, 90, 0);
  374. }
  375.  
  376. //
  377.  
  378. stock rLate_RotateRight()
  379. {
  380.         new Float:temp, Float:rot;
  381.     GetObjectRot(rubikRotate[rLate][selectedRow], temp, rot, temp);
  382.     rubikRotateStep[rLate][0] = !(rubikRotateStep[rLate][0]);
  383.         MoveObject(rubikRotate[rLate][selectedRow], 0, 0, HEIGHT_2 + 0.001*(-1 * rubikRotateStep[rLate][selectedRow]), 0.0006, 0, rot+90, 90);
  384. }
  385.  
  386. stock rLate_RotateLeft()
  387. {
  388.         new Float:temp, Float:rot;
  389.     GetObjectRot(rubikRotate[rLate][selectedRow], temp, rot, temp);
  390.     rubikRotateStep[rLate][selectedRow] = !(rubikRotateStep[rLate][selectedRow]);
  391.         MoveObject(rubikRotate[rLate][selectedRow], 0, 0, HEIGHT_2 + 0.001*(-1 * rubikRotateStep[rLate][selectedRow]), 0.0006, 0, rot-90, 90);
  392. }
  393.  
  394. //
  395.  
  396. public OnFilterScriptExit()
  397. {
  398.     for(new i, j; i < 6; i++)
  399.         for(j = 0; j < 9; j++)
  400.             DestroyObject(rubikObject[i][j]);
  401.            
  402.     for(new i, j; i < 3; i++)
  403.         for(j = 0; j < 3; j++)
  404.             DestroyObject(rubikRotate[i][j]);
  405.  
  406.     return 1;
  407. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement