Raised This Month: $ Target: $400
 0% 

Can you pass a string to a function like this?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 04-09-2006 , 11:40  
Reply With Quote #6

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; }
Brad is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode