| addons_zz |
12-27-2015 06:05 |
Re: Is it possible fail state ?
Try this:
Code:
/** AMX Mod X Script
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or ( at
* your option ) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ***********************************************************
*/
#include <amxmodx>
#include <amxmisc>
new Trie:g_black_list
/*
* Called just after server activation.
*/
public plugin_init()
{
register_plugin( "Cool Plugin", "1.0", "Addons zz" )
g_black_list = TrieCreate()
TrieSetCell( g_black_list, "STEAM_0:1:xxxxxxxx", 1 )
TrieSetCell( g_black_list, "STEAM_0:1:xxxxxxxx", 1 )
TrieSetCell( g_black_list, "STEAM_0:1:xxxxxxxx", 1 )
TrieSetCell( g_black_list, "STEAM_0:1:xxxxxxxx", 1 )
TrieSetCell( g_black_list, "STEAM_0:1:xxxxxxxx", 1 )
TrieSetCell( g_black_list, "STEAM_0:1:xxxxxxxx", 1 )
TrieSetCell( g_black_list, "STEAM_0:1:xxxxxxxx", 1 )
}
/*
* Called when all plugins went through plugin_init()
*/
public plugin_cfg()
{
new string_steam_ID[ 32 ]
copy( string_steam_ID, charsmax( string_steam_ID ), "STEAM_0:1:xxxxxxxx" )
if( TrieKeyExists( g_black_list, string_steam_ID ) )
{
pause( "d", "my_bad_pluing.amxx" );
pause( "d", "my_more_bad_pluing.amxx" );
}
}
/*
* Called just before server deactivation and subsequent unloading of the
* plugin.
*/
public plugin_end()
{
TrieDestroy( g_black_list )
}
Here is a function from the default plugin AMXX "admin.sma" to load admins from "users.ini":
Code:
loadSettings(szFilename[])
{
new File=fopen(szFilename,"r");
if (File)
{
new Text[512];
new Flags[32];
new Access[32]
new AuthData[44];
new Password[32];
while (!feof(File))
{
fgets(File,Text,sizeof(Text)-1);
trim(Text);
// comment
if (Text[0]==';')
{
continue;
}
Flags[0]=0;
Access[0]=0;
AuthData[0]=0;
Password[0]=0;
// not enough parameters
if (parse(Text,AuthData,sizeof(AuthData)-1,Password,sizeof(Password)-1,Access,sizeof(Access)-1,Flags,sizeof(Flags)-1) < 2)
{
continue;
}
admins_push(AuthData,Password,read_flags(Access),read_flags(Flags));
AdminCount++;
}
fclose(File);
}
if (AdminCount == 1)
{
server_print("[AMXX] %L", LANG_SERVER, "LOADED_ADMIN");
}
else
{
server_print("[AMXX] %L", LANG_SERVER, "LOADED_ADMINS", AdminCount);
}
return 1;
}
|