Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //BY ADRI1
- #include <a_samp>
- new Text:CalculatorTD[18];
- new PlayerText:CalculatorTD2;
- new var1[MAX_PLAYERS][20];
- new var2[MAX_PLAYERS][20];
- public OnFilterScriptInit()
- {
- CalculatorTD[0] = TextDrawCreate(499.000000, 253.000000, "_");
- TextDrawBackgroundColor(CalculatorTD[0], 255);
- TextDrawFont(CalculatorTD[0], 1);
- TextDrawLetterSize(CalculatorTD[0], 0.500000, 18.699998);
- TextDrawColor(CalculatorTD[0], -1);
- TextDrawSetOutline(CalculatorTD[0], 0);
- TextDrawSetProportional(CalculatorTD[0], 1);
- TextDrawSetShadow(CalculatorTD[0], 1);
- TextDrawUseBox(CalculatorTD[0], 1);
- TextDrawBoxColor(CalculatorTD[0], 255);
- TextDrawTextSize(CalculatorTD[0], 605.000000, 10.000000);
- TextDrawSetSelectable(CalculatorTD[0], 0);
- CalculatorTD[1] = TextDrawCreate(508.000000, 282.000000, "_");
- TextDrawBackgroundColor(CalculatorTD[1], 255);
- TextDrawFont(CalculatorTD[1], 1);
- TextDrawLetterSize(CalculatorTD[1], 0.500000, 2.599998);
- TextDrawColor(CalculatorTD[1], -1);
- TextDrawSetOutline(CalculatorTD[1], 0);
- TextDrawSetProportional(CalculatorTD[1], 1);
- TextDrawSetShadow(CalculatorTD[1], 1);
- TextDrawUseBox(CalculatorTD[1], 1);
- TextDrawBoxColor(CalculatorTD[1], 842150655);
- TextDrawTextSize(CalculatorTD[1], 595.000000, -20.000000);
- TextDrawSetSelectable(CalculatorTD[1], 0);
- CalculatorTD[2] = TextDrawCreate(550.000000, 259.000000, "CALCULATOR");
- TextDrawAlignment(CalculatorTD[2], 2);
- TextDrawBackgroundColor(CalculatorTD[2], 255);
- TextDrawFont(CalculatorTD[2], 1);
- TextDrawLetterSize(CalculatorTD[2], 0.370000, 1.400000);
- TextDrawColor(CalculatorTD[2], -1);
- TextDrawSetOutline(CalculatorTD[2], 0);
- TextDrawSetProportional(CalculatorTD[2], 1);
- TextDrawSetShadow(CalculatorTD[2], 0);
- TextDrawSetSelectable(CalculatorTD[2], 0);
- CalculatorTD[3] = TextDrawCreate(515.000000, 333.000000, "7");
- TextDrawAlignment(CalculatorTD[3], 2);
- TextDrawBackgroundColor(CalculatorTD[3], 255);
- TextDrawFont(CalculatorTD[3], 1);
- TextDrawLetterSize(CalculatorTD[3], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[3], -1);
- TextDrawSetOutline(CalculatorTD[3], 0);
- TextDrawSetProportional(CalculatorTD[3], 1);
- TextDrawSetShadow(CalculatorTD[3], 0);
- TextDrawUseBox(CalculatorTD[3], 1);
- TextDrawBoxColor(CalculatorTD[3], 842150655);
- TextDrawTextSize(CalculatorTD[3], 10.000000, 10.000000);
- TextDrawSetSelectable(CalculatorTD[3], 1);
- CalculatorTD[4] = TextDrawCreate(536.000000, 333.000000, "8");
- TextDrawAlignment(CalculatorTD[4], 2);
- TextDrawBackgroundColor(CalculatorTD[4], 255);
- TextDrawFont(CalculatorTD[4], 1);
- TextDrawLetterSize(CalculatorTD[4], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[4], -1);
- TextDrawSetOutline(CalculatorTD[4], 0);
- TextDrawSetProportional(CalculatorTD[4], 1);
- TextDrawSetShadow(CalculatorTD[4], 0);
- TextDrawUseBox(CalculatorTD[4], 1);
- TextDrawBoxColor(CalculatorTD[4], 842150655);
- TextDrawTextSize(CalculatorTD[4], 10.000000, 10.000000);
- TextDrawSetSelectable(CalculatorTD[4], 1);
- CalculatorTD[5] = TextDrawCreate(557.000000, 333.000000, "9");
- TextDrawAlignment(CalculatorTD[5], 2);
- TextDrawBackgroundColor(CalculatorTD[5], 255);
- TextDrawFont(CalculatorTD[5], 1);
- TextDrawLetterSize(CalculatorTD[5], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[5], -1);
- TextDrawSetOutline(CalculatorTD[5], 0);
- TextDrawSetProportional(CalculatorTD[5], 1);
- TextDrawSetShadow(CalculatorTD[5], 0);
- TextDrawUseBox(CalculatorTD[5], 1);
- TextDrawBoxColor(CalculatorTD[5], 842150655);
- TextDrawTextSize(CalculatorTD[5], 10.000000, 10.000000);
- TextDrawSetSelectable(CalculatorTD[5], 1);
- CalculatorTD[6] = TextDrawCreate(588.000000, 333.000000, "/");
- TextDrawAlignment(CalculatorTD[6], 2);
- TextDrawBackgroundColor(CalculatorTD[6], 255);
- TextDrawFont(CalculatorTD[6], 1);
- TextDrawLetterSize(CalculatorTD[6], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[6], -1);
- TextDrawSetOutline(CalculatorTD[6], 0);
- TextDrawSetProportional(CalculatorTD[6], 1);
- TextDrawSetShadow(CalculatorTD[6], 0);
- TextDrawUseBox(CalculatorTD[6], 1);
- TextDrawBoxColor(CalculatorTD[6], 842150655);
- TextDrawTextSize(CalculatorTD[6], 10.000000, 10.000000);
- TextDrawSetSelectable(CalculatorTD[6], 1);
- CalculatorTD[7] = TextDrawCreate(588.000000, 355.000000, "X");
- TextDrawAlignment(CalculatorTD[7], 2);
- TextDrawBackgroundColor(CalculatorTD[7], 255);
- TextDrawFont(CalculatorTD[7], 1);
- TextDrawLetterSize(CalculatorTD[7], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[7], -1);
- TextDrawSetOutline(CalculatorTD[7], 0);
- TextDrawSetProportional(CalculatorTD[7], 1);
- TextDrawSetShadow(CalculatorTD[7], 0);
- TextDrawUseBox(CalculatorTD[7], 1);
- TextDrawBoxColor(CalculatorTD[7], 842150655);
- TextDrawTextSize(CalculatorTD[7], 10.000000, 10.000000);
- TextDrawSetSelectable(CalculatorTD[7], 1);
- CalculatorTD[8] = TextDrawCreate(588.000000, 377.000000, "-");
- TextDrawAlignment(CalculatorTD[8], 2);
- TextDrawBackgroundColor(CalculatorTD[8], 255);
- TextDrawFont(CalculatorTD[8], 1);
- TextDrawLetterSize(CalculatorTD[8], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[8], -1);
- TextDrawSetOutline(CalculatorTD[8], 0);
- TextDrawSetProportional(CalculatorTD[8], 1);
- TextDrawSetShadow(CalculatorTD[8], 0);
- TextDrawUseBox(CalculatorTD[8], 1);
- TextDrawBoxColor(CalculatorTD[8], 842150655);
- TextDrawTextSize(CalculatorTD[8], 10.000000, 10.000000);
- TextDrawSetSelectable(CalculatorTD[8], 1);
- CalculatorTD[9] = TextDrawCreate(588.000000, 399.000000, "+");
- TextDrawAlignment(CalculatorTD[9], 2);
- TextDrawBackgroundColor(CalculatorTD[9], 255);
- TextDrawFont(CalculatorTD[9], 1);
- TextDrawLetterSize(CalculatorTD[9], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[9], -1);
- TextDrawSetOutline(CalculatorTD[9], 0);
- TextDrawSetProportional(CalculatorTD[9], 1);
- TextDrawSetShadow(CalculatorTD[9], 0);
- TextDrawUseBox(CalculatorTD[9], 1);
- TextDrawBoxColor(CalculatorTD[9], 842150655);
- TextDrawTextSize(CalculatorTD[9], 10.000000, 10.000000);
- TextDrawSetSelectable(CalculatorTD[9], 1);
- CalculatorTD[10] = TextDrawCreate(557.000000, 355.000000, "6");
- TextDrawAlignment(CalculatorTD[10], 2);
- TextDrawBackgroundColor(CalculatorTD[10], 255);
- TextDrawFont(CalculatorTD[10], 1);
- TextDrawLetterSize(CalculatorTD[10], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[10], -1);
- TextDrawSetOutline(CalculatorTD[10], 0);
- TextDrawSetProportional(CalculatorTD[10], 1);
- TextDrawSetShadow(CalculatorTD[10], 0);
- TextDrawUseBox(CalculatorTD[10], 1);
- TextDrawBoxColor(CalculatorTD[10], 842150655);
- TextDrawTextSize(CalculatorTD[10], 10.000000, 10.000000);
- TextDrawSetSelectable(CalculatorTD[10], 1);
- CalculatorTD[11] = TextDrawCreate(536.000000, 355.000000, "5");
- TextDrawAlignment(CalculatorTD[11], 2);
- TextDrawBackgroundColor(CalculatorTD[11], 255);
- TextDrawFont(CalculatorTD[11], 1);
- TextDrawLetterSize(CalculatorTD[11], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[11], -1);
- TextDrawSetOutline(CalculatorTD[11], 0);
- TextDrawSetProportional(CalculatorTD[11], 1);
- TextDrawSetShadow(CalculatorTD[11], 0);
- TextDrawUseBox(CalculatorTD[11], 1);
- TextDrawBoxColor(CalculatorTD[11], 842150655);
- TextDrawTextSize(CalculatorTD[11], 10.000000, 10.000000);
- TextDrawSetSelectable(CalculatorTD[11], 1);
- CalculatorTD[12] = TextDrawCreate(515.000000, 355.000000, "4");
- TextDrawAlignment(CalculatorTD[12], 2);
- TextDrawBackgroundColor(CalculatorTD[12], 255);
- TextDrawFont(CalculatorTD[12], 1);
- TextDrawLetterSize(CalculatorTD[12], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[12], -1);
- TextDrawSetOutline(CalculatorTD[12], 0);
- TextDrawSetProportional(CalculatorTD[12], 1);
- TextDrawSetShadow(CalculatorTD[12], 0);
- TextDrawUseBox(CalculatorTD[12], 1);
- TextDrawBoxColor(CalculatorTD[12], 842150655);
- TextDrawTextSize(CalculatorTD[12], 10.000000, 10.000000);
- TextDrawSetSelectable(CalculatorTD[12], 1);
- CalculatorTD[13] = TextDrawCreate(515.000000, 377.000000, "1");
- TextDrawAlignment(CalculatorTD[13], 2);
- TextDrawBackgroundColor(CalculatorTD[13], 255);
- TextDrawFont(CalculatorTD[13], 1);
- TextDrawLetterSize(CalculatorTD[13], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[13], -1);
- TextDrawSetOutline(CalculatorTD[13], 0);
- TextDrawSetProportional(CalculatorTD[13], 1);
- TextDrawSetShadow(CalculatorTD[13], 0);
- TextDrawUseBox(CalculatorTD[13], 1);
- TextDrawBoxColor(CalculatorTD[13], 842150655);
- TextDrawTextSize(CalculatorTD[13], 10.000000, 10.000000);
- TextDrawSetSelectable(CalculatorTD[13], 1);
- CalculatorTD[14] = TextDrawCreate(536.000000, 377.000000, "2");
- TextDrawAlignment(CalculatorTD[14], 2);
- TextDrawBackgroundColor(CalculatorTD[14], 255);
- TextDrawFont(CalculatorTD[14], 1);
- TextDrawLetterSize(CalculatorTD[14], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[14], -1);
- TextDrawSetOutline(CalculatorTD[14], 0);
- TextDrawSetProportional(CalculatorTD[14], 1);
- TextDrawSetShadow(CalculatorTD[14], 0);
- TextDrawUseBox(CalculatorTD[14], 1);
- TextDrawBoxColor(CalculatorTD[14], 842150655);
- TextDrawTextSize(CalculatorTD[14], 10.000000, 10.000000);
- TextDrawSetSelectable(CalculatorTD[14], 1);
- CalculatorTD[15] = TextDrawCreate(557.000000, 377.000000, "3");
- TextDrawAlignment(CalculatorTD[15], 2);
- TextDrawBackgroundColor(CalculatorTD[15], 255);
- TextDrawFont(CalculatorTD[15], 1);
- TextDrawLetterSize(CalculatorTD[15], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[15], -1);
- TextDrawSetOutline(CalculatorTD[15], 0);
- TextDrawSetProportional(CalculatorTD[15], 1);
- TextDrawSetShadow(CalculatorTD[15], 0);
- TextDrawUseBox(CalculatorTD[15], 1);
- TextDrawBoxColor(CalculatorTD[15], 842150655);
- TextDrawTextSize(CalculatorTD[15], 10.000000, 10.000000);
- TextDrawSetSelectable(CalculatorTD[15], 1);
- CalculatorTD[16] = TextDrawCreate(515.000000, 399.000000, "0");
- TextDrawAlignment(CalculatorTD[16], 2);
- TextDrawBackgroundColor(CalculatorTD[16], 255);
- TextDrawFont(CalculatorTD[16], 1);
- TextDrawLetterSize(CalculatorTD[16], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[16], -1);
- TextDrawSetOutline(CalculatorTD[16], 0);
- TextDrawSetProportional(CalculatorTD[16], 1);
- TextDrawSetShadow(CalculatorTD[16], 0);
- TextDrawUseBox(CalculatorTD[16], 1);
- TextDrawBoxColor(CalculatorTD[16], 842150655);
- TextDrawTextSize(CalculatorTD[16], 10,10);
- TextDrawSetSelectable(CalculatorTD[16], 1);
- CalculatorTD[17] = TextDrawCreate(546.000000, 399.000000, "=");
- TextDrawAlignment(CalculatorTD[17], 2);
- TextDrawBackgroundColor(CalculatorTD[17], 255);
- TextDrawFont(CalculatorTD[17], 1);
- TextDrawLetterSize(CalculatorTD[17], 0.340000, 1.100000);
- TextDrawColor(CalculatorTD[17], -1);
- TextDrawSetOutline(CalculatorTD[17], 0);
- TextDrawSetProportional(CalculatorTD[17], 1);
- TextDrawSetShadow(CalculatorTD[17], 0);
- TextDrawUseBox(CalculatorTD[17], 1);
- TextDrawBoxColor(CalculatorTD[17], 842150655);
- TextDrawTextSize(CalculatorTD[17], 10.000000, 35.000000);
- TextDrawSetSelectable(CalculatorTD[17], 1);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- CalculatorTD2 = CreatePlayerTextDraw(playerid,595.000000, 287.000000, "_");
- PlayerTextDrawAlignment(playerid,CalculatorTD2, 3);
- PlayerTextDrawBackgroundColor(playerid,CalculatorTD2, 255);
- PlayerTextDrawFont(playerid,CalculatorTD2, 2);
- PlayerTextDrawLetterSize(playerid,CalculatorTD2, 0.320000, 2.000000);
- PlayerTextDrawColor(playerid,CalculatorTD2, -1);
- PlayerTextDrawSetOutline(playerid,CalculatorTD2, 0);
- PlayerTextDrawSetProportional(playerid,CalculatorTD2, 1);
- PlayerTextDrawSetShadow(playerid,CalculatorTD2, 0);
- PlayerTextDrawSetSelectable(playerid,CalculatorTD2, 0);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- PlayerTextDrawDestroy(playerid,CalculatorTD2);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/calculator", cmdtext, true, 10) == 0)
- {
- if(!GetPVarInt(playerid,"calcular"))
- {
- for(new i = 0; i < 18; i++) TextDrawShowForPlayer(playerid,CalculatorTD[i]);
- PlayerTextDrawShow(playerid,CalculatorTD2);
- SelectTextDraw(playerid,0x33AA33AA);
- SetPVarInt(playerid,"calcular",1);
- }
- else
- {
- PlayerTextDrawSetString(playerid,CalculatorTD2,"");
- for(new i = 0; i < 18; i++) TextDrawHideForPlayer(playerid,CalculatorTD[i]);
- PlayerTextDrawHide(playerid,CalculatorTD2);
- CancelSelectTextDraw(playerid);
- DeletePVar(playerid,"calcular");
- var1[playerid] = "";
- var2[playerid] = "";
- DeletePVar(playerid,"calcu");
- DeletePVar(playerid,"cuen");
- DeletePVar(playerid,"tovar");
- }
- return 1;
- }
- return 0;
- }
- public OnPlayerClickTextDraw(playerid, Text:clickedid)
- {
- if(clickedid == CalculatorTD[3])
- {
- if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"7"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
- if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"7"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
- }
- if(clickedid == CalculatorTD[4])
- {
- if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"8"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
- if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"8"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
- }
- if(clickedid == CalculatorTD[5])
- {
- if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"9"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
- if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"9"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
- }
- if(clickedid == CalculatorTD[6])
- {
- if(GetPVarInt(playerid,"calcu") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"ERROR"),DeletePVar(playerid,"calcu");
- if(!GetPVarInt(playerid,"calcu")) if(GetPVarInt(playerid,"tovar") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"/"),SetPVarInt(playerid,"calcu",1),SetPVarInt(playerid,"cuen",1);
- }
- if(clickedid == CalculatorTD[7])
- {
- if(GetPVarInt(playerid,"calcu") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"ERROR"),DeletePVar(playerid,"calcu");
- if(!GetPVarInt(playerid,"calcu")) if(GetPVarInt(playerid,"tovar") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"X"),SetPVarInt(playerid,"calcu",1),SetPVarInt(playerid,"cuen",2);
- }
- if(clickedid == CalculatorTD[8])
- {
- if(GetPVarInt(playerid,"calcu") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"ERROR"),DeletePVar(playerid,"calcu");
- if(!GetPVarInt(playerid,"calcu")) if(GetPVarInt(playerid,"tovar") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"-"),SetPVarInt(playerid,"calcu",1),SetPVarInt(playerid,"cuen",3);
- }
- if(clickedid == CalculatorTD[9])
- {
- if(GetPVarInt(playerid,"calcu") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"ERROR"),DeletePVar(playerid,"calcu");
- if(!GetPVarInt(playerid,"calcu")) if(GetPVarInt(playerid,"tovar") == 1) PlayerTextDrawSetString(playerid,CalculatorTD2,"+"),SetPVarInt(playerid,"calcu",1),SetPVarInt(playerid,"cuen",4);
- }
- if(clickedid == CalculatorTD[10])
- {
- if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"6"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
- if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"6"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
- }
- if(clickedid == CalculatorTD[11])
- {
- if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"5"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
- if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"5"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
- }
- if(clickedid == CalculatorTD[12])
- {
- if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"4"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
- if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"4"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
- }
- if(clickedid == CalculatorTD[13])
- {
- if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"1"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
- if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"1"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
- }
- if(clickedid == CalculatorTD[14])
- {
- if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"2"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
- if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"2"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
- }
- if(clickedid == CalculatorTD[15])
- {
- if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"3"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
- if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"3"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
- }
- if(clickedid == CalculatorTD[16])
- {
- if(!GetPVarInt(playerid,"calcu")) strcat(var1[playerid],"0"),PlayerTextDrawSetString(playerid,CalculatorTD2,var1[playerid]),SetPVarInt(playerid,"tovar",1);
- if(GetPVarInt(playerid,"calcu") == 1) strcat(var2[playerid],"0"),PlayerTextDrawSetString(playerid,CalculatorTD2,var2[playerid]);
- }
- if(clickedid == CalculatorTD[17])
- {
- if(!GetPVarInt(playerid,"calcu"))
- {
- PlayerTextDrawSetString(playerid,CalculatorTD2,"ERROR");
- var1[playerid] = "";
- var2[playerid] = "";
- DeletePVar(playerid,"calcu");
- DeletePVar(playerid,"cuen");
- DeletePVar(playerid,"tovar");
- }
- if(GetPVarInt(playerid,"calcu") == 1)
- {
- new str[64],nu1,nu2;
- nu1 = strval(var1[playerid]);
- nu2 = strval(var2[playerid]);
- if(GetPVarInt(playerid,"cuen") == 1)
- {
- format(str,sizeof(str),"%d",nu1/nu2);
- PlayerTextDrawSetString(playerid,CalculatorTD2,str);
- }
- else if(GetPVarInt(playerid,"cuen") == 2)
- {
- format(str,sizeof(str),"%d",nu1*nu2);
- PlayerTextDrawSetString(playerid,CalculatorTD2,str);
- }
- else if(GetPVarInt(playerid,"cuen") == 3)
- {
- format(str,sizeof(str),"%d",nu1-nu2);
- PlayerTextDrawSetString(playerid,CalculatorTD2,str);
- }
- else if(GetPVarInt(playerid,"cuen") == 4)
- {
- format(str,sizeof(str),"%d",nu1+nu2);
- PlayerTextDrawSetString(playerid,CalculatorTD2,str);
- }
- var1[playerid] = "";
- var2[playerid] = "";
- DeletePVar(playerid,"calcu");
- DeletePVar(playerid,"cuen");
- DeletePVar(playerid,"tovar");
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement