[FilterScript] small Calculator
#5

I just made this. Don't know if it works. But it is more user-friendly.

pawn Код:
CMD:calculate(playerid, params)
{
    new num1, operation[1], num2;
    if(sscanf(params, "ici", num1, operation, num2)) return SendClientMessage(playerid, -1, "USAGE: /calculate [number1] [+,-,*,/] [number2]");
    new str[128];
    if(!strcmp("+", operation)) format(str, sizeof(str), "%i added to %i equals %i", num1, num2, num1 + num2);
    else if(!strcmp("-", operation)) format(str, sizeof(str), "%i subtracted from %i equals %i", num2, num1, num1 - num2);
    else if(!strcmp("*", operation)) format(str, sizeof(str), "%i multiplied by %i equals %i", num1, num2, num1 * num2);
    else if(!strcmp("/", operation)) format(str, sizeof(str), "%i divided by %i equals %i", num1, num2, num1 / num2);
    else return SendClientMessage(playerid, -1, "You didn't put a valid operator. Valid operators are +, -, /, *");
    SendClientMessage(playerid, -1, str);
    return true;
}
Reply


Messages In This Thread
small Calculator - by Need4samp - 07.07.2014, 06:59
Re: small Calculator - by iFarbod - 07.07.2014, 07:13
Re: small Calculator - by SickAttack - 07.07.2014, 07:31
Re: small Calculator - by ]Rafaellos[ - 07.07.2014, 07:35
Re: small Calculator - by Inverse - 07.07.2014, 07:53
Re: small Calculator - by rockhopper - 07.07.2014, 15:01
Re: small Calculator - by Need4samp - 08.07.2014, 04:58

Forum Jump:


Users browsing this thread: 1 Guest(s)