AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ID by IP (https://forums.alliedmods.net/showthread.php?t=51960)

6pack 02-27-2007 13:43

ID by IP
 
1 Attachment(s)
Can someone please tell me what do I have to change/do to make this plugin log ID's by IP's instead of steam ID's?

Thanks

SAMURAI16 02-27-2007 13:51

Re: ID by IP
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define MAX_IN_FILE 500  

new pnum

public plugin_init() 

    
register_plugin("StoreSteamID","v0.5","Sandurr")
    
pnum register_cvar("sv_steamidname","1")


public 
client_putinserver(id

    
set_task(3.0"check_name"id
    return 
PLUGIN_CONTINUE 


public 
client_infochanged(id

    
check_name(id
    return 
PLUGIN_CONTINUE 
}

public 
check_name(id
{
    if(
get_pcvar_num(pnum) != 1)
        return 
PLUGIN_CONTINUE;

    new 
name[32], userip[32], line[256], lengthfile[256], configsdir[256], info[32
    
get_user_name(id,name,31
    
get_user_ip(id,userip,31,1)
     
    
get_configsdir(configsdir,255
    
format(file,255,"%s/storesteamid.cfg",configsdir)
 
    

    if(!
file_exists(file)) 
    { 
        
server_print("[SteamIDName] File does not exist! ^n"
        return 
PLUGIN_CONTINUE
    


    for(new 
i=0;i<MAX_IN_FILE;i++) 
    { 
        
format(line,255,""
        
read_file(file,i,line,255,length

        if(
containi(line,userip) != -1
        { 
            if(
containi(line,name) == -1
            { 
                
format(info,31,"|%s",name
                
add(line,255,info,31
                
write_file(file,line,i
                return 
PLUGIN_CONTINUE 
            

            else 
                return 
PLUGIN_CONTINUE 
        

    } 
    
format(info,31,"%s %s",userip,name
    
write_file(file,info,-1
    return 
PLUGIN_CONTINUE 



6pack 02-27-2007 14:01

Re: ID by IP
 
Thanks, will try it out and another question, I want to change "define 500" to a much higher number, do I have to use a comma?
Example;
10000
or 10,000

SAMURAI16 02-27-2007 14:03

Re: ID by IP
 
what ?
change #define MAX_IN_FILE 500
with
#define MAX_IN_FILE 75095409865489654 if you want.

6pack 02-27-2007 14:15

Re: ID by IP
 
Quote:

Originally Posted by SAMURAI16 (Post 446331)
what ?
change #define MAX_IN_FILE 500
with
#define MAX_IN_FILE 75095409865489654 if you want.

in america we use a comma
10000
is 10,000
1000
is 1,000
dollars is 1,000.00

But you answered my question, thanks

Martin1 02-28-2007 18:15

Re: ID by IP
 
well the commas in math are used to help you organize it, not for another reason


All times are GMT -4. The time now is 00:34.

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