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

is_user_lan ( check if ip in lan ... )


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rx1983
Senior Member
Join Date: Jan 2009
Location: BRASIL
Old 01-12-2012 , 12:03   is_user_lan ( check if ip in lan ... )
Reply With Quote #1

I've been reading the plugin :
"I LOVE LAN","0.20a","Avalanche"
PHP Code:
public client_authorized(id) {

// checking
if(!is_user_LAN(id)) {
        
server_cmd("kick #%i [AMXX] Sorry, you are not in access list",get_user_userid(id));
}

is_user_LAN not existe :S
http://www.amxmodx.org/funcwiki.php?go=all_func

who does not need to run in infrastructure is connected to lan.
ie, need to check the ip, but I am not able to do this ...

example:

PHP Code:
    new ips [32]
    
//get_user_ip (id, ips, sizeof(ips)-1)
         
get_user_ipidipscharsmaxips ), );

    
    
//if( contain( ips, "10.1.1." ) == 0 )
    //if ( !contain(ips, "10.1.1")  || equal(ips, "127.0.0.1") )
    //if(( containi( ips, "10.1.1." ) != -1 ) || (containi(ips, "127.0.0.1") != -1 ))
          
if(( containips"10.1.1." ) != ) || (contain(ips"127.0.0.1") != ) || (contain(ips"10.1.1.3") != ))
    
//if((!equal(ips, "10.1.1.2")) || (!equal(ips, "127.0.0.0")) || (!equal(ips, "10.1.1.3"))  )
    
{
    
execute in not client in lan ...
    } 
none of the above forms obtained success,

I have used in a LAN + net
wanted for example:
tag put on those who do not have the following IPs:

Code:
10.1.1.2
10.1.1.3
10.1.1.4
10.1.1.5
10.1.1.6
10.1.1.7
10.1.1.8
10.1.1.9
10.1.1.10
10.1.1.11
someone could help me?
__________________

Last edited by rx1983; 01-12-2012 at 12:54.
rx1983 is offline
Send a message via MSN to rx1983
Old 01-12-2012, 12:20
kramesa
This message has been deleted by kramesa.
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 01-12-2012 , 12:30   Re: is_user_lan ( check if ip in lan ... )
Reply With Quote #2

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

public client_connect(id)
{
    new 
szDirectory[128]; 
    
get_configsdir(szDirectorycharsmax(szDirectory)); 
    
add(szDirectorycharsmax(szDirectory), "/ips.ini"); 
    
    new 
size file_size(szDirectory1)  
    
    new 
szLine[128], iLen
    
    for (new 
size i++) 
    { 
        
read_fileszDirectoryiszLinecharsmax(szLine), iLen); 
        
        new 
IP[32];
        
get_user_ip(idIP310)
        
        if(
containi(IPszLine) != -1)
        {
            new 
OldName[32], NewName[500];
            
get_user_name(idOldName32)
            
            
formatex(NewName499"[IP] %s"OldName)
            
client_cmd(id"name ^"%s^""NewName);
            return 
PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_CONTINUE;

Attached Files
File Type: ini ips.ini (100 Bytes, 68 views)
__________________

Last edited by kramesa; 01-12-2012 at 12:39.
kramesa is offline
rx1983
Senior Member
Join Date: Jan 2009
Location: BRASIL
Old 01-12-2012 , 12:37   Re: is_user_lan ( check if ip in lan ... )
Reply With Quote #3

which the function Arg[32] ??
__________________
rx1983 is offline
Send a message via MSN to rx1983
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 01-12-2012 , 12:39   Re: is_user_lan ( check if ip in lan ... )
Reply With Quote #4

Quote:
Originally Posted by rx1983 View Post
which the function Arg[32] ??
Ops.
__________________
kramesa is offline
rx1983
Senior Member
Join Date: Jan 2009
Location: BRASIL
Old 01-12-2012 , 12:50   Re: is_user_lan ( check if ip in lan ... )
Reply With Quote #5

which the function for (new i = 0 ; i < size ; i++)
?
__________________
rx1983 is offline
Send a message via MSN to rx1983
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 01-12-2012 , 12:57   Re: is_user_lan ( check if ip in lan ... )
Reply With Quote #6

Quote:
Originally Posted by rx1983 View Post
which the function for (new i = 0 ; i < size ; i++)
?
Its for that, if that plugins read a one ip
then i + 1
then plugin again read a one ip
then i+ 2

and if i = size
then plugin stop reading.
.Dare Devil. is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 01-12-2012 , 13:00   Re: is_user_lan ( check if ip in lan ... )
Reply With Quote #7

It's a loop for, like in C language.

It is to repeat a part of code X times (times set by initialize and increment a variable)
__________________
You can do anything you set your mind to, man.

Devil259 is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 01-12-2012 , 13:01   Re: is_user_lan ( check if ip in lan ... )
Reply With Quote #8

Quote:
Originally Posted by Devil259 View Post
It's a loop for, like in C language.

It is to repeat a part of code X times (times set by initialize and increment a variable)
Is my example/explanation really so bad?
.Dare Devil. is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 01-12-2012 , 13:07   Re: is_user_lan ( check if ip in lan ... )
Reply With Quote #9

Maybe.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 01-12-2012 , 13:44   Re: is_user_lan ( check if ip in lan ... )
Reply With Quote #10

Check this: https://forums.alliedmods.net/showth...58#post1529958
It will kick player if his ip is not in defined range.
__________________
Impossible is Nothing

Last edited by Sylwester; 01-12-2012 at 13:45.
Sylwester 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 18:18.


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