[Ajuda] Calculadora
#2

Код:
CMD:calc(playerid, params[])
{
    new val[2], sinal[2], String[80];

    if(sscanf(params, "is[2]i", val[0], sinal, val[1])) return SendClientMessage(playerid, -1, "• USO » /calc [Valor1] [Sinal] [Valor2]");

    if(sinal[0] == '*')
    {
        format(String, sizeof(String), "Multiplicaзгo: %i * %i = %i", val[0], val[1], val[0]*val[1]);
        SendClientMessage(playerid, -1, String);
    }
    else if(sinal[0] == '/')
    {
        format(String, sizeof(String), "Divisгo: %i / %i = %.2f", val[0], val[1], Float:val[0]/Float:val[1]);
        SendClientMessage(playerid, -1, String);
    }
    else if(sinal[0] == '-')
    {
        format(String, sizeof(String), "Substraзгo: %i - %i = %i", val[0], val[1], val[0]-val[1]);
        SendClientMessage(playerid, -1, String);
    }
    else if(sinal[0] == '*')
    {
        format(String, sizeof(String), "Adiзгo: %i + %i = %i", val[0], val[1], val[0]+val[1]);
        SendClientMessage(playerid, -1, String);
    }
    return 1;
}
(Editado)
Reply


Messages In This Thread
Calculadora - by F1N4L - 03.02.2016, 21:26
Re: Calculadora - by RodrigoMSR - 04.02.2016, 12:44
Re: Calculadora - by F1N4L - 04.02.2016, 13:27

Forum Jump:


Users browsing this thread: 2 Guest(s)