View Single Post
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 06-28-2012 , 17:56   Re: Text align in Console
Reply With Quote #6

Quote:
Originally Posted by Powerlord View Post
I guess no one ever reads the Advanced Formatting section of the Format wiki page.

I hate to say this, though, we're going to need to use Format once because we need values from functions and constants in our final format:

PHP Code:
#define STEAMID_LENGTH 32

    
decl String:logFormat[40];
    
Format(logFormatsizeof(logFormat), "#%%-4d | %%-%ds | %%-%ds | %%-15s"MAX_NAME_LENGTHSTEAMID_LENGTH);

    
PrintToConsole(clientlogFormatuseridnamesteamidip); 
Note: Untested, but should give you 4 character userids (btw, this really should be increased to 5), MAX_NAME_LENGTH names, 32-character Steam IDs, and 15 character IPs (assuming IPv4 addresses with no port).
This is what I was going to post. I've used the advanced formatting a lot when creating timers to pad single-digit numbers with a leading zero. Lets me easily change 0:5 to 00:05.
__________________
Dr. McKay is offline