Ah yes... Found it.
I use this while debugging my plugins. The part that you're most interested in is my use of the
format_args function. It essentially acts as the
format function and, as such, returns a formatted string.
Let me know if you have any questions.
Code:
stock debug_log(const textID[] = "", const text[] = "", {Float,_}:...)
{
new debugger = get_cvar_num("badcamper_debug");
if (debugger || debugger == -1)
{
// format the text as needed
new formattedText[1024];
format_args(formattedText, 1023, 1);
// if there's a text identifier, add it
if (textID[0])
format(formattedText, 1023, "[%s] %s", textID, formattedText);
// log text to file
log_to_file("_badcamper.log", formattedText);
// if there's someone to show text to, do so
if (debugger && is_user_connected(debugger))
client_print(debugger, print_chat, formattedText);
}
// not needed but gets rid of stupid compiler error
if (text[0] == 0) return;
}