View Single Post
T0FF
Member
Join Date: Oct 2014
Location: Asia
Old 08-12-2015 , 11:05   Re: [REQ] Make ADMIN_IMMUNITY's IP invisible to other admins
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
Code is bad, I have fixed some things, but there are more, anyway, try this:
PHP Code:
/* AMXX Mod script. 


*  Join_IP 1.1 created by jsauce 


*  Okay so this plugin gets a user's info when they are authorized, then 
*  it displays it to everyone when they join and leave. If you are an admin you 
*  get to see the user's ip address and steamid. All other user's just get to see 
*  the player's name! 




*  1.1 Changed access() to get_user_flags() seems to work better for everyone. 
*      Also changed how the rank shows, and changed default show level to ADMIN_LEVEL_A 
*  1.0 initial release        // rank idea from Kindzhon's enter/leave plugin. 

*/ 


#include <amxmodx>
#include <amxmisc>

//#define CSSTATS // If you want to show the user's rank on join and on leave.
//    You must be using the csstats module and have stats plugins loaded.
//    Comment it out if you don't want to use it.
#if defined CSSTATS
#include <csstats>
#endif
#define ADMIN ADMIN_LEVEL_B    // Change to something else if you like.

public plugin_init()
{
    
register_plugin("Join IP","1.1","jsauce")

}
public 
client_authorized(id)
{
    
set_task(0.5,"client_is_auth",id)
}

public 
client_is_auth(id)
{
    new 
authid[35],user[32],ip[32],players[32],inum
    get_user_name
(id,user,charsmax(user))
    
get_user_ip(id,ip,charsmax(ip),1)
    
get_user_authid(id,authid,charsmax(authid))
    
get_players(players,inum)
    new 
Flagsindex
    
#if defined CSSTATS
    
new izStats[8], izBody[8]
    new 
iRankPosiRankMax
    iRankPos 
get_user_stats(id,izStats,izBody)
    
iRankMax get_statsnum()
    for (new 
0inum; ++i)
    {
        
index players[i]
        
Flags get_user_flags(index)
        if(
Flags ADMIN)
        {
            if(
Flags ADMIN_IMMUNITY)
            {
                
client_print(index,print_chat,"%s (%s)(RANK: %i of %i) Is Connecting To Server ..",user,authid,iRankPos,iRankMax)
            }
            else 
            {
                
client_print(index,print_chat,"%s (%s) (%s) (RANK: %i of %i) Has Disconnected From Server!",user,ip,authid,iRankPos,iRankMax)
            }
        }
        else
        { 
            
client_print(index,print_chat,"%s (RANK: %i of %i) Is Connecting To Server ..",user,iRankPos,iRankMax)
        }
    }
    
#else
    
for (new 0inum; ++i)
    {    
        
index players[i]
        
Flags get_user_flags(index)
        if(
get_user_flags(index) & ADMIN)
        {
            if(
Flags ADMIN_IMMUNITY)
            {
                
client_print(players[i],print_chat,"%s(%s) Is Connecting To Server ..",user,authid)
            }
            else 
            {
                
client_print(index,print_chat,"%s (%s) (%s) Is Connecting To Server ..",user,ip,authid)
            }
        }
        else
        { 
            
client_print(index,print_chat,"%s Is Connecting To Server ..",user)
        }
    }
    
#endif
}



public 
client_disconnect(id)
{
    new 
authid[35],user[32],ip[32],players[32],inum
    get_user_name
(id,user,charsmax(user))
    
get_user_ip(id,ip,charsmax(ip),1)
    
get_user_authid(id,authid,charsmax(authid))
    
get_players(players,inum)
    new 
Flagsindex
    
#if defined CSSTATS
    
new izStats[8], izBody[8]
    new 
iRankPosiRankMax
    iRankPos 
get_user_stats(id,izStats,izBody)
    
iRankMax get_statsnum()
    for (new 
0inum; ++i)
    {
        
index players[i]
        
Flags get_user_flags(index)
        if(
Flags ADMIN)
        {
            if(
Flags ADMIN_IMMUNITY)
            {
                
client_print(index,print_chat,"%s  (%s) (RANK: %i of %i) Has Disconnected From Server!",user,authid,iRankPos,iRankMax)
            }
            else 
            {
                
client_print(index,print_chat,"%s (%s) (%s) (RANK: %i of %i) Has Disconnected From Server!",user,ip,authid,iRankPos,iRankMax)
            }
        }
        else
        { 
            
client_print(index,print_chat,"%s (RANK: %i of %i) Has Disconnected From Server!",user,iRankPos,iRankMax)
        }
    }
    
#else
    
for (new 0inum; ++i)
    {    
        
index players[i]
        
Flags get_user_flags(index)
        if(
get_user_flags(index) & ADMIN)
        {
            if(
Flags ADMIN_IMMUNITY)
            {
                
client_print(index,print_chat,"%s (%s) Has Disconnected From Server!",user,authid)
            }
            else 
            {
                
client_print(index,print_chat,"%s (%s) (%s) Has Disconnected From Server!",user,ip,authid)
            }
        }
        else
        { 
            
client_print(index,print_chat,"%s Has Disconnected From Server!",user)
        }
    }
    
#endif

[Problem]
Now, Admin_Immunity only sees "Playername is connecting to server .."
Doesn't even see players ip, whereas other low level admins can see players' ip.
T0FF is offline