This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[help] amxlast


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Artizy
Member
Join Date: Jun 2011
Location: Milan, Italy.
Old 11-24-2016 , 13:01   [help] amxlast
Reply With Quote #1

Hello, i need to remove ip from amx_last, i need to show only name, authid and acces. This is the code:

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

#define PLUGIN "CmdLast"
#define VERSION "1.0"
#define AUTHOR "Artizy"

#define ACCESS ADMIN_BAN
#define OLD_CONNECTION_QUEUE 10
new g_Size;
new g_Names[OLD_CONNECTION_QUEUE][32];
new g_SteamIDs[OLD_CONNECTION_QUEUE][32];
new g_IPs[OLD_CONNECTION_QUEUE][32];
new g_Access[OLD_CONNECTION_QUEUE];
new g_Tracker;

public plugin_init() {
   register_plugin(PLUGIN, VERSION, AUTHOR)
   
   register_concmd("amx_last","last_cmd",ACCESS)
}

public last_cmd(id, level, cid)
{
   if(!(get_user_flags(id) & ACCESS)){
      console_print(id,"You don't have access to that command.")
      return PLUGIN_HANDLED
   }
   
   new name[32];
   new authid[32];
   new ip[32];
   new flags[32];
   new access;
   
   console_print(id, "%19s %20s %15s %s", "name", "authid", "ip", "access");
   
   for (new i = 0; i < g_Size; i++)
   {
      GetInfo(i, name, charsmax(name), authid, charsmax(authid), ip, charsmax(ip), access);
      
      get_flags(access, flags, charsmax(flags));
      
      console_print(id, "%19s %20s %15s %s", name, authid, ip, flags);
   }
   
   console_print(id, "%d old connections saved.", g_Size);
   
   return PLUGIN_HANDLED;
}

stock InsertInfo(id)
{

   if (g_Size > 0)
   {
      new ip[32]
      new auth[32];

      get_user_authid(id, auth, charsmax(auth));
      get_user_ip(id, ip, charsmax(ip), 1/*no port*/);

      new last = 0;
      
      if (g_Size < sizeof(g_SteamIDs))
      {
         last = g_Size - 1;
      }
      else
      {
         last = g_Tracker - 1;
         
         if (last < 0)
         {
            last = g_Size - 1;
         }
      }
      
      if (equal(auth, g_SteamIDs[last]) &&
         equal(ip, g_IPs[last])) 
      {
         get_user_name(id, g_Names[last], charsmax(g_Names[]));
         g_Access[last] = get_user_flags(id);
         
         return;
      }
   }
   
   
   new target = 0; 

   if (g_Size < sizeof(g_SteamIDs))
   {
      target = g_Size;
      
      ++g_Size;
      
   }
   else
   {
      target = g_Tracker;
      
      ++g_Tracker;
      if (g_Tracker == sizeof(g_SteamIDs))
      {
         g_Tracker = 0;
      }
   }
   
   get_user_authid(id, g_SteamIDs[target], charsmax(g_SteamIDs[]));
   get_user_name(id, g_Names[target], charsmax(g_Names[]));
   get_user_ip(id, g_IPs[target], charsmax(g_IPs[]), 1/*no port*/);
   
   g_Access[target] = get_user_flags(id);

}
stock GetInfo(i, name[], namesize, auth[], authsize, ip[], ipsize, &access)
{
   if (i >= g_Size)
   {
      abort(AMX_ERR_NATIVE, "GetInfo: Out of bounds (%d:%d)", i, g_Size);
   }
   
   new target = (g_Tracker + i) % sizeof(g_SteamIDs);
   
   copy(name, namesize, g_Names[target]);
   copy(auth, authsize, g_SteamIDs[target]);
   copy(ip,   ipsize,   g_IPs[target]);
   access = g_Access[target];
   
}

public client_disconnect(id)
{
   if (!is_user_bot(id))
   {
      InsertInfo(id);
   }
}
Artizy is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 11-24-2016 , 16:55   Re: [help] amxlast
Reply With Quote #2

try

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

#define PLUGIN "CmdLast"
#define VERSION "1.0"
#define AUTHOR "Artizy"

#define ACCESS ADMIN_BAN
#define OLD_CONNECTION_QUEUE 10

new g_Size;
new 
g_Names[OLD_CONNECTION_QUEUE][32];
new 
g_SteamIDs[OLD_CONNECTION_QUEUE][32];
new 
g_Access[OLD_CONNECTION_QUEUE];
new 
g_Tracker;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_concmd("amx_last","last_cmd",ACCESS)
}

public 
last_cmd(idlevelcid)
{
    if(!(
get_user_flags(id) & ACCESS))
    {
        
console_print(id,"You don't have access to that command.")
        return 
PLUGIN_HANDLED
    
}
    
    new 
name[32];
    new 
authid[32];
    new 
flags[32];
    new 
access;
    
    
console_print(id"%19s %20s %s""name""authid""access");
    
    for (new 
0g_Sizei++)
    {
        
GetInfo(inamecharsmax(name), authidcharsmax(authid),  access);
        
        
get_flags(accessflagscharsmax(flags));
        
        
console_print(id"%19s %20s %s"nameauthidflags);
    }
    
    
console_print(id"%d old connections saved."g_Size);
    
    return 
PLUGIN_HANDLED;
}

stock InsertInfo(id)
{
    
    if (
g_Size 0)
    {
        new 
auth[32];
        
        
get_user_authid(idauthcharsmax(auth));
        
        new 
last 0;
        
        if (
g_Size sizeof(g_SteamIDs))
        {
            
last g_Size 1;
        }
        else
        {
            
last g_Tracker 1;
            
            if (
last 0)
            {
                
last g_Size 1;
            }
        }
        
        if (
equal(authg_SteamIDs[last]))
        {
            
get_user_name(idg_Names[last], charsmax(g_Names[]));
            
g_Access[last] = get_user_flags(id);
        
            return;
        }
    }


    new 
target 0

    if (
g_Size sizeof(g_SteamIDs))
    {
        
target g_Size;
        
        ++
g_Size;
    
    }
    else
    {
        
target g_Tracker;
        
        ++
g_Tracker;
        if (
g_Tracker == sizeof(g_SteamIDs))
        {
            
g_Tracker 0;
        }
    }

    
get_user_authid(idg_SteamIDs[target], charsmax(g_SteamIDs[]));
    
get_user_name(idg_Names[target], charsmax(g_Names[]));
    
    
g_Access[target] = get_user_flags(id);
}
stock GetInfo(iname[], namesizeauth[], authsize,  &access)
{
    if (
>= g_Size)
    {
        
abort(AMX_ERR_NATIVE"GetInfo: Out of bounds (%d:%d)"ig_Size);
    }

    new 
target = (g_Tracker i) % sizeof(g_SteamIDs);
    
    
copy(namenamesizeg_Names[target]);
    
copy(authauthsizeg_SteamIDs[target]);
    
access g_Access[target];
}

public 
client_disconnect(id)
{
    if (!
is_user_bot(id))
    {
        
InsertInfo(id);
    }

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 11-24-2016 at 16:55.
EFFx is offline
Artizy
Member
Join Date: Jun 2011
Location: Milan, Italy.
Old 11-24-2016 , 16:58   Re: [help] amxlast
Reply With Quote #3

Quote:
Originally Posted by EFFx View Post
try

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

#define PLUGIN "CmdLast"
#define VERSION "1.0"
#define AUTHOR "Artizy"

#define ACCESS ADMIN_BAN
#define OLD_CONNECTION_QUEUE 10

new g_Size;
new 
g_Names[OLD_CONNECTION_QUEUE][32];
new 
g_SteamIDs[OLD_CONNECTION_QUEUE][32];
new 
g_Access[OLD_CONNECTION_QUEUE];
new 
g_Tracker;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_concmd("amx_last","last_cmd",ACCESS)
}

public 
last_cmd(idlevelcid)
{
    if(!(
get_user_flags(id) & ACCESS))
    {
        
console_print(id,"You don't have access to that command.")
        return 
PLUGIN_HANDLED
    
}
    
    new 
name[32];
    new 
authid[32];
    new 
flags[32];
    new 
access;
    
    
console_print(id"%19s %20s %s""name""authid""access");
    
    for (new 
0g_Sizei++)
    {
        
GetInfo(inamecharsmax(name), authidcharsmax(authid),  access);
        
        
get_flags(accessflagscharsmax(flags));
        
        
console_print(id"%19s %20s %s"nameauthidflags);
    }
    
    
console_print(id"%d old connections saved."g_Size);
    
    return 
PLUGIN_HANDLED;
}

stock InsertInfo(id)
{
    
    if (
g_Size 0)
    {
        new 
auth[32];
        
        
get_user_authid(idauthcharsmax(auth));
        
        new 
last 0;
        
        if (
g_Size sizeof(g_SteamIDs))
        {
            
last g_Size 1;
        }
        else
        {
            
last g_Tracker 1;
            
            if (
last 0)
            {
                
last g_Size 1;
            }
        }
        
        if (
equal(authg_SteamIDs[last]))
        {
            
get_user_name(idg_Names[last], charsmax(g_Names[]));
            
g_Access[last] = get_user_flags(id);
        
            return;
        }
    }


    new 
target 0

    if (
g_Size sizeof(g_SteamIDs))
    {
        
target g_Size;
        
        ++
g_Size;
    
    }
    else
    {
        
target g_Tracker;
        
        ++
g_Tracker;
        if (
g_Tracker == sizeof(g_SteamIDs))
        {
            
g_Tracker 0;
        }
    }

    
get_user_authid(idg_SteamIDs[target], charsmax(g_SteamIDs[]));
    
get_user_name(idg_Names[target], charsmax(g_Names[]));
    
    
g_Access[target] = get_user_flags(id);
}
stock GetInfo(iname[], namesizeauth[], authsize,  &access)
{
    if (
>= g_Size)
    {
        
abort(AMX_ERR_NATIVE"GetInfo: Out of bounds (%d:%d)"ig_Size);
    }

    new 
target = (g_Tracker i) % sizeof(g_SteamIDs);
    
    
copy(namenamesizeg_Names[target]);
    
copy(authauthsizeg_SteamIDs[target]);
    
access g_Access[target];
}

public 
client_disconnect(id)
{
    if (!
is_user_bot(id))
    {
        
InsertInfo(id);
    }

Thank you again bro' ! Is working perfectly.
Artizy 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 16:46.


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