Raised This Month: $ Target: $400
 0% 

[Help] IP-s


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
plazma
Senior Member
Join Date: Oct 2013
Old 07-18-2014 , 17:52   [Help] IP-s
Reply With Quote #1

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."); 

__________________
Free Palestine ♥
plazma is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 07-18-2014 , 18:19   Re: [Help] IP-s
Reply With Quote #2

There's no way of protecting plugins since you always have to provide the source when distributing it.
__________________

Last edited by Black Rose; 07-18-2014 at 18:20.
Black Rose is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-18-2014 , 19:17   Re: [Help] IP-s
Reply With Quote #3

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).
__________________
fysiks is offline
plazma
Senior Member
Join Date: Oct 2013
Old 07-18-2014 , 19:25   Re: [Help] IP-s
Reply With Quote #4

PHP Code:
get_user_ip(), ipcharsmax(ip), 1); 
this?
__________________
Free Palestine ♥
plazma is offline
Mario AR.
Senior Member
Join Date: May 2011
Location: Lima, Perú
Old 07-18-2014 , 19:30   Re: [Help] IP-s
Reply With Quote #5

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).

Last edited by Mario AR.; 07-18-2014 at 19:30.
Mario AR. is offline
plazma
Senior Member
Join Date: Oct 2013
Old 07-18-2014 , 19:31   Re: [Help] IP-s
Reply With Quote #6

Quote:
Originally Posted by Mario AR. View Post
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
__________________
Free Palestine ♥

Last edited by plazma; 07-18-2014 at 19:33.
plazma is offline
Mario AR.
Senior Member
Join Date: May 2011
Location: Lima, Perú
Old 07-18-2014 , 20:29   Re: [Help] IP-s
Reply With Quote #7

Quote:
Originally Posted by Mario AR. View Post
You should look for another protection.
That method will not protect anything.
Mario AR. is offline
plazma
Senior Member
Join Date: Oct 2013
Old 07-19-2014 , 00:23   Re: [Help] IP-s
Reply With Quote #8

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 ??
__________________
Free Palestine ♥
plazma is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-19-2014 , 00:44   Re: [Help] IP-s
Reply With Quote #9

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.
__________________
fysiks is offline
plazma
Senior Member
Join Date: Oct 2013
Old 07-22-2014 , 08:22   Re: [Help] IP-s
Reply With Quote #10

Thanks fysiks, but any simply script i'm noob for scripting sory...
__________________
Free Palestine ♥
plazma 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 13:11.


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