plugins/include/helpers.inc
author David Anderson <dvander@alliedmods.net>
Mon Mar 12 00:06:20 2007 +0000 (2007-03-12)
changeset 599 3a098eff4890
parent 475 bb11d7eaae0f
child 621 5a0f5014aac1
permissions -rw-r--r--
used a better error number
     1 /**
     2  * vim: set ts=4 :
     3  * ===============================================================
     4  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     5  * ===============================================================
     6  *
     7  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used 
     8  * or modified under the Terms and Conditions of its License Agreement, which is found 
     9  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins 
    10  * may change at any time.  To view the latest information, see:
    11  *   http://www.sourcemod.net/license.php
    12  *
    13  * Version: $Id$
    14  */
    15  
    16 #if defined _helpers_included
    17  #endinput
    18 #endif
    19 #define _helpers_included
    20 
    21 /**
    22  * Formats a user's info as log text.
    23  *
    24  * @param client		Client index.
    25  * @param buffer		Buffer for text.
    26  * @param maxlength		Maximum length of text.
    27  */
    28 stock FormatUserLogText(client, String:buffer[], maxlength)
    29 {
    30 	decl String:auth[32];
    31 	decl String:name[40];
    32 	
    33 	new userid = GetClientUserId(client);
    34 	if (!GetClientAuthString(client, auth, sizeof(auth)))
    35 	{
    36 		StrCopy(auth, sizeof(auth), "UNKNOWN");
    37 	}
    38 	if (!GetClientName(client, name, sizeof(name)))
    39 	{
    40 		StrCopy(name, sizeof(name), "UNKNOWN");
    41 	}
    42 	
    43 	/** Currently, no team stuff ... */
    44 	
    45 	Format(buffer, maxlength, "\"%s<%d><%s><>\"", name, userid, auth);
    46 }