04.02.2016, 12:44
Код:
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; }