dvander@637: /**
ds@1330: * vim: set ts=4 :
ds@1330: * =============================================================================
ds@1330: * SourceMod Admin File Reader Plugin
dvander@637: * Reads the admins.cfg file. Do not compile this directly.
ds@1330: *
ds@1330: * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
ds@1330: * =============================================================================
dvander@637: *
ds@1330: * This program is free software; you can redistribute it and/or modify it under
ds@1330: * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330: * Free Software Foundation.
ds@1330: *
ds@1330: * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
ds@1330: * details.
dvander@637: *
ds@1330: * You should have received a copy of the GNU General Public License along with
ds@1330: * this program. If not, see .
ds@1330: *
ds@1330: * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330: * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330: * by the Valve Corporation. You must obey the GNU General Public License in
ds@1330: * all respects for all other code used. Additionally, AlliedModders LLC grants
ds@1330: * this exception to all derivative works. AlliedModders LLC defines further
ds@1330: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330: * or .
ds@908: *
ds@908: * Version: $Id$
dvander@637: */
ds@1330:
dvander@639: public ReadSimpleUsers()
dvander@637: {
dvander@637: BuildPath(Path_SM, g_Filename, sizeof(g_Filename), "configs/admins_simple.ini");
dvander@637:
dvander@637: new Handle:file = OpenFile(g_Filename, "rt");
dvander@637: if (file == INVALID_HANDLE)
dvander@637: {
dvander@637: ParseError("Could not open file!");
dvander@637: return;
dvander@637: }
dvander@637:
dvander@637: while (!IsEndOfFile(file))
dvander@637: {
dvander@637: decl String:line[255];
dvander@639: if (!ReadFileLine(file, line, sizeof(line)))
dvander@639: {
dvander@639: break;
dvander@639: }
dvander@637:
dvander@1107: /* Trim comments */
dvander@1107: new len = strlen(line);
dvander@1107: new bool:ignoring = false;
dvander@1107: for (new i=0; i 0)
dvander@637: {
dvander@1403: SetAdminImmunityLevel(admin, level);
dvander@1403: if (flags[flag_idx] == ':')
dvander@1403: {
dvander@1403: flag_idx++;
dvander@1403: }
dvander@1403: }
dvander@1403:
dvander@1403: if (flags[flag_idx] == '@')
dvander@1403: {
dvander@1403: new GroupId:gid = FindAdmGroup(flags[flag_idx + 1]);
dvander@637: if (gid == INVALID_GROUP_ID)
dvander@637: {
dvander@1403: ParseError("Invalid group detected: %s", flags[flag_idx + 1]);
dvander@637: return;
dvander@637: }
dvander@637: AdminInheritGroup(admin, gid);
dvander@637: } else {
dvander@1403: new len = strlen(flags[flag_idx]);
dvander@637: new bool:is_default = false;
dvander@637: for (new i=0; i