AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Admin remove plugin bug help... (https://forums.alliedmods.net/showthread.php?t=222559)

Firewall_ 08-04-2013 08:22

Admin remove plugin bug help...
 
1 Attachment(s)
hi guyz. I did amx_removeadmin command plugin from direct console. But i have small problem.

When i want to delete an admin, this command is deleting admin succesfully but i take this error:

amx_removeadmin OnurX
Client with that name or userid not found => what is this error? fix pls :grrr:
[CSOYUNCU] "OnurX" admin removed => process success :fox:
[AMXX] Loaded 0 admins from file => process success :fox:


i want to fix "Client with that name or userid not found" error message... can you help me about this error.i attached sma thanks.

simanovich 08-04-2013 09:35

Re: Admin remove plugin bug help...
 
It means that the provided client name ("OnurX") wasn't found at the online client list

Firewall_ 08-04-2013 09:52

Re: Admin remove plugin bug help...
 
Quote:

Originally Posted by simanovich (Post 2005425)
It means that the provided client name ("OnurX") wasn't found at the online client list

i think you didnt read this topic good...

after it error :
[CSOYUNCU] "OnurX" admin removed
[AMXX] Loaded 0 admins from file

YamiKaitou 08-04-2013 09:55

Re: Admin remove plugin bug help...
 
... That message is shown because your plugin is trying to find a user connected with that name. Since you are not using it, remove this part

Code:

  new player = cmd_target(id, szName, 8)

  if(player)
  {
    get_user_name(player, szName, 31)
    get_user_authid(player, szSteamid, 31)
    get_user_ip(player, szIP, 31, 1)
  }


Firewall_ 08-04-2013 10:50

Re: Admin remove plugin bug help...
 
Quote:

Originally Posted by YamiKaitou (Post 2005436)
... That message is shown because your plugin is trying to find a user connected with that name. Since you are not using it, remove this part

Code:

  new player = cmd_target(id, szName, 8)

  if(player)
  {
    get_user_name(player, szName, 31)
    get_user_authid(player, szSteamid, 31)
    get_user_ip(player, szIP, 31, 1)
  }


ah thank you very muchh yami... :shock:

problem solved

ConnorMcLeod 08-04-2013 10:54

Re: Admin remove plugin bug help...
 
If you remove the code, you won't be able to remove online players with partial names or with names if they are registered with steamid.
Would be better to let the code as it is, message is just a warning but code is still working fine.

Also, that code has been copy/pasted from amx2006, FYI.

Firewall_ 08-04-2013 10:59

Re: Admin remove plugin bug help...
 
Quote:

Originally Posted by ConnorMcLeod (Post 2005469)
If you remove the code, you won't be able to remove online players with partial names or with names if they are registered with steamid.
Would be better to let the code as it is, message is just a warning but code is still working fine.

Also, that code has been copy/pasted from amx2006, FYI.

yes connor. This part from amx2010 version. I dont want to delete online players or other. I will use this only my control panel for hlds.

ConnorMcLeod 08-04-2013 13:01

Re: Admin remove plugin bug help...
 
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");
    }



Firewall_ 08-04-2013 15:19

Re: Admin remove plugin bug help...
 
thanks for your script connor. I will use your codes my panels. Thanks again ;)

Firewall_ 08-04-2013 16:41

Re: Admin remove plugin bug help...
 
connor for remove steamid admins, what must i do ?


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

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