Advertisement
adri1

Basic TextDraw Calculator. BY ADRI1

Nov 10th, 2012
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 18.57 KB | None | 0 0
  1. //BY ADRI1
  2. #include <a_samp>
  3. new Text:CalculatorTD[18];
  4. new PlayerText:CalculatorTD2;
  5. new var1[MAX_PLAYERS][20];
  6. new var2[MAX_PLAYERS][20];
  7. public OnFilterScriptInit()
  8. {
  9.     CalculatorTD[0] = TextDrawCreate(499.000000, 253.000000, "_");
  10.     TextDrawBackgroundColor(CalculatorTD[0], 255);
  11.     TextDrawFont(CalculatorTD[0], 1);
  12.     TextDrawLetterSize(CalculatorTD[0], 0.500000, 18.699998);
  13.     TextDrawColor(CalculatorTD[0], -1);
  14.     TextDrawSetOutline(CalculatorTD[0], 0);
  15.     TextDrawSetProportional(CalculatorTD[0], 1);
  16.     TextDrawSetShadow(CalculatorTD[0], 1);
  17.     TextDrawUseBox(CalculatorTD[0], 1);
  18.     TextDrawBoxColor(CalculatorTD[0], 255);
  19.     TextDrawTextSize(CalculatorTD[0], 605.000000, 10.000000);
  20.     TextDrawSetSelectable(CalculatorTD[0], 0);
  21.  
  22.     CalculatorTD[1] = TextDrawCreate(508.000000, 282.000000, "_");
  23.     TextDrawBackgroundColor(CalculatorTD[1], 255);
  24.     TextDrawFont(CalculatorTD[1], 1);
  25.     TextDrawLetterSize(CalculatorTD[1], 0.500000, 2.599998);
  26.     TextDrawColor(CalculatorTD[1], -1);
  27.     TextDrawSetOutline(CalculatorTD[1], 0);
  28.     TextDrawSetProportional(CalculatorTD[1], 1);
  29.     TextDrawSetShadow(CalculatorTD[1], 1);
  30.     TextDrawUseBox(CalculatorTD[1], 1);
  31.     TextDrawBoxColor(CalculatorTD[1], 842150655);
  32.     TextDrawTextSize(CalculatorTD[1], 595.000000, -20.000000);
  33.     TextDrawSetSelectable(CalculatorTD[1], 0);
  34.  
  35.     CalculatorTD[2] = TextDrawCreate(550.000000, 259.000000, "CALCULATOR");
  36.     TextDrawAlignment(CalculatorTD[2], 2);
  37.     TextDrawBackgroundColor(CalculatorTD[2], 255);
  38.     TextDrawFont(CalculatorTD[2], 1);
  39.     TextDrawLetterSize(CalculatorTD[2], 0.370000, 1.400000);
  40.     TextDrawColor(CalculatorTD[2], -1);
  41.     TextDrawSetOutline(CalculatorTD[2], 0);
  42.     TextDrawSetProportional(CalculatorTD[2], 1);
  43.     TextDrawSetShadow(CalculatorTD[2], 0);
  44.     TextDrawSetSelectable(CalculatorTD[2], 0);
  45.  
  46.     CalculatorTD[3] = TextDrawCreate(515.000000, 333.000000, "7");
  47.     TextDrawAlignment(CalculatorTD[3], 2);
  48.     TextDrawBackgroundColor(CalculatorTD[3], 255);
  49.     TextDrawFont(CalculatorTD[3], 1);
  50.     TextDrawLetterSize(CalculatorTD[3], 0.340000, 1.100000);
  51.     TextDrawColor(CalculatorTD[3], -1);
  52.     TextDrawSetOutline(CalculatorTD[3], 0);
  53.     TextDrawSetProportional(CalculatorTD[3], 1);
  54.     TextDrawSetShadow(CalculatorTD[3], 0);
  55.     TextDrawUseBox(CalculatorTD[3], 1);
  56.     TextDrawBoxColor(CalculatorTD[3], 842150655);
  57.     TextDrawTextSize(CalculatorTD[3], 10.000000, 10.000000);
  58.     TextDrawSetSelectable(CalculatorTD[3], 1);
  59.  
  60.     CalculatorTD[4] = TextDrawCreate(536.000000, 333.000000, "8");
  61.     TextDrawAlignment(CalculatorTD[4], 2);
  62.     TextDrawBackgroundColor(CalculatorTD[4], 255);
  63.     TextDrawFont(CalculatorTD[4], 1);
  64.     TextDrawLetterSize(CalculatorTD[4], 0.340000, 1.100000);
  65.     TextDrawColor(CalculatorTD[4], -1);
  66.     TextDrawSetOutline(CalculatorTD[4], 0);
  67.     TextDrawSetProportional(CalculatorTD[4], 1);
  68.     TextDrawSetShadow(CalculatorTD[4], 0);
  69.     TextDrawUseBox(CalculatorTD[4], 1);
  70.     TextDrawBoxColor(CalculatorTD[4], 842150655);
  71.     TextDrawTextSize(CalculatorTD[4], 10.000000, 10.000000);
  72.     TextDrawSetSelectable(CalculatorTD[4], 1);
  73.    
  74.     CalculatorTD[5] = TextDrawCreate(557.000000, 333.000000, "9");
  75.     TextDrawAlignment(CalculatorTD[5], 2);
  76.     TextDrawBackgroundColor(CalculatorTD[5], 255);
  77.     TextDrawFont(CalculatorTD[5], 1);
  78.     TextDrawLetterSize(CalculatorTD[5], 0.340000, 1.100000);
  79.     TextDrawColor(CalculatorTD[5], -1);
  80.     TextDrawSetOutline(CalculatorTD[5], 0);
  81.     TextDrawSetProportional(CalculatorTD[5], 1);
  82.     TextDrawSetShadow(CalculatorTD[5], 0);
  83.     TextDrawUseBox(CalculatorTD[5], 1);
  84.     TextDrawBoxColor(CalculatorTD[5], 842150655);
  85.     TextDrawTextSize(CalculatorTD[5], 10.000000, 10.000000);
  86.     TextDrawSetSelectable(CalculatorTD[5], 1);
  87.  
  88.     CalculatorTD[6] = TextDrawCreate(588.000000, 333.000000, "/");
  89.     TextDrawAlignment(CalculatorTD[6], 2);
  90.     TextDrawBackgroundColor(CalculatorTD[6], 255);
  91.     TextDrawFont(CalculatorTD[6], 1);
  92.     TextDrawLetterSize(CalculatorTD[6], 0.340000, 1.100000);
  93.     TextDrawColor(CalculatorTD[6], -1);
  94.     TextDrawSetOutline(CalculatorTD[6], 0);
  95.     TextDrawSetProportional(CalculatorTD[6], 1);
  96.     TextDrawSetShadow(CalculatorTD[6], 0);
  97.     TextDrawUseBox(CalculatorTD[6], 1);
  98.     TextDrawBoxColor(CalculatorTD[6], 842150655);
  99.     TextDrawTextSize(CalculatorTD[6], 10.000000, 10.000000);
  100.     TextDrawSetSelectable(CalculatorTD[6], 1);
  101.  
  102.     CalculatorTD[7] = TextDrawCreate(588.000000, 355.000000, "X");
  103.     TextDrawAlignment(CalculatorTD[7], 2);
  104.     TextDrawBackgroundColor(CalculatorTD[7], 255);
  105.     TextDrawFont(CalculatorTD[7], 1);
  106.     TextDrawLetterSize(CalculatorTD[7], 0.340000, 1.100000);
  107.     TextDrawColor(CalculatorTD[7], -1);
  108.     TextDrawSetOutline(CalculatorTD[7], 0);
  109.     TextDrawSetProportional(CalculatorTD[7], 1);
  110.     TextDrawSetShadow(CalculatorTD[7], 0);
  111.     TextDrawUseBox(CalculatorTD[7], 1);
  112.     TextDrawBoxColor(CalculatorTD[7], 842150655);
  113.     TextDrawTextSize(CalculatorTD[7], 10.000000, 10.000000);
  114.     TextDrawSetSelectable(CalculatorTD[7], 1);
  115.  
  116.     CalculatorTD[8] = TextDrawCreate(588.000000, 377.000000, "-");
  117.     TextDrawAlignment(CalculatorTD[8], 2);
  118.     TextDrawBackgroundColor(CalculatorTD[8], 255);
  119.     TextDrawFont(CalculatorTD[8], 1);
  120.     TextDrawLetterSize(CalculatorTD[8], 0.340000, 1.100000);
  121.     TextDrawColor(CalculatorTD[8], -1);
  122.     TextDrawSetOutline(CalculatorTD[8], 0);
  123.     TextDrawSetProportional(CalculatorTD[8], 1);
  124.     TextDrawSetShadow(CalculatorTD[8], 0);
  125.     TextDrawUseBox(CalculatorTD[8], 1);
  126.     TextDrawBoxColor(CalculatorTD[8], 842150655);
  127.     TextDrawTextSize(CalculatorTD[8], 10.000000, 10.000000);
  128.     TextDrawSetSelectable(CalculatorTD[8], 1);
  129.    
  130.     CalculatorTD[9] = TextDrawCreate(588.000000, 399.000000, "+");
  131.     TextDrawAlignment(CalculatorTD[9], 2);
  132.     TextDrawBackgroundColor(CalculatorTD[9], 255);
  133.     TextDrawFont(CalculatorTD[9], 1);
  134.     TextDrawLetterSize(CalculatorTD[9], 0.340000, 1.100000);
  135.     TextDrawColor(CalculatorTD[9], -1);
  136.     TextDrawSetOutline(CalculatorTD[9], 0);
  137.     TextDrawSetProportional(CalculatorTD[9], 1);
  138.     TextDrawSetShadow(CalculatorTD[9], 0);
  139.     TextDrawUseBox(CalculatorTD[9], 1);
  140.     TextDrawBoxColor(CalculatorTD[9], 842150655);
  141.     TextDrawTextSize(CalculatorTD[9], 10.000000, 10.000000);
  142.     TextDrawSetSelectable(CalculatorTD[9], 1);
  143.  
  144.     CalculatorTD[10] = TextDrawCreate(557.000000, 355.000000, "6");
  145.     TextDrawAlignment(CalculatorTD[10], 2);
  146.     TextDrawBackgroundColor(CalculatorTD[10], 255);
  147.     TextDrawFont(CalculatorTD[10], 1);
  148.     TextDrawLetterSize(CalculatorTD[10], 0.340000, 1.100000);
  149.     TextDrawColor(CalculatorTD[10], -1);
  150.     TextDrawSetOutline(CalculatorTD[10], 0);
  151.     TextDrawSetProportional(CalculatorTD[10], 1);
  152.     TextDrawSetShadow(CalculatorTD[10], 0);
  153.     TextDrawUseBox(CalculatorTD[10], 1);
  154.     TextDrawBoxColor(CalculatorTD[10], 842150655);
  155.     TextDrawTextSize(CalculatorTD[10], 10.000000, 10.000000);
  156.     TextDrawSetSelectable(CalculatorTD[10], 1);
  157.  
  158.     CalculatorTD[11] = TextDrawCreate(536.000000, 355.000000, "5");
  159.     TextDrawAlignment(CalculatorTD[11], 2);
  160.     TextDrawBackgroundColor(CalculatorTD[11], 255);
  161.     TextDrawFont(CalculatorTD[11], 1);
  162.     TextDrawLetterSize(CalculatorTD[11], 0.340000, 1.100000);
  163.     TextDrawColor(CalculatorTD[11], -1);
  164.     TextDrawSetOutline(CalculatorTD[11], 0);
  165.     TextDrawSetProportional(CalculatorTD[11], 1);
  166.     TextDrawSetShadow(CalculatorTD[11], 0);
  167.     TextDrawUseBox(CalculatorTD[11], 1);
  168.     TextDrawBoxColor(CalculatorTD[11], 842150655);
  169.     TextDrawTextSize(CalculatorTD[11], 10.000000, 10.000000);
  170.     TextDrawSetSelectable(CalculatorTD[11], 1);
  171.  
  172.     CalculatorTD[12] = TextDrawCreate(515.000000, 355.000000, "4");
  173.     TextDrawAlignment(CalculatorTD[12], 2);
  174.     TextDrawBackgroundColor(CalculatorTD[12], 255);
  175.     TextDrawFont(CalculatorTD[12], 1);
  176.     TextDrawLetterSize(CalculatorTD[12], 0.340000, 1.100000);
  177.     TextDrawColor(CalculatorTD[12], -1);
  178.     TextDrawSetOutline(CalculatorTD[12], 0);
  179.     TextDrawSetProportional(CalculatorTD[12], 1);
  180.     TextDrawSetShadow(CalculatorTD[12], 0);
  181.     TextDrawUseBox(CalculatorTD[12], 1);
  182.     TextDrawBoxColor(CalculatorTD[12], 842150655);
  183.     TextDrawTextSize(CalculatorTD[12], 10.000000, 10.000000);
  184.     TextDrawSetSelectable(CalculatorTD[12], 1);
  185.  
  186.     CalculatorTD[13] = TextDrawCreate(515.000000, 377.000000, "1");
  187.     TextDrawAlignment(CalculatorTD[13], 2);
  188.     TextDrawBackgroundColor(CalculatorTD[13], 255);
  189.     TextDrawFont(CalculatorTD[13], 1);
  190.     TextDrawLetterSize(CalculatorTD[13], 0.340000, 1.100000);
  191.     TextDrawColor(CalculatorTD[13], -1);
  192.     TextDrawSetOutline(CalculatorTD[13], 0);
  193.     TextDrawSetProportional(CalculatorTD[13], 1);
  194.     TextDrawSetShadow(CalculatorTD[13], 0);
  195.     TextDrawUseBox(CalculatorTD[13], 1);
  196.     TextDrawBoxColor(CalculatorTD[13], 842150655);
  197.     TextDrawTextSize(CalculatorTD[13], 10.000000, 10.000000);
  198.     TextDrawSetSelectable(CalculatorTD[13], 1);
  199.  
  200.     CalculatorTD[14] = TextDrawCreate(536.000000, 377.000000, "2");
  201.     TextDrawAlignment(CalculatorTD[14], 2);
  202.     TextDrawBackgroundColor(CalculatorTD[14], 255);
  203.     TextDrawFont(CalculatorTD[14], 1);
  204.     TextDrawLetterSize(CalculatorTD[14], 0.340000, 1.100000);
  205.     TextDrawColor(CalculatorTD[14], -1);
  206.     TextDrawSetOutline(CalculatorTD[14], 0);
  207.     TextDrawSetProportional(CalculatorTD[14], 1);
  208.     TextDrawSetShadow(CalculatorTD[14], 0);
  209.     TextDrawUseBox(CalculatorTD[14], 1);
  210.     TextDrawBoxColor(CalculatorTD[14], 842150655);
  211.     TextDrawTextSize(CalculatorTD[14], 10.000000, 10.000000);
  212.     TextDrawSetSelectable(CalculatorTD[14], 1);
  213.  
  214.     CalculatorTD[15] = TextDrawCreate(557.000000, 377.000000, "3");
  215.     TextDrawAlignment(CalculatorTD[15], 2);
  216.     TextDrawBackgroundColor(CalculatorTD[15], 255);
  217.     TextDrawFont(CalculatorTD[15], 1);
  218.     TextDrawLetterSize(CalculatorTD[15], 0.340000, 1.100000);
  219.     TextDrawColor(CalculatorTD[15], -1);
  220.     TextDrawSetOutline(CalculatorTD[15], 0);
  221.     TextDrawSetProportional(CalculatorTD[15], 1);
  222.     TextDrawSetShadow(CalculatorTD[15], 0);
  223.     TextDrawUseBox(CalculatorTD[15], 1);
  224.     TextDrawBoxColor(CalculatorTD[15], 842150655);
  225.     TextDrawTextSize(CalculatorTD[15], 10.000000, 10.000000);
  226.     TextDrawSetSelectable(CalculatorTD[15], 1);
  227.  
  228.     CalculatorTD[16] = TextDrawCreate(515.000000, 399.000000, "0");
  229.     TextDrawAlignment(CalculatorTD[16], 2);
  230.     TextDrawBackgroundColor(CalculatorTD[16], 255);
  231.     TextDrawFont(CalculatorTD[16], 1);
  232.     TextDrawLetterSize(CalculatorTD[16], 0.340000, 1.100000);
  233.     TextDrawColor(CalculatorTD[16], -1);
  234.     TextDrawSetOutline(CalculatorTD[16], 0);
  235.     TextDrawSetProportional(CalculatorTD[16], 1);
  236.     TextDrawSetShadow(CalculatorTD[16], 0);
  237.     TextDrawUseBox(CalculatorTD[16], 1);
  238.     TextDrawBoxColor(CalculatorTD[16], 842150655);
  239.     TextDrawTextSize(CalculatorTD[16], 10,10);
  240.     TextDrawSetSelectable(CalculatorTD[16], 1);
  241.  
  242.     CalculatorTD[17] = TextDrawCreate(546.000000, 399.000000, "=");
  243.     TextDrawAlignment(CalculatorTD[17], 2);
  244.     TextDrawBackgroundColor(CalculatorTD[17], 255);
  245.     TextDrawFont(CalculatorTD[17], 1);
  246.     TextDrawLetterSize(CalculatorTD[17], 0.340000, 1.100000);
  247.     TextDrawColor(CalculatorTD[17], -1);
  248.     TextDrawSetOutline(CalculatorTD[17], 0);
  249.     TextDrawSetProportional(CalculatorTD[17], 1);
  250.     TextDrawSetShadow(CalculatorTD[17], 0);
  251.     TextDrawUseBox(CalculatorTD[17], 1);
  252.     TextDrawBoxColor(CalculatorTD[17], 842150655);
  253.     TextDrawTextSize(CalculatorTD[17], 10.000000, 35.000000);
  254.     TextDrawSetSelectable(CalculatorTD[17], 1);
  255.     return 1;
  256. }
  257. public OnPlayerConnect(playerid)
  258. {
  259.     CalculatorTD2 = CreatePlayerTextDraw(playerid,595.000000, 287.000000, "_");
  260.     PlayerTextDrawAlignment(playerid,CalculatorTD2, 3);
  261.     PlayerTextDrawBackgroundColor(playerid,CalculatorTD2, 255);
  262.     PlayerTextDrawFont(playerid,CalculatorTD2, 2);
  263.     PlayerTextDrawLetterSize(playerid,CalculatorTD2, 0.320000, 2.000000);
  264.     PlayerTextDrawColor(playerid,CalculatorTD2, -1);
  265.     PlayerTextDrawSetOutline(playerid,CalculatorTD2, 0);
  266.     PlayerTextDrawSetProportional(playerid,CalculatorTD2, 1);
  267.     PlayerTextDrawSetShadow(playerid,CalculatorTD2, 0);
  268.     PlayerTextDrawSetSelectable(playerid,CalculatorTD2, 0);
  269.     return 1;
  270. }
  271. public OnPlayerDisconnect(playerid, reason)
  272. {
  273.     PlayerTextDrawDestroy(playerid,CalculatorTD2);
  274.     return 1;
  275. }
  276. public OnPlayerCommandText(playerid, cmdtext[])
  277. {
  278.     if (strcmp("/calculator", cmdtext, true, 10) == 0)
  279.     {
  280.         if(!GetPVarInt(playerid,"calcular"))
  281.         {
  282.             for(new i = 0; i < 18; i++) TextDrawShowForPlayer(playerid,CalculatorTD[i]);
  283.             PlayerTextDrawShow(playerid,CalculatorTD2);
  284.             SelectTextDraw(playerid,0x33AA33AA);
  285.             SetPVarInt(playerid,"calcular",1);
  286.         }
  287.         else
  288.         {
  289.             PlayerTextDrawSetString(playerid,CalculatorTD2,"");
  290.             for(new i = 0; i < 18; i++) TextDrawHideForPlayer(playerid,CalculatorTD[i]);
  291.             PlayerTextDrawHide(playerid,CalculatorTD2);
  292.             CancelSelectTextDraw(playerid);
  293.             DeletePVar(playerid,"calcular");
  294.             var1[playerid] = "";
  295.             var2[playerid] = "";
  296.             DeletePVar(playerid,"calcu");
  297.             DeletePVar(playerid,"cuen");
  298.             DeletePVar(playerid,"tovar");
  299.         }
  300.         return 1;
  301.     }
  302.     return 0;
  303. }
  304. public OnPlayerClickTextDraw(playerid, Text:clickedid)
  305. {
  306.     if(clickedid == CalculatorTD[3])
  307.     {
  308.         if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"7"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
  309.         if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"7"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
  310.     }
  311.     if(clickedid == CalculatorTD[4])
  312.     {
  313.         if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"8"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
  314.         if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"8"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
  315.     }
  316.     if(clickedid == CalculatorTD[5])
  317.     {
  318.         if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"9"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
  319.         if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"9"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
  320.     }
  321.     if(clickedid == CalculatorTD[6])
  322.     {
  323.         if(GetPVarInt(playerid,"calcu") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"ERROR"),DeletePVar(playerid,"calcu");
  324.         if(!GetPVarInt(playerid,"calcu")) if(GetPVarInt(playerid,"tovar") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"/"),SetPVarInt(playerid,"calcu",1),SetPVarInt(playerid,"cuen",1);
  325.     }
  326.     if(clickedid == CalculatorTD[7])
  327.     {
  328.         if(GetPVarInt(playerid,"calcu") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"ERROR"),DeletePVar(playerid,"calcu");
  329.         if(!GetPVarInt(playerid,"calcu")) if(GetPVarInt(playerid,"tovar") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"X"),SetPVarInt(playerid,"calcu",1),SetPVarInt(playerid,"cuen",2);
  330.     }
  331.     if(clickedid == CalculatorTD[8])
  332.     {
  333.         if(GetPVarInt(playerid,"calcu") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"ERROR"),DeletePVar(playerid,"calcu");
  334.         if(!GetPVarInt(playerid,"calcu")) if(GetPVarInt(playerid,"tovar") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"-"),SetPVarInt(playerid,"calcu",1),SetPVarInt(playerid,"cuen",3);
  335.     }
  336.     if(clickedid == CalculatorTD[9])
  337.     {
  338.         if(GetPVarInt(playerid,"calcu") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"ERROR"),DeletePVar(playerid,"calcu");
  339.         if(!GetPVarInt(playerid,"calcu")) if(GetPVarInt(playerid,"tovar") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"+"),SetPVarInt(playerid,"calcu",1),SetPVarInt(playerid,"cuen",4);
  340.     }
  341.     if(clickedid == CalculatorTD[10])
  342.     {
  343.         if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"6"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
  344.         if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"6"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
  345.     }
  346.     if(clickedid == CalculatorTD[11])
  347.     {
  348.         if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"5"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
  349.         if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"5"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
  350.     }
  351.     if(clickedid == CalculatorTD[12])
  352.     {
  353.         if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"4"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
  354.         if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"4"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
  355.     }
  356.     if(clickedid == CalculatorTD[13])
  357.     {
  358.         if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"1"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
  359.         if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"1"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
  360.     }
  361.     if(clickedid == CalculatorTD[14])
  362.     {
  363.         if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"2"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
  364.         if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"2"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
  365.     }
  366.     if(clickedid == CalculatorTD[15])
  367.     {
  368.         if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"3"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
  369.         if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"3"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
  370.     }
  371.     if(clickedid == CalculatorTD[16])
  372.     {
  373.         if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"0"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
  374.         if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"0"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
  375.     }
  376.     if(clickedid == CalculatorTD[17])
  377.     {
  378.         if(!GetPVarInt(playerid,"calcu"))
  379.         {
  380.             PlayerTextDrawSetString(playerid,CalculatorTD2,"ERROR");
  381.             var1[playerid] = "";
  382.             var2[playerid] = "";
  383.             DeletePVar(playerid,"calcu");
  384.             DeletePVar(playerid,"cuen");
  385.             DeletePVar(playerid,"tovar");
  386.         }
  387.         if(GetPVarInt(playerid,"calcu") == 1)
  388.         {
  389.             new str[64],nu1,nu2;
  390.             nu1 = strval(var1[playerid]);
  391.             nu2 = strval(var2[playerid]);
  392.             if(GetPVarInt(playerid,"cuen") == 1)
  393.             {
  394.                 format(str,sizeof(str),"%d",nu1/nu2);
  395.                 PlayerTextDrawSetString(playerid,CalculatorTD2,str);
  396.             }
  397.             else if(GetPVarInt(playerid,"cuen") == 2)
  398.             {
  399.                 format(str,sizeof(str),"%d",nu1*nu2);
  400.                 PlayerTextDrawSetString(playerid,CalculatorTD2,str);
  401.             }
  402.             else if(GetPVarInt(playerid,"cuen") == 3)
  403.             {
  404.                 format(str,sizeof(str),"%d",nu1-nu2);
  405.                 PlayerTextDrawSetString(playerid,CalculatorTD2,str);
  406.             }
  407.             else if(GetPVarInt(playerid,"cuen") == 4)
  408.             {
  409.                 format(str,sizeof(str),"%d",nu1+nu2);
  410.                 PlayerTextDrawSetString(playerid,CalculatorTD2,str);
  411.             }
  412.             var1[playerid] = "";
  413.             var2[playerid] = "";
  414.             DeletePVar(playerid,"calcu");
  415.             DeletePVar(playerid,"cuen");
  416.             DeletePVar(playerid,"tovar");
  417.         }
  418.     }
  419.     return 1;
  420. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement