Raised This Month: $ Target: $400
 0% 

Admin remove plugin bug help...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-04-2013 , 13:01   Re: Admin remove plugin bug help...
Reply With Quote #1

Anyway, you can fully ignore that message.

You can use this :

PHP Code:
#include < amxmodx >
#include < amxmisc >

#pragma semicolon 1

#define PLUGIN "Remove Admin"
#define VERSION "0.0.1"

#define cm(%0)    ( sizeof(%0) - 1 )

public plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );
    
register_srvcmd("amx_removeadmin""cmdRemoveAdmin");
}

public 
cmdRemoveAdmin()
{
    new 
szArg[32];
    
read_argv(1szArgcharsmax(szArg));

    new 
szAdminFile[64];
    
get_configsdir(szAdminFilecm(szAdminFile));
    
add(szAdminFilecm(szAdminFile), "/users.ini");

    new 
fplinebFound;
ReadFile:
    
fp fopen(szAdminFile"rt");
    
line = -1;
    if( 
fp )
    {
        new 
buffer[256], ckey[32];
        while( !
feof(fp) )
        {
            
line++;
            
fgets(fpbuffercharsmax(buffer));
            
trim(buffer);
            
buffer[0];
            if( 
&& != '#' && != ';' && !( == '/' && buffer[1] == '/' ) )
            {
                
parse(bufferkeycm(key));
                if( 
equal(keyszArg) )
                {
                    
bFound 1;
                    
fclosefp );
                    
fp 0;
                    
write_file(szAdminFile""line);
                    
console_print(0"Removed following line from users.ini : %s"buffer);
                    goto 
ReadFile;
                }
            }
        }
        
fclosefp );
        
fp 0;
    }

    if( 
bFound )
    {
        
server_cmd("amx_reloadadmins");
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-04-2013 at 13:56.
ConnorMcLeod is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode