The color will depend on the level of the admin who executes the command? If yes, it is true that you do not need a loop. For only 1 parameter that is string, use isnull macro- no need for sscanf.
Max client message is 144 characters.
pawn Код:
CMD:asay(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Error: {FFFFFF}Unknown command, type /cmds for the list of commands.");
if (isnull(params)) return SendClientMessage(playerid, COLOR_GRAY, "Syntax: /asay [message]");
new text[145], color_of_text;
switch (PlayerInfo[playerid][pAdmin])
{
case 1: color_of_text = COLOR_LEVEL1;
case 2: color_of_text = COLOR_LEVEL2;
case 3: color_of_text = COLOR_LEVEL3;
}
format(text, sizeof (text), "Admin: %s", params);
SendClientMessageToAll(color_of_text, text);
return 1;
}