AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] IP-s (https://forums.alliedmods.net/showthread.php?t=244468)

plazma 07-18-2014 17:52

[Help] IP-s
 
I have 3 server other ip-s but this script not work why ?

PHP Code:

#include <amxmodx> 

public plugin_init() 

    
register_plugin("Plugin de prueba""1.0""ILUSION"); 
    
CheckServerIP(); 


CheckServerIP() 

    new 
szIPs[][] = { 
        
"192.168.1.1"
        
"127.0.0.1" 
    
}; 
     
    new 
ip[16]; 
    
get_user_ip(0ipcharsmax(ip), 1); 
     
    for (new 
isizeof szIPsi++) 
    { 
        if (
equal(ipszIPs[i])) 
        { 
            
server_print("[AMXX] El servidor esta autorizado con la IP %s."szIPs[i]); 
            return; 
        }     
    } 
     
    
set_fail_state("[AMXX] Servidor no autorizado."); 



Black Rose 07-18-2014 18:19

Re: [Help] IP-s
 
There's no way of protecting plugins since you always have to provide the source when distributing it.

fysiks 07-18-2014 19:17

Re: [Help] IP-s
 
While I agree with Black Rose, I'll give you some advice that you need to know for scripting in general.

Saying "it doesn't work" rarely helps. You have to explain what about it doesn't work. That being said, you need to learn to debug your plugins to find out which part of the plugin is not working. If neither outcome is occurring then your plugin is not running (this is why you have to tell us exactly what is happening instead of saying "it doesn't work").

Once you know if the plugin is running and the function is being called, you should verify the data that you are trying to check. In this case, you need to find out what IP is actually being obtained by get_user_ip().

These are some steps that you should get used to doing (it's called debugging).

plazma 07-18-2014 19:25

Re: [Help] IP-s
 
PHP Code:

get_user_ip(), ipcharsmax(ip), 1); 

this?

Mario AR. 07-18-2014 19:30

Re: [Help] IP-s
 
I can help you because I know the plugin language (Spanish) but this is an exception. The plugin does not work because it gets the server INTERNAL IP, so that does not protect anything. You should look for another protection. A good method is to read a specific file (located in a discrete directory).

plazma 07-18-2014 19:31

Re: [Help] IP-s
 
Quote:

Originally Posted by Mario AR. (Post 2170182)
I can help you because I know the plugin language (Spanish) but this is an exception. The plugin does not work because it gets the server INTERNAL IP, so that does not protect anything. You should look for another protection. A good method is to read a specific file (located in a discrete directory).

thanks but I need for 3-ips for my servers, not PORT only IP can you help me :(

Mario AR. 07-18-2014 20:29

Re: [Help] IP-s
 
Quote:

Originally Posted by Mario AR. (Post 2170182)
You should look for another protection.

That method will not protect anything.

plazma 07-19-2014 00:23

Re: [Help] IP-s
 
This work and how to make it for 3 ips

PHP Code:

#include <amxmodx>

new const VERSION[] = "0.0.1"

new const SERVERIP[] = "173.21.157.21" 

public plugin_init()
{
    
register_plugin("protected plug"VERSION"ConnorMcLeod")

    new 
szIp[22]
    
get_user_ip(0szIpcharsmax(szIp))

    if( !
equal(szIpSERVERIP) )
    {
        
set_fail_state("Sorry, this plugin is private")
    }

    
// REGISTER STUFF HERE


exp:
PHP Code:

new const SERVERIP[] = "173.21.157.21""173.21.157.22""173.21.157.23" 

its posbile for 3 ips ??

fysiks 07-19-2014 00:44

Re: [Help] IP-s
 
You still haven't been able to tell us what is actually wrong with your plugin and you have not tried to debug it yet.

Simply use log_amx() or server_print() to find out the value of the critical variables involved to determine if they are what they should be.

I'd also like to reiterate that your endeavor (your plugin) is pointless because the solution (the BEST solution) is simply to not give your plugin to anyone.

plazma 07-22-2014 08:22

Re: [Help] IP-s
 
Thanks fysiks, but any simply script i'm noob for scripting sory... :(


All times are GMT -4. The time now is 13:11.

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