Advertisement
System32

S32_Calculator 1.5.0

Jan 30th, 2012
511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 21.19 KB | None | 0 0
  1. #include <a_samp>
  2. #include <YSI\y_commands>
  3. #include <YSI\y_timers>
  4.  
  5. #define COLOR_KRED  0xFF0000FF
  6.  
  7. new string[128], Text: CalculatorTD[MAX_PLAYERS][10], Text: CalculatorTD2[3], bool: CalculatorOn[MAX_PLAYERS], SelectedCharacter[MAX_PLAYERS] = 0, InputedWord[MAX_PLAYERS][32], InputedWord2[MAX_PLAYERS][32], SelectedOperation[MAX_PLAYERS][32];
  8. new Timer: CPCK[MAX_PLAYERS];
  9.  
  10. public OnFilterScriptInit()
  11. {
  12.     print("\n");
  13.     print("  \4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4");
  14.     print("  \4 S32_Calculator \4");
  15.     print("  \4 by             \4");
  16.     print("  \4 System32       \4");
  17.     print("  \4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\n");
  18.    
  19.     CalculatorTD2[0] = TextDrawCreate(282.000000, 130.000000, "."); // First white box -
  20.     TextDrawBackgroundColor(CalculatorTD2[0], 255);
  21.     TextDrawFont(CalculatorTD2[0], 1);
  22.     TextDrawLetterSize(CalculatorTD2[0], 0.000000, 0.000000);
  23.     TextDrawColor(CalculatorTD2[0], -1);
  24.     TextDrawSetOutline(CalculatorTD2[0], 0);
  25.     TextDrawSetProportional(CalculatorTD2[0], 1);
  26.     TextDrawSetShadow(CalculatorTD2[0], 1);
  27.     TextDrawUseBox(CalculatorTD2[0], 1);
  28.     TextDrawBoxColor(CalculatorTD2[0], -1);
  29.     TextDrawTextSize(CalculatorTD2[0], 40.000000, -1.000000);
  30.  
  31.     CalculatorTD2[1] = TextDrawCreate(282.000000, 179.000000, "."); // Second white box -
  32.     TextDrawBackgroundColor(CalculatorTD2[1], 255);
  33.     TextDrawFont(CalculatorTD2[1], 1);
  34.     TextDrawLetterSize(CalculatorTD2[1], 0.000000, 0.000000);
  35.     TextDrawColor(CalculatorTD2[1], -1);
  36.     TextDrawSetOutline(CalculatorTD2[1], 0);
  37.     TextDrawSetProportional(CalculatorTD2[1], 1);
  38.     TextDrawSetShadow(CalculatorTD2[1], 1);
  39.     TextDrawUseBox(CalculatorTD2[1], 1);
  40.     TextDrawBoxColor(CalculatorTD2[1], -1);
  41.     TextDrawTextSize(CalculatorTD2[1], 40.000000, -1.000000);
  42.    
  43.     CalculatorTD2[2] = TextDrawCreate(282.000000, 111.000000, "."); // First black box -
  44.     TextDrawBackgroundColor(CalculatorTD2[2], 255);
  45.     TextDrawFont(CalculatorTD2[2], 1);
  46.     TextDrawLetterSize(CalculatorTD2[2], 0.000000, 1.805);
  47.     TextDrawColor(CalculatorTD2[2], -1);
  48.     TextDrawSetOutline(CalculatorTD2[2], 0);
  49.     TextDrawSetProportional(CalculatorTD2[2], 1);
  50.     TextDrawSetShadow(CalculatorTD2[2], 1);
  51.     TextDrawUseBox(CalculatorTD2[2], 1);
  52.     TextDrawBoxColor(CalculatorTD2[2], 85);
  53.     TextDrawTextSize(CalculatorTD2[2], 40.000000, 9.000000);
  54.     return 1;
  55. }
  56.  
  57. public OnFilterScriptExit()
  58. {
  59.     return 1;
  60. }
  61.  
  62. public OnPlayerConnect(playerid)
  63. {
  64.     return 1;
  65. }
  66.  
  67. public OnPlayerDisconnect(playerid, reason)
  68. {
  69.     return 1;
  70. }
  71.  
  72. YCMD:calculator(playerid, params[], help)
  73. {
  74.     #pragma unused help
  75.     #pragma unused params
  76.     if(CalculatorOn[playerid] == true)
  77.     {
  78.         CalculatorTD[playerid][0] = TextDrawCreate(51.000000, 132.000000, "0 1 2 3 4 5 6 7 8 9");
  79.         TextDrawBackgroundColor(CalculatorTD[playerid][0], 255);
  80.         TextDrawFont(CalculatorTD[playerid][0], 1);
  81.         TextDrawLetterSize(CalculatorTD[playerid][0], 0.629999, 2.299999);
  82.         TextDrawColor(CalculatorTD[playerid][0], -1);
  83.         TextDrawSetOutline(CalculatorTD[playerid][0], 0);
  84.         TextDrawSetProportional(CalculatorTD[playerid][0], 1);
  85.         TextDrawSetShadow(CalculatorTD[playerid][0], 0);
  86.  
  87.         CalculatorTD[playerid][1] = TextDrawCreate(51.000000, 152.000000, "+ - x / . A       < =");
  88.         TextDrawBackgroundColor(CalculatorTD[playerid][1], 255);
  89.         TextDrawFont(CalculatorTD[playerid][1], 1);
  90.         TextDrawLetterSize(CalculatorTD[playerid][1], 0.629999, 2.299999);
  91.         TextDrawColor(CalculatorTD[playerid][1], -1);
  92.         TextDrawSetOutline(CalculatorTD[playerid][1], 0);
  93.         TextDrawSetProportional(CalculatorTD[playerid][1], 1);
  94.         TextDrawSetShadow(CalculatorTD[playerid][1], 0);
  95.  
  96.         CalculatorTD[playerid][2] = TextDrawCreate(196.000000, 161.000000, "A");
  97.         TextDrawBackgroundColor(CalculatorTD[playerid][2], 255);
  98.         TextDrawFont(CalculatorTD[playerid][2], 1);
  99.         TextDrawLetterSize(CalculatorTD[playerid][2], 0.500000, 1.000000);
  100.         TextDrawColor(CalculatorTD[playerid][2], -1);
  101.         TextDrawSetOutline(CalculatorTD[playerid][2], 0);
  102.         TextDrawSetProportional(CalculatorTD[playerid][2], 1);
  103.         TextDrawSetShadow(CalculatorTD[playerid][2], 0);
  104.  
  105.         CalculatorTD[playerid][3] = TextDrawCreate(163.000000, 152.000000, "2");
  106.         TextDrawBackgroundColor(CalculatorTD[playerid][3], 255);
  107.         TextDrawFont(CalculatorTD[playerid][3], 1);
  108.         TextDrawLetterSize(CalculatorTD[playerid][3], 0.500000, 1.000000);
  109.         TextDrawColor(CalculatorTD[playerid][3], -1);
  110.         TextDrawSetOutline(CalculatorTD[playerid][3], 0);
  111.         TextDrawSetProportional(CalculatorTD[playerid][3], 1);
  112.         TextDrawSetShadow(CalculatorTD[playerid][3], 0);
  113.  
  114.         CalculatorTD[playerid][4] = TextDrawCreate(178.000000, 152.000000, "-");
  115.         TextDrawBackgroundColor(CalculatorTD[playerid][4], 255);
  116.         TextDrawFont(CalculatorTD[playerid][4], 1);
  117.         TextDrawLetterSize(CalculatorTD[playerid][4], 0.629999, 1.799999);
  118.         TextDrawColor(CalculatorTD[playerid][4], -1);
  119.         TextDrawSetOutline(CalculatorTD[playerid][4], 0);
  120.         TextDrawSetProportional(CalculatorTD[playerid][4], 1);
  121.         TextDrawSetShadow(CalculatorTD[playerid][4], 0);
  122.  
  123.         CalculatorTD[playerid][5] = TextDrawCreate(183.000000, 158.000000, "\\");
  124.         TextDrawBackgroundColor(CalculatorTD[playerid][5], 255);
  125.         TextDrawFont(CalculatorTD[playerid][5], 1);
  126.         TextDrawLetterSize(CalculatorTD[playerid][5], 0.590000, 1.499999);
  127.         TextDrawColor(CalculatorTD[playerid][5], -1);
  128.         TextDrawSetOutline(CalculatorTD[playerid][5], 0);
  129.         TextDrawSetProportional(CalculatorTD[playerid][5], 1);
  130.         TextDrawSetShadow(CalculatorTD[playerid][5], 0);
  131.  
  132.         CalculatorTD[playerid][6] = TextDrawCreate(189.000000, 150.500000, "/");
  133.         TextDrawBackgroundColor(CalculatorTD[playerid][6], 255);
  134.         TextDrawFont(CalculatorTD[playerid][6], 1);
  135.         TextDrawLetterSize(CalculatorTD[playerid][6], 0.510000, 2.299999);
  136.         TextDrawColor(CalculatorTD[playerid][6], -1);
  137.         TextDrawSetOutline(CalculatorTD[playerid][6], 0);
  138.         TextDrawSetProportional(CalculatorTD[playerid][6], 1);
  139.         TextDrawSetShadow(CalculatorTD[playerid][6], 0);
  140.  
  141.         CalculatorTD[playerid][7] = TextDrawCreate(193.000000, 145.699996, "-");
  142.         TextDrawBackgroundColor(CalculatorTD[playerid][7], 255);
  143.         TextDrawFont(CalculatorTD[playerid][7], 1);
  144.         TextDrawLetterSize(CalculatorTD[playerid][7], 1.280000, 1.799999);
  145.         TextDrawColor(CalculatorTD[playerid][7], -1);
  146.         TextDrawSetOutline(CalculatorTD[playerid][7], 0);
  147.         TextDrawSetProportional(CalculatorTD[playerid][7], 1);
  148.         TextDrawSetShadow(CalculatorTD[playerid][7], 0);
  149.  
  150.         CalculatorTD[playerid][8] = TextDrawCreate(49.000000, 112.000000, "0 VALUE");
  151.         TextDrawBackgroundColor(CalculatorTD[playerid][8], 255);
  152.         TextDrawFont(CalculatorTD[playerid][8], 1);
  153.         TextDrawLetterSize(CalculatorTD[playerid][8], 0.539999, 1.400000);
  154.         TextDrawColor(CalculatorTD[playerid][8], -16776961);
  155.         TextDrawSetOutline(CalculatorTD[playerid][8], 0);
  156.         TextDrawSetProportional(CalculatorTD[playerid][8], 1);
  157.         TextDrawSetShadow(CalculatorTD[playerid][8], 1);
  158.    
  159.         CalculatorOn[playerid] = false;
  160.         for(new td = 0; td <= 7; td++) { TextDrawShowForPlayer(playerid, CalculatorTD[playerid][td]); }
  161.         TextDrawShowForPlayer(playerid, CalculatorTD2[0]);
  162.         TextDrawShowForPlayer(playerid, CalculatorTD2[1]);
  163.         TextDrawShowForPlayer(playerid, CalculatorTD2[2]);
  164.         CPCK[playerid] = repeat CheckPlayerCalculatorKeys(playerid);
  165.         TogglePlayerControllable(playerid, 0);
  166.     }
  167.     else if(CalculatorOn[playerid] == false)
  168.     {
  169.         CalculatorOn[playerid] = true;
  170.         for(new td = 0; td <= 8; td++) { TextDrawHideForPlayer(playerid, CalculatorTD[playerid][td]); TextDrawDestroy(CalculatorTD[playerid][td]); }
  171.         TextDrawHideForPlayer(playerid, CalculatorTD2[0]);
  172.         TextDrawHideForPlayer(playerid, CalculatorTD2[1]);
  173.         TextDrawHideForPlayer(playerid, CalculatorTD2[2]);
  174.         stop CPCK[playerid];
  175.         TogglePlayerControllable(playerid, 1);
  176.     }
  177.     return 1;
  178. }
  179.  
  180. timer CheckPlayerCalculatorKeys[200](playerid)
  181. {
  182.     new keys, ud, lr;
  183.     GetPlayerKeys(playerid, keys, ud, lr);
  184.     if(lr > 0)
  185.     {
  186.         SelectedCharacter[playerid] ++;
  187.         TextDrawSetString(CalculatorTD[playerid][0], "~w~0 1 2 3 4 5 6 7 8 9");
  188.         TextDrawSetString(CalculatorTD[playerid][1], "~w~+ - x / . A       < =");
  189.         TextDrawSetString(CalculatorTD[playerid][2], "~w~A");
  190.         TextDrawSetString(CalculatorTD[playerid][3], "~w~2");
  191.         TextDrawSetString(CalculatorTD[playerid][4], "~w~-");
  192.         TextDrawSetString(CalculatorTD[playerid][5], "~w~\\");
  193.         TextDrawSetString(CalculatorTD[playerid][6], "~w~/");
  194.         TextDrawSetString(CalculatorTD[playerid][7], "~w~-");
  195.     }
  196.     else if(lr < 0)
  197.     {
  198.         SelectedCharacter[playerid] --;
  199.         TextDrawSetString(CalculatorTD[playerid][0], "~w~0 1 2 3 4 5 6 7 8 9");
  200.         TextDrawSetString(CalculatorTD[playerid][1], "~w~+ - x / . A       < =");
  201.         TextDrawSetString(CalculatorTD[playerid][2], "~w~A");
  202.         TextDrawSetString(CalculatorTD[playerid][3], "~w~2");
  203.         TextDrawSetString(CalculatorTD[playerid][4], "~w~-");
  204.         TextDrawSetString(CalculatorTD[playerid][5], "~w~\\");
  205.         TextDrawSetString(CalculatorTD[playerid][6], "~w~/");
  206.         TextDrawSetString(CalculatorTD[playerid][7], "~w~-");
  207.     }
  208.     if(SelectedCharacter[playerid] == 0)
  209.     {
  210.         TextDrawSetString(CalculatorTD[playerid][0], "~r~~h~0 ~w~1 2 3 4 5 6 7 8 9");
  211.     }
  212.     else if(SelectedCharacter[playerid] == 1)
  213.     {
  214.         TextDrawSetString(CalculatorTD[playerid][0], "0 ~r~~h~1 ~w~2 3 4 5 6 7 8 9");
  215.     }
  216.     else if(SelectedCharacter[playerid] == 2)
  217.     {
  218.         TextDrawSetString(CalculatorTD[playerid][0], "0 1 ~r~~h~2 ~w~3 4 5 6 7 8 9");
  219.     }
  220.     else if(SelectedCharacter[playerid] == 3)
  221.     {
  222.         TextDrawSetString(CalculatorTD[playerid][0], "0 1 2 ~r~~h~3 ~w~4 5 6 7 8 9");
  223.     }
  224.     else if(SelectedCharacter[playerid] == 4)
  225.     {
  226.         TextDrawSetString(CalculatorTD[playerid][0], "0 1 2 3 ~r~~h~4 ~w~5 6 7 8 9");
  227.     }
  228.     else if(SelectedCharacter[playerid] == 5)
  229.     {
  230.         TextDrawSetString(CalculatorTD[playerid][0], "0 1 2 3 4 ~r~~h~5 ~w~6 7 8 9");
  231.     }
  232.     else if(SelectedCharacter[playerid] == 6)
  233.     {
  234.         TextDrawSetString(CalculatorTD[playerid][0], "0 1 2 3 4 5 ~r~~h~6 ~w~7 8 9");
  235.     }
  236.     else if(SelectedCharacter[playerid] == 7)
  237.     {
  238.         TextDrawSetString(CalculatorTD[playerid][0], "0 1 2 3 4 5 6 ~r~~h~7 ~w~8 9");
  239.     }
  240.     else if(SelectedCharacter[playerid] == 8)
  241.     {
  242.         TextDrawSetString(CalculatorTD[playerid][0], "0 1 2 3 4 5 6 7 ~r~~h~8 ~w~9");
  243.     }
  244.     else if(SelectedCharacter[playerid] == 9)
  245.     {
  246.         TextDrawSetString(CalculatorTD[playerid][0], "0 1 2 3 4 5 6 7 8 ~r~~h~9");
  247.     }
  248.     else if(SelectedCharacter[playerid] == 10)
  249.     {
  250.         TextDrawSetString(CalculatorTD[playerid][1], "~r~~h~+ ~w~- x / . A       < =");
  251.     }
  252.     else if(SelectedCharacter[playerid] == 11)
  253.     {
  254.         TextDrawSetString(CalculatorTD[playerid][1], "+ ~r~~h~- ~w~x / . A       < =");
  255.     }
  256.     else if(SelectedCharacter[playerid] == 12)
  257.     {
  258.         TextDrawSetString(CalculatorTD[playerid][1], "+ - ~r~~h~x ~w~/ . A       < =");
  259.     }
  260.     else if(SelectedCharacter[playerid] == 13)
  261.     {
  262.         TextDrawSetString(CalculatorTD[playerid][1], "+ - x ~r~~h~/ ~w~. A       < =");
  263.     }
  264.     else if(SelectedCharacter[playerid] == 14)
  265.     {
  266.         TextDrawSetString(CalculatorTD[playerid][1], "+ - x / ~r~~h~. ~w~A       < =");
  267.     }
  268.     else if(SelectedCharacter[playerid] == 15)
  269.     {
  270.         TextDrawSetString(CalculatorTD[playerid][1], "+ - x / . ~r~~h~A       ~w~< =");
  271.         TextDrawSetString(CalculatorTD[playerid][3], "~r~~h~2");
  272.     }
  273.     else if(SelectedCharacter[playerid] == 16)
  274.     {
  275.         TextDrawSetString(CalculatorTD[playerid][2], "~r~~h~A");
  276.         TextDrawSetString(CalculatorTD[playerid][4], "~r~~h~-");
  277.         TextDrawSetString(CalculatorTD[playerid][5], "~r~~h~\\");
  278.         TextDrawSetString(CalculatorTD[playerid][6], "~r~~h~/");
  279.         TextDrawSetString(CalculatorTD[playerid][7], "~r~~h~-");
  280.     }
  281.     else if(SelectedCharacter[playerid] == 17)
  282.     {
  283.         TextDrawSetString(CalculatorTD[playerid][1], "+ - x / . A       ~r~~h~< ~w~=");
  284.     }
  285.     else if(SelectedCharacter[playerid] == 18)
  286.     {
  287.         TextDrawSetString(CalculatorTD[playerid][1], "+ - x / . A       < ~r~~h~=");
  288.     }
  289.     else if(SelectedCharacter[playerid] == 19) SelectedCharacter[playerid] = 0;
  290.     else if(SelectedCharacter[playerid] == -1) SelectedCharacter[playerid] = 18;
  291.     if(ud > 0)
  292.     {
  293.         if(SelectedCharacter[playerid] >= 0 && SelectedCharacter[playerid] <= 9)
  294.         {
  295.             SelectedCharacter[playerid] = SelectedCharacter[playerid] + 10;
  296.             TextDrawSetString(CalculatorTD[playerid][0], "~w~0 1 2 3 4 5 6 7 8 9");
  297.             TextDrawSetString(CalculatorTD[playerid][1], "~w~+ - x / . A       < =");
  298.             TextDrawSetString(CalculatorTD[playerid][2], "~w~A");
  299.             TextDrawSetString(CalculatorTD[playerid][3], "~w~2");
  300.             TextDrawSetString(CalculatorTD[playerid][4], "~w~-");
  301.             TextDrawSetString(CalculatorTD[playerid][5], "~w~\\");
  302.             TextDrawSetString(CalculatorTD[playerid][6], "~w~/");
  303.             TextDrawSetString(CalculatorTD[playerid][7], "~w~-");
  304.         }
  305.         else if(SelectedCharacter[playerid] >= 10)
  306.         {
  307.             SelectedCharacter[playerid] = SelectedCharacter[playerid] - 10;
  308.             TextDrawSetString(CalculatorTD[playerid][0], "~w~0 1 2 3 4 5 6 7 8 9");
  309.             TextDrawSetString(CalculatorTD[playerid][1], "~w~+ - x / . A       < =");
  310.             TextDrawSetString(CalculatorTD[playerid][2], "~w~A");
  311.             TextDrawSetString(CalculatorTD[playerid][3], "~w~2");
  312.             TextDrawSetString(CalculatorTD[playerid][4], "~w~-");
  313.             TextDrawSetString(CalculatorTD[playerid][5], "~w~\\");
  314.             TextDrawSetString(CalculatorTD[playerid][6], "~w~/");
  315.             TextDrawSetString(CalculatorTD[playerid][7], "~w~-");
  316.         }
  317.         printf("Char: %d", SelectedCharacter[playerid]);
  318.     }
  319.     if(ud < 0)
  320.     {
  321.         if(SelectedCharacter[playerid] >= 0 && SelectedCharacter[playerid] <= 9)
  322.         {
  323.             SelectedCharacter[playerid] = SelectedCharacter[playerid] + 10;
  324.             TextDrawSetString(CalculatorTD[playerid][0], "~w~0 1 2 3 4 5 6 7 8 9");
  325.             TextDrawSetString(CalculatorTD[playerid][1], "~w~+ - x / . A       < =");
  326.             TextDrawSetString(CalculatorTD[playerid][2], "~w~A");
  327.             TextDrawSetString(CalculatorTD[playerid][3], "~w~2");
  328.             TextDrawSetString(CalculatorTD[playerid][4], "~w~-");
  329.             TextDrawSetString(CalculatorTD[playerid][5], "~w~\\");
  330.             TextDrawSetString(CalculatorTD[playerid][6], "~w~/");
  331.             TextDrawSetString(CalculatorTD[playerid][7], "~w~-");
  332.         }
  333.         else if(SelectedCharacter[playerid] >= 10)
  334.         {
  335.             SelectedCharacter[playerid] = SelectedCharacter[playerid] - 10;
  336.             TextDrawSetString(CalculatorTD[playerid][0], "~w~0 1 2 3 4 5 6 7 8 9");
  337.             TextDrawSetString(CalculatorTD[playerid][1], "~w~+ - x / . A       < =");
  338.             TextDrawSetString(CalculatorTD[playerid][2], "~w~A");
  339.             TextDrawSetString(CalculatorTD[playerid][3], "~w~2");
  340.             TextDrawSetString(CalculatorTD[playerid][4], "~w~-");
  341.             TextDrawSetString(CalculatorTD[playerid][5], "~w~\\");
  342.             TextDrawSetString(CalculatorTD[playerid][6], "~w~/");
  343.             TextDrawSetString(CalculatorTD[playerid][7], "~w~-");
  344.         }
  345.         printf("Char: %d", SelectedCharacter[playerid]);
  346.     }
  347.     if(keys == KEY_SECONDARY_ATTACK)
  348.     {
  349.         if(SelectedCharacter[playerid] == 0)
  350.         {
  351.             if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "0");
  352.             else strcat(InputedWord2[playerid], "0");
  353.         }
  354.         else if(SelectedCharacter[playerid] == 1)
  355.         {
  356.             if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "1");
  357.             else strcat(InputedWord2[playerid], "1");
  358.         }
  359.         else if(SelectedCharacter[playerid] == 2)
  360.         {
  361.             if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "2");
  362.             else strcat(InputedWord2[playerid], "2");
  363.         }
  364.         else if(SelectedCharacter[playerid] == 3)
  365.         {
  366.             if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "3");
  367.             else strcat(InputedWord2[playerid], "3");
  368.         }
  369.         else if(SelectedCharacter[playerid] == 4)
  370.         {
  371.             if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "4");
  372.             else strcat(InputedWord2[playerid], "4");
  373.         }
  374.         else if(SelectedCharacter[playerid] == 5)
  375.         {
  376.             if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "5");
  377.             else strcat(InputedWord2[playerid], "5");
  378.         }
  379.         else if(SelectedCharacter[playerid] == 6)
  380.         {
  381.             if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "6");
  382.             else strcat(InputedWord2[playerid], "6");
  383.         }
  384.         else if(SelectedCharacter[playerid] == 7)
  385.         {
  386.             if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "7");
  387.             else strcat(InputedWord2[playerid], "7");
  388.         }
  389.         else if(SelectedCharacter[playerid] == 8)
  390.         {
  391.             if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "8");
  392.             else strcat(InputedWord2[playerid], "8");
  393.         }
  394.         else if(SelectedCharacter[playerid] == 9)
  395.         {
  396.             if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "9");
  397.             else strcat(InputedWord2[playerid], "9");
  398.         }
  399.         else if(SelectedCharacter[playerid] == 10)
  400.         {
  401.             if(!isnull(SelectedOperation[playerid])) return SendClientMessage(playerid, COLOR_KRED, "Operation is already choosed!");
  402.             format(SelectedOperation[playerid], 25, "+");
  403.         }
  404.         else if(SelectedCharacter[playerid] == 11)
  405.         {
  406.             if(!isnull(SelectedOperation[playerid])) return SendClientMessage(playerid, COLOR_KRED, "Operation is already choosed!");
  407.             format(SelectedOperation[playerid], 25, "-");
  408.         }
  409.         else if(SelectedCharacter[playerid] == 12)
  410.         {
  411.             if(!isnull(SelectedOperation[playerid])) return SendClientMessage(playerid, COLOR_KRED, "Operation is already choosed!");
  412.             format(SelectedOperation[playerid], 25, "x");
  413.         }
  414.         else if(SelectedCharacter[playerid] == 13)
  415.         {
  416.             if(!isnull(SelectedOperation[playerid])) return SendClientMessage(playerid, COLOR_KRED, "Operation is already choosed!");
  417.             format(SelectedOperation[playerid], 25, "/");
  418.         }
  419.         else if(SelectedCharacter[playerid] == 14)
  420.         {
  421.             if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], ".");
  422.             else strcat(InputedWord2[playerid], ".");
  423.         }
  424.         else if(SelectedCharacter[playerid] == 15)
  425.         {
  426.             if(isnull(InputedWord[playerid])) return SendClientMessage(playerid, COLOR_KRED, "You didn't choosed the number!");
  427.             format(string, sizeof(string), "%.2f", floatstr(InputedWord[playerid]) * floatstr(InputedWord[playerid]));
  428.             format(SelectedOperation[playerid], 25, "\0");
  429.             format(InputedWord[playerid], 24, "%s", string);
  430.         }
  431.         else if(SelectedCharacter[playerid] == 16)
  432.         {
  433.             if(isnull(InputedWord[playerid])) return SendClientMessage(playerid, COLOR_KRED, "You didn't choosed the number!");
  434.             format(string, sizeof(string), "%.2f", floatsqroot(floatstr(InputedWord[playerid])));
  435.             format(SelectedOperation[playerid], 25, "\0");
  436.             format(InputedWord[playerid], 24, "%s", string);
  437.         }
  438.         else if(SelectedCharacter[playerid] == 17)
  439.         {
  440.             if(!isnull(SelectedOperation[playerid]))
  441.             {
  442.                 if(!isnull(InputedWord2[playerid])) strdel(InputedWord2[playerid], (strlen(InputedWord2[playerid]) - 1), strlen(InputedWord2[playerid]));
  443.                 else
  444.                 {
  445.                     strdel(SelectedOperation[playerid], (strlen(SelectedOperation[playerid]) - 1), strlen(SelectedOperation[playerid]));
  446.                     format(SelectedOperation[playerid], 25, "\0");
  447.                 }
  448.             }
  449.             else strdel(InputedWord[playerid], (strlen(InputedWord[playerid]) - 1), strlen(InputedWord[playerid]));
  450.         }
  451.         else if(SelectedCharacter[playerid] == 18)
  452.         {
  453.             if(isnull(InputedWord[playerid])) return SendClientMessage(playerid, COLOR_KRED, "You didn't choosed first number!");
  454.             if(isnull(SelectedOperation[playerid])) return SendClientMessage(playerid, COLOR_KRED, "You didn't choosed operation!");
  455.             if(isnull(InputedWord2[playerid])) return SendClientMessage(playerid, COLOR_KRED, "You didn't choosed second number!");
  456.             if(!strcmp(SelectedOperation[playerid], "+"))
  457.             {
  458.                 format(string, sizeof(string), "%.2f", floatstr(InputedWord[playerid]) + floatstr(InputedWord2[playerid]));
  459.                 format(SelectedOperation[playerid], 25, "\0");
  460.                 format(InputedWord[playerid], 24, "%s", string);
  461.                 format(InputedWord2[playerid], 24, "\0");
  462.             }
  463.             else if(!strcmp(SelectedOperation[playerid], "-"))
  464.             {
  465.                 format(string, sizeof(string), "%.2f", floatstr(InputedWord[playerid]) - floatstr(InputedWord2[playerid]));
  466.                 format(SelectedOperation[playerid], 25, "\0");
  467.                 format(InputedWord[playerid], 24, "%s", string);
  468.                 format(InputedWord2[playerid], 24, "\0");
  469.             }
  470.             else if(!strcmp(SelectedOperation[playerid], "x"))
  471.             {
  472.                 format(string, sizeof(string), "%.2f", floatstr(InputedWord[playerid]) * floatstr(InputedWord2[playerid]));
  473.                 format(SelectedOperation[playerid], 25, "\0");
  474.                 format(InputedWord[playerid], 24, "%s", string);
  475.                 format(InputedWord2[playerid], 24, "\0");
  476.             }
  477.             else if(!strcmp(SelectedOperation[playerid], "/"))
  478.             {
  479.                 format(string, sizeof(string), "%.2f", floatdiv(floatstr(InputedWord[playerid]), floatstr(InputedWord2[playerid])));
  480.                 format(SelectedOperation[playerid], 25, "\0");
  481.                 format(InputedWord[playerid], 24, "%s", string);
  482.                 format(InputedWord2[playerid], 24, "\0");
  483.             }
  484.         }
  485.        
  486.         if(SelectedCharacter[playerid] == 15 || SelectedCharacter[playerid] == 16) format(string, sizeof(string), "%s", InputedWord[playerid]);
  487.         else format(string, sizeof(string), "%s%s%s", InputedWord[playerid], SelectedOperation[playerid], InputedWord2[playerid]);
  488.         TextDrawSetString(CalculatorTD[playerid][8], string);
  489.         TextDrawShowForPlayer(playerid, CalculatorTD[playerid][8]);
  490.     }
  491.     return 1;
  492. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement