added and tested admin authentication. WOOT. only steam-based works for now.

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40466
This commit is contained in:
David Anderson
2007-02-09 04:41:03 +00:00
parent 18aabecfd3
commit 57c1f0dd4d
7 changed files with 144 additions and 11 deletions
+45
View File
@@ -0,0 +1,45 @@
/**
* ===============================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* ===============================================================
*
* This file is part of the SourceMod/SourcePawn SDK. This file may only be used
* or modified under the Terms and Conditions of its License Agreement, which is found
* in LICENSE.txt. The Terms and Conditions for making SourceMod extensions/plugins
* may change at any time. To view the latest information, see:
* http://www.sourcemod.net/license.php
*
* Version: $Id$
*/
#if defined _helpers_included
#endinput
#endif
#define _helpers_included
/**
* Formats a user's info as log text.
*
* @param client Client index.
* @param buffer Buffer for text.
* @param maxlength Maximum length of text.
*/
stock FormatUserLogText(client, String:buffer[], maxlength)
{
decl String:auth[32];
decl String:name[40];
new userid = GetClientUserId(client);
if (!GetClientAuthString(client, auth, sizeof(auth)))
{
StrCopy(auth, sizeof(auth), "UNKNOWN");
}
if (!GetClientName(client, name, sizeof(name)))
{
StrCopy(name, sizeof(name), "UNKNOWN");
}
/** Currently, no team stuff ... */
Format(buffer, maxlength, "\"%s<%d><%s><>\"", name, userid, auth);
}
+20 -8
View File
@@ -164,9 +164,9 @@ native GetClientCount(bool:inGameOnly=true);
/**
* Returns the client's name.
*
* @param client Player index.
* @param name Buffer to store the client's name.
* @param maxlen Maximum length of string buffer (includes NULL terminator).
* @param client Player index.
* @param name Buffer to store the client's name.
* @param maxlen Maximum length of string buffer (includes NULL terminator).
* @return True on success, false otherwise.
* @error If the client is not connected an error will be thrown.
*/
@@ -179,8 +179,8 @@ native bool:GetClientName(client, String:name[], maxlen);
* @param name Buffer to store the client's ip address.
* @param maxlen Maximum length of string buffer (includes NULL terminator).
* @param remport Remove client's port from the ip string (true by default).
* @return True on success, false otherwise.
* @error If the client is not connected an error will be thrown.
* @return True on success, false otherwise.
* @error If the client is not connected or the index is invalid.
*/
native bool:GetClientIP(client, String:ip[], maxlen, bool:remport=true);
@@ -190,11 +190,21 @@ native bool:GetClientIP(client, String:ip[], maxlen, bool:remport=true);
* @param client Player index.
* @param auth Buffer to store the client's auth string.
* @param maxlen Maximum length of string buffer (includes NULL terminator).
* @return True on success, false otherwise.
* @error If the client is not connected an error will be thrown.
* @return True on success, false otherwise.
* @error If the client is not connected or the index is invalid.
*/
native bool:GetClientAuthString(client, String:auth[], maxlen);
/**
* Retrieves a client's user id, which is an index incremented for every client
* that joins the server.
*
* @param client Player index.
* @return User id of the client.
* @error If the client is not connected or the index is invalid.
*/
native GetClientUserId(client);
/**
* Returns if a certain player is connected.
*
@@ -346,4 +356,6 @@ native LogMessage(const String:format[], {Handle,Float,String,_}:...);
* @param ... Format arguments.
* @noreturn
*/
native LogError(const String:format[], {Handle,Float,String,_}:...);
native LogError(const String:format[], {Handle,Float,String,_}:...);
#include <helpers>