Raised This Month: $51 Target: $400
 12% 

Solved amx_last request!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JuanitoAlimana
Senior Member
Join Date: Aug 2021
Old 01-25-2024 , 22:12   amx_last request!
Reply With Quote #1

Hello. Is it possible to hide the IP address of those with ADMIN_IMMUNITY flag when using the amx_last command? Thanks!


PHP Code:
public cmdLast(idlevelcid)
{
    if (!
cmd_access(idlevelcid1))
    {
        return 
PLUGIN_HANDLED;
    }
    
    new 
name[MAX_NAME_LENGTH];
    new 
authid[32];
    new 
ip[32];
    new 
flags[32];
    new 
access;
    
    
    
// This alignment is a bit weird (it should grow if the name is larger)
    // but otherwise for the more common shorter name, it'll wrap in server console
    // Steam client display is all skewed anyway because of the non fixed font.
    
console_print(id"%19s %20s %15s %s""name""authid""ip""access");
    
    for (new 
0g_Sizei++)
    {
        
GetInfo(inamecharsmax(name), authidcharsmax(authid), ipcharsmax(ip), access);
        
        
get_flags(accessflagscharsmax(flags));
        
        
console_print(id"%19s %20s %15s %s"nameauthidipflags);
    }
    
    
console_print(id"%d old connections saved."g_Size);
    
    return 
PLUGIN_HANDLED;


Last edited by JuanitoAlimana; 01-27-2024 at 20:39.
JuanitoAlimana is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-25-2024 , 23:05   Re: amx_last request!
Reply With Quote #2

Add the following after GetInfo():

Code:
		if( access & ADMIN_IMMUNITY )
		{
			copy(ip, charsmax(ip), "censored")
		}
__________________
fysiks is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 01-26-2024 , 08:07   Re: amx_last request!
Reply With Quote #3

or

PHP Code:
replace(ipcharsmax(ip), ip"*****"
__________________

Last edited by mlibre; 01-26-2024 at 08:10.
mlibre is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-26-2024 , 23:58   Re: amx_last request!
Reply With Quote #4

Quote:
Originally Posted by mlibre View Post
or

PHP Code:
replace(ipcharsmax(ip), ip"*****"
That is way more complicated of a function and is completely unnecessary.
__________________
fysiks is offline
JuanitoAlimana
Senior Member
Join Date: Aug 2021
Old 01-27-2024 , 20:39   Re: amx_last request!
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
Add the following after GetInfo():

Code:
		if( access & ADMIN_IMMUNITY )
		{
			copy(ip, charsmax(ip), "censored")
		}
This worked perfectly. Thank you very much!
JuanitoAlimana 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 02:08.


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