Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <YSI\y_commands>
- #include <YSI\y_timers>
- #define COLOR_KRED 0xFF0000FF
- 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];
- new Timer: CPCK[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n");
- print(" \4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4");
- print(" \4 S32_Calculator \4");
- print(" \4 by \4");
- print(" \4 System32 \4");
- print(" \4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\4\n");
- CalculatorTD2[0] = TextDrawCreate(282.000000, 130.000000, "."); // First white box -
- TextDrawBackgroundColor(CalculatorTD2[0], 255);
- TextDrawFont(CalculatorTD2[0], 1);
- TextDrawLetterSize(CalculatorTD2[0], 0.000000, 0.000000);
- TextDrawColor(CalculatorTD2[0], -1);
- TextDrawSetOutline(CalculatorTD2[0], 0);
- TextDrawSetProportional(CalculatorTD2[0], 1);
- TextDrawSetShadow(CalculatorTD2[0], 1);
- TextDrawUseBox(CalculatorTD2[0], 1);
- TextDrawBoxColor(CalculatorTD2[0], -1);
- TextDrawTextSize(CalculatorTD2[0], 40.000000, -1.000000);
- CalculatorTD2[1] = TextDrawCreate(282.000000, 179.000000, "."); // Second white box -
- TextDrawBackgroundColor(CalculatorTD2[1], 255);
- TextDrawFont(CalculatorTD2[1], 1);
- TextDrawLetterSize(CalculatorTD2[1], 0.000000, 0.000000);
- TextDrawColor(CalculatorTD2[1], -1);
- TextDrawSetOutline(CalculatorTD2[1], 0);
- TextDrawSetProportional(CalculatorTD2[1], 1);
- TextDrawSetShadow(CalculatorTD2[1], 1);
- TextDrawUseBox(CalculatorTD2[1], 1);
- TextDrawBoxColor(CalculatorTD2[1], -1);
- TextDrawTextSize(CalculatorTD2[1], 40.000000, -1.000000);
- CalculatorTD2[2] = TextDrawCreate(282.000000, 111.000000, "."); // First black box -
- TextDrawBackgroundColor(CalculatorTD2[2], 255);
- TextDrawFont(CalculatorTD2[2], 1);
- TextDrawLetterSize(CalculatorTD2[2], 0.000000, 1.805);
- TextDrawColor(CalculatorTD2[2], -1);
- TextDrawSetOutline(CalculatorTD2[2], 0);
- TextDrawSetProportional(CalculatorTD2[2], 1);
- TextDrawSetShadow(CalculatorTD2[2], 1);
- TextDrawUseBox(CalculatorTD2[2], 1);
- TextDrawBoxColor(CalculatorTD2[2], 85);
- TextDrawTextSize(CalculatorTD2[2], 40.000000, 9.000000);
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- YCMD:calculator(playerid, params[], help)
- {
- #pragma unused help
- #pragma unused params
- if(CalculatorOn[playerid] == true)
- {
- CalculatorTD[playerid][0] = TextDrawCreate(51.000000, 132.000000, "0 1 2 3 4 5 6 7 8 9");
- TextDrawBackgroundColor(CalculatorTD[playerid][0], 255);
- TextDrawFont(CalculatorTD[playerid][0], 1);
- TextDrawLetterSize(CalculatorTD[playerid][0], 0.629999, 2.299999);
- TextDrawColor(CalculatorTD[playerid][0], -1);
- TextDrawSetOutline(CalculatorTD[playerid][0], 0);
- TextDrawSetProportional(CalculatorTD[playerid][0], 1);
- TextDrawSetShadow(CalculatorTD[playerid][0], 0);
- CalculatorTD[playerid][1] = TextDrawCreate(51.000000, 152.000000, "+ - x / . A < =");
- TextDrawBackgroundColor(CalculatorTD[playerid][1], 255);
- TextDrawFont(CalculatorTD[playerid][1], 1);
- TextDrawLetterSize(CalculatorTD[playerid][1], 0.629999, 2.299999);
- TextDrawColor(CalculatorTD[playerid][1], -1);
- TextDrawSetOutline(CalculatorTD[playerid][1], 0);
- TextDrawSetProportional(CalculatorTD[playerid][1], 1);
- TextDrawSetShadow(CalculatorTD[playerid][1], 0);
- CalculatorTD[playerid][2] = TextDrawCreate(196.000000, 161.000000, "A");
- TextDrawBackgroundColor(CalculatorTD[playerid][2], 255);
- TextDrawFont(CalculatorTD[playerid][2], 1);
- TextDrawLetterSize(CalculatorTD[playerid][2], 0.500000, 1.000000);
- TextDrawColor(CalculatorTD[playerid][2], -1);
- TextDrawSetOutline(CalculatorTD[playerid][2], 0);
- TextDrawSetProportional(CalculatorTD[playerid][2], 1);
- TextDrawSetShadow(CalculatorTD[playerid][2], 0);
- CalculatorTD[playerid][3] = TextDrawCreate(163.000000, 152.000000, "2");
- TextDrawBackgroundColor(CalculatorTD[playerid][3], 255);
- TextDrawFont(CalculatorTD[playerid][3], 1);
- TextDrawLetterSize(CalculatorTD[playerid][3], 0.500000, 1.000000);
- TextDrawColor(CalculatorTD[playerid][3], -1);
- TextDrawSetOutline(CalculatorTD[playerid][3], 0);
- TextDrawSetProportional(CalculatorTD[playerid][3], 1);
- TextDrawSetShadow(CalculatorTD[playerid][3], 0);
- CalculatorTD[playerid][4] = TextDrawCreate(178.000000, 152.000000, "-");
- TextDrawBackgroundColor(CalculatorTD[playerid][4], 255);
- TextDrawFont(CalculatorTD[playerid][4], 1);
- TextDrawLetterSize(CalculatorTD[playerid][4], 0.629999, 1.799999);
- TextDrawColor(CalculatorTD[playerid][4], -1);
- TextDrawSetOutline(CalculatorTD[playerid][4], 0);
- TextDrawSetProportional(CalculatorTD[playerid][4], 1);
- TextDrawSetShadow(CalculatorTD[playerid][4], 0);
- CalculatorTD[playerid][5] = TextDrawCreate(183.000000, 158.000000, "\\");
- TextDrawBackgroundColor(CalculatorTD[playerid][5], 255);
- TextDrawFont(CalculatorTD[playerid][5], 1);
- TextDrawLetterSize(CalculatorTD[playerid][5], 0.590000, 1.499999);
- TextDrawColor(CalculatorTD[playerid][5], -1);
- TextDrawSetOutline(CalculatorTD[playerid][5], 0);
- TextDrawSetProportional(CalculatorTD[playerid][5], 1);
- TextDrawSetShadow(CalculatorTD[playerid][5], 0);
- CalculatorTD[playerid][6] = TextDrawCreate(189.000000, 150.500000, "/");
- TextDrawBackgroundColor(CalculatorTD[playerid][6], 255);
- TextDrawFont(CalculatorTD[playerid][6], 1);
- TextDrawLetterSize(CalculatorTD[playerid][6], 0.510000, 2.299999);
- TextDrawColor(CalculatorTD[playerid][6], -1);
- TextDrawSetOutline(CalculatorTD[playerid][6], 0);
- TextDrawSetProportional(CalculatorTD[playerid][6], 1);
- TextDrawSetShadow(CalculatorTD[playerid][6], 0);
- CalculatorTD[playerid][7] = TextDrawCreate(193.000000, 145.699996, "-");
- TextDrawBackgroundColor(CalculatorTD[playerid][7], 255);
- TextDrawFont(CalculatorTD[playerid][7], 1);
- TextDrawLetterSize(CalculatorTD[playerid][7], 1.280000, 1.799999);
- TextDrawColor(CalculatorTD[playerid][7], -1);
- TextDrawSetOutline(CalculatorTD[playerid][7], 0);
- TextDrawSetProportional(CalculatorTD[playerid][7], 1);
- TextDrawSetShadow(CalculatorTD[playerid][7], 0);
- CalculatorTD[playerid][8] = TextDrawCreate(49.000000, 112.000000, "0 VALUE");
- TextDrawBackgroundColor(CalculatorTD[playerid][8], 255);
- TextDrawFont(CalculatorTD[playerid][8], 1);
- TextDrawLetterSize(CalculatorTD[playerid][8], 0.539999, 1.400000);
- TextDrawColor(CalculatorTD[playerid][8], -16776961);
- TextDrawSetOutline(CalculatorTD[playerid][8], 0);
- TextDrawSetProportional(CalculatorTD[playerid][8], 1);
- TextDrawSetShadow(CalculatorTD[playerid][8], 1);
- CalculatorOn[playerid] = false;
- for(new td = 0; td <= 7; td++) { TextDrawShowForPlayer(playerid, CalculatorTD[playerid][td]); }
- TextDrawShowForPlayer(playerid, CalculatorTD2[0]);
- TextDrawShowForPlayer(playerid, CalculatorTD2[1]);
- TextDrawShowForPlayer(playerid, CalculatorTD2[2]);
- CPCK[playerid] = repeat CheckPlayerCalculatorKeys(playerid);
- TogglePlayerControllable(playerid, 0);
- }
- else if(CalculatorOn[playerid] == false)
- {
- CalculatorOn[playerid] = true;
- for(new td = 0; td <= 8; td++) { TextDrawHideForPlayer(playerid, CalculatorTD[playerid][td]); TextDrawDestroy(CalculatorTD[playerid][td]); }
- TextDrawHideForPlayer(playerid, CalculatorTD2[0]);
- TextDrawHideForPlayer(playerid, CalculatorTD2[1]);
- TextDrawHideForPlayer(playerid, CalculatorTD2[2]);
- stop CPCK[playerid];
- TogglePlayerControllable(playerid, 1);
- }
- return 1;
- }
- timer CheckPlayerCalculatorKeys[200](playerid)
- {
- new keys, ud, lr;
- GetPlayerKeys(playerid, keys, ud, lr);
- if(lr > 0)
- {
- SelectedCharacter[playerid] ++;
- TextDrawSetString(CalculatorTD[playerid][0], "~w~0 1 2 3 4 5 6 7 8 9");
- TextDrawSetString(CalculatorTD[playerid][1], "~w~+ - x / . A < =");
- TextDrawSetString(CalculatorTD[playerid][2], "~w~A");
- TextDrawSetString(CalculatorTD[playerid][3], "~w~2");
- TextDrawSetString(CalculatorTD[playerid][4], "~w~-");
- TextDrawSetString(CalculatorTD[playerid][5], "~w~\\");
- TextDrawSetString(CalculatorTD[playerid][6], "~w~/");
- TextDrawSetString(CalculatorTD[playerid][7], "~w~-");
- }
- else if(lr < 0)
- {
- SelectedCharacter[playerid] --;
- TextDrawSetString(CalculatorTD[playerid][0], "~w~0 1 2 3 4 5 6 7 8 9");
- TextDrawSetString(CalculatorTD[playerid][1], "~w~+ - x / . A < =");
- TextDrawSetString(CalculatorTD[playerid][2], "~w~A");
- TextDrawSetString(CalculatorTD[playerid][3], "~w~2");
- TextDrawSetString(CalculatorTD[playerid][4], "~w~-");
- TextDrawSetString(CalculatorTD[playerid][5], "~w~\\");
- TextDrawSetString(CalculatorTD[playerid][6], "~w~/");
- TextDrawSetString(CalculatorTD[playerid][7], "~w~-");
- }
- if(SelectedCharacter[playerid] == 0)
- {
- TextDrawSetString(CalculatorTD[playerid][0], "~r~~h~0 ~w~1 2 3 4 5 6 7 8 9");
- }
- else if(SelectedCharacter[playerid] == 1)
- {
- TextDrawSetString(CalculatorTD[playerid][0], "0 ~r~~h~1 ~w~2 3 4 5 6 7 8 9");
- }
- else if(SelectedCharacter[playerid] == 2)
- {
- TextDrawSetString(CalculatorTD[playerid][0], "0 1 ~r~~h~2 ~w~3 4 5 6 7 8 9");
- }
- else if(SelectedCharacter[playerid] == 3)
- {
- TextDrawSetString(CalculatorTD[playerid][0], "0 1 2 ~r~~h~3 ~w~4 5 6 7 8 9");
- }
- else if(SelectedCharacter[playerid] == 4)
- {
- TextDrawSetString(CalculatorTD[playerid][0], "0 1 2 3 ~r~~h~4 ~w~5 6 7 8 9");
- }
- else if(SelectedCharacter[playerid] == 5)
- {
- TextDrawSetString(CalculatorTD[playerid][0], "0 1 2 3 4 ~r~~h~5 ~w~6 7 8 9");
- }
- else if(SelectedCharacter[playerid] == 6)
- {
- TextDrawSetString(CalculatorTD[playerid][0], "0 1 2 3 4 5 ~r~~h~6 ~w~7 8 9");
- }
- else if(SelectedCharacter[playerid] == 7)
- {
- TextDrawSetString(CalculatorTD[playerid][0], "0 1 2 3 4 5 6 ~r~~h~7 ~w~8 9");
- }
- else if(SelectedCharacter[playerid] == 8)
- {
- TextDrawSetString(CalculatorTD[playerid][0], "0 1 2 3 4 5 6 7 ~r~~h~8 ~w~9");
- }
- else if(SelectedCharacter[playerid] == 9)
- {
- TextDrawSetString(CalculatorTD[playerid][0], "0 1 2 3 4 5 6 7 8 ~r~~h~9");
- }
- else if(SelectedCharacter[playerid] == 10)
- {
- TextDrawSetString(CalculatorTD[playerid][1], "~r~~h~+ ~w~- x / . A < =");
- }
- else if(SelectedCharacter[playerid] == 11)
- {
- TextDrawSetString(CalculatorTD[playerid][1], "+ ~r~~h~- ~w~x / . A < =");
- }
- else if(SelectedCharacter[playerid] == 12)
- {
- TextDrawSetString(CalculatorTD[playerid][1], "+ - ~r~~h~x ~w~/ . A < =");
- }
- else if(SelectedCharacter[playerid] == 13)
- {
- TextDrawSetString(CalculatorTD[playerid][1], "+ - x ~r~~h~/ ~w~. A < =");
- }
- else if(SelectedCharacter[playerid] == 14)
- {
- TextDrawSetString(CalculatorTD[playerid][1], "+ - x / ~r~~h~. ~w~A < =");
- }
- else if(SelectedCharacter[playerid] == 15)
- {
- TextDrawSetString(CalculatorTD[playerid][1], "+ - x / . ~r~~h~A ~w~< =");
- TextDrawSetString(CalculatorTD[playerid][3], "~r~~h~2");
- }
- else if(SelectedCharacter[playerid] == 16)
- {
- TextDrawSetString(CalculatorTD[playerid][2], "~r~~h~A");
- TextDrawSetString(CalculatorTD[playerid][4], "~r~~h~-");
- TextDrawSetString(CalculatorTD[playerid][5], "~r~~h~\\");
- TextDrawSetString(CalculatorTD[playerid][6], "~r~~h~/");
- TextDrawSetString(CalculatorTD[playerid][7], "~r~~h~-");
- }
- else if(SelectedCharacter[playerid] == 17)
- {
- TextDrawSetString(CalculatorTD[playerid][1], "+ - x / . A ~r~~h~< ~w~=");
- }
- else if(SelectedCharacter[playerid] == 18)
- {
- TextDrawSetString(CalculatorTD[playerid][1], "+ - x / . A < ~r~~h~=");
- }
- else if(SelectedCharacter[playerid] == 19) SelectedCharacter[playerid] = 0;
- else if(SelectedCharacter[playerid] == -1) SelectedCharacter[playerid] = 18;
- if(ud > 0)
- {
- if(SelectedCharacter[playerid] >= 0 && SelectedCharacter[playerid] <= 9)
- {
- SelectedCharacter[playerid] = SelectedCharacter[playerid] + 10;
- TextDrawSetString(CalculatorTD[playerid][0], "~w~0 1 2 3 4 5 6 7 8 9");
- TextDrawSetString(CalculatorTD[playerid][1], "~w~+ - x / . A < =");
- TextDrawSetString(CalculatorTD[playerid][2], "~w~A");
- TextDrawSetString(CalculatorTD[playerid][3], "~w~2");
- TextDrawSetString(CalculatorTD[playerid][4], "~w~-");
- TextDrawSetString(CalculatorTD[playerid][5], "~w~\\");
- TextDrawSetString(CalculatorTD[playerid][6], "~w~/");
- TextDrawSetString(CalculatorTD[playerid][7], "~w~-");
- }
- else if(SelectedCharacter[playerid] >= 10)
- {
- SelectedCharacter[playerid] = SelectedCharacter[playerid] - 10;
- TextDrawSetString(CalculatorTD[playerid][0], "~w~0 1 2 3 4 5 6 7 8 9");
- TextDrawSetString(CalculatorTD[playerid][1], "~w~+ - x / . A < =");
- TextDrawSetString(CalculatorTD[playerid][2], "~w~A");
- TextDrawSetString(CalculatorTD[playerid][3], "~w~2");
- TextDrawSetString(CalculatorTD[playerid][4], "~w~-");
- TextDrawSetString(CalculatorTD[playerid][5], "~w~\\");
- TextDrawSetString(CalculatorTD[playerid][6], "~w~/");
- TextDrawSetString(CalculatorTD[playerid][7], "~w~-");
- }
- printf("Char: %d", SelectedCharacter[playerid]);
- }
- if(ud < 0)
- {
- if(SelectedCharacter[playerid] >= 0 && SelectedCharacter[playerid] <= 9)
- {
- SelectedCharacter[playerid] = SelectedCharacter[playerid] + 10;
- TextDrawSetString(CalculatorTD[playerid][0], "~w~0 1 2 3 4 5 6 7 8 9");
- TextDrawSetString(CalculatorTD[playerid][1], "~w~+ - x / . A < =");
- TextDrawSetString(CalculatorTD[playerid][2], "~w~A");
- TextDrawSetString(CalculatorTD[playerid][3], "~w~2");
- TextDrawSetString(CalculatorTD[playerid][4], "~w~-");
- TextDrawSetString(CalculatorTD[playerid][5], "~w~\\");
- TextDrawSetString(CalculatorTD[playerid][6], "~w~/");
- TextDrawSetString(CalculatorTD[playerid][7], "~w~-");
- }
- else if(SelectedCharacter[playerid] >= 10)
- {
- SelectedCharacter[playerid] = SelectedCharacter[playerid] - 10;
- TextDrawSetString(CalculatorTD[playerid][0], "~w~0 1 2 3 4 5 6 7 8 9");
- TextDrawSetString(CalculatorTD[playerid][1], "~w~+ - x / . A < =");
- TextDrawSetString(CalculatorTD[playerid][2], "~w~A");
- TextDrawSetString(CalculatorTD[playerid][3], "~w~2");
- TextDrawSetString(CalculatorTD[playerid][4], "~w~-");
- TextDrawSetString(CalculatorTD[playerid][5], "~w~\\");
- TextDrawSetString(CalculatorTD[playerid][6], "~w~/");
- TextDrawSetString(CalculatorTD[playerid][7], "~w~-");
- }
- printf("Char: %d", SelectedCharacter[playerid]);
- }
- if(keys == KEY_SECONDARY_ATTACK)
- {
- if(SelectedCharacter[playerid] == 0)
- {
- if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "0");
- else strcat(InputedWord2[playerid], "0");
- }
- else if(SelectedCharacter[playerid] == 1)
- {
- if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "1");
- else strcat(InputedWord2[playerid], "1");
- }
- else if(SelectedCharacter[playerid] == 2)
- {
- if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "2");
- else strcat(InputedWord2[playerid], "2");
- }
- else if(SelectedCharacter[playerid] == 3)
- {
- if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "3");
- else strcat(InputedWord2[playerid], "3");
- }
- else if(SelectedCharacter[playerid] == 4)
- {
- if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "4");
- else strcat(InputedWord2[playerid], "4");
- }
- else if(SelectedCharacter[playerid] == 5)
- {
- if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "5");
- else strcat(InputedWord2[playerid], "5");
- }
- else if(SelectedCharacter[playerid] == 6)
- {
- if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "6");
- else strcat(InputedWord2[playerid], "6");
- }
- else if(SelectedCharacter[playerid] == 7)
- {
- if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "7");
- else strcat(InputedWord2[playerid], "7");
- }
- else if(SelectedCharacter[playerid] == 8)
- {
- if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "8");
- else strcat(InputedWord2[playerid], "8");
- }
- else if(SelectedCharacter[playerid] == 9)
- {
- if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], "9");
- else strcat(InputedWord2[playerid], "9");
- }
- else if(SelectedCharacter[playerid] == 10)
- {
- if(!isnull(SelectedOperation[playerid])) return SendClientMessage(playerid, COLOR_KRED, "Operation is already choosed!");
- format(SelectedOperation[playerid], 25, "+");
- }
- else if(SelectedCharacter[playerid] == 11)
- {
- if(!isnull(SelectedOperation[playerid])) return SendClientMessage(playerid, COLOR_KRED, "Operation is already choosed!");
- format(SelectedOperation[playerid], 25, "-");
- }
- else if(SelectedCharacter[playerid] == 12)
- {
- if(!isnull(SelectedOperation[playerid])) return SendClientMessage(playerid, COLOR_KRED, "Operation is already choosed!");
- format(SelectedOperation[playerid], 25, "x");
- }
- else if(SelectedCharacter[playerid] == 13)
- {
- if(!isnull(SelectedOperation[playerid])) return SendClientMessage(playerid, COLOR_KRED, "Operation is already choosed!");
- format(SelectedOperation[playerid], 25, "/");
- }
- else if(SelectedCharacter[playerid] == 14)
- {
- if(isnull(SelectedOperation[playerid])) strcat(InputedWord[playerid], ".");
- else strcat(InputedWord2[playerid], ".");
- }
- else if(SelectedCharacter[playerid] == 15)
- {
- if(isnull(InputedWord[playerid])) return SendClientMessage(playerid, COLOR_KRED, "You didn't choosed the number!");
- format(string, sizeof(string), "%.2f", floatstr(InputedWord[playerid]) * floatstr(InputedWord[playerid]));
- format(SelectedOperation[playerid], 25, "\0");
- format(InputedWord[playerid], 24, "%s", string);
- }
- else if(SelectedCharacter[playerid] == 16)
- {
- if(isnull(InputedWord[playerid])) return SendClientMessage(playerid, COLOR_KRED, "You didn't choosed the number!");
- format(string, sizeof(string), "%.2f", floatsqroot(floatstr(InputedWord[playerid])));
- format(SelectedOperation[playerid], 25, "\0");
- format(InputedWord[playerid], 24, "%s", string);
- }
- else if(SelectedCharacter[playerid] == 17)
- {
- if(!isnull(SelectedOperation[playerid]))
- {
- if(!isnull(InputedWord2[playerid])) strdel(InputedWord2[playerid], (strlen(InputedWord2[playerid]) - 1), strlen(InputedWord2[playerid]));
- else
- {
- strdel(SelectedOperation[playerid], (strlen(SelectedOperation[playerid]) - 1), strlen(SelectedOperation[playerid]));
- format(SelectedOperation[playerid], 25, "\0");
- }
- }
- else strdel(InputedWord[playerid], (strlen(InputedWord[playerid]) - 1), strlen(InputedWord[playerid]));
- }
- else if(SelectedCharacter[playerid] == 18)
- {
- if(isnull(InputedWord[playerid])) return SendClientMessage(playerid, COLOR_KRED, "You didn't choosed first number!");
- if(isnull(SelectedOperation[playerid])) return SendClientMessage(playerid, COLOR_KRED, "You didn't choosed operation!");
- if(isnull(InputedWord2[playerid])) return SendClientMessage(playerid, COLOR_KRED, "You didn't choosed second number!");
- if(!strcmp(SelectedOperation[playerid], "+"))
- {
- format(string, sizeof(string), "%.2f", floatstr(InputedWord[playerid]) + floatstr(InputedWord2[playerid]));
- format(SelectedOperation[playerid], 25, "\0");
- format(InputedWord[playerid], 24, "%s", string);
- format(InputedWord2[playerid], 24, "\0");
- }
- else if(!strcmp(SelectedOperation[playerid], "-"))
- {
- format(string, sizeof(string), "%.2f", floatstr(InputedWord[playerid]) - floatstr(InputedWord2[playerid]));
- format(SelectedOperation[playerid], 25, "\0");
- format(InputedWord[playerid], 24, "%s", string);
- format(InputedWord2[playerid], 24, "\0");
- }
- else if(!strcmp(SelectedOperation[playerid], "x"))
- {
- format(string, sizeof(string), "%.2f", floatstr(InputedWord[playerid]) * floatstr(InputedWord2[playerid]));
- format(SelectedOperation[playerid], 25, "\0");
- format(InputedWord[playerid], 24, "%s", string);
- format(InputedWord2[playerid], 24, "\0");
- }
- else if(!strcmp(SelectedOperation[playerid], "/"))
- {
- format(string, sizeof(string), "%.2f", floatdiv(floatstr(InputedWord[playerid]), floatstr(InputedWord2[playerid])));
- format(SelectedOperation[playerid], 25, "\0");
- format(InputedWord[playerid], 24, "%s", string);
- format(InputedWord2[playerid], 24, "\0");
- }
- }
- if(SelectedCharacter[playerid] == 15 || SelectedCharacter[playerid] == 16) format(string, sizeof(string), "%s", InputedWord[playerid]);
- else format(string, sizeof(string), "%s%s%s", InputedWord[playerid], SelectedOperation[playerid], InputedWord2[playerid]);
- TextDrawSetString(CalculatorTD[playerid][8], string);
- TextDrawShowForPlayer(playerid, CalculatorTD[playerid][8]);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement