Raised This Month: $32 Target: $400
 8% 

Licensed Class


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 04-21-2012 , 04:21   Licensed Class
Reply With Quote #1

Hi Allied Modders community, i whanna create a plugin only for my own IP class, i seem to succeded with IP but with class doesn't work at all here is my code:
Code:
#include < amxmodx >
#include < amxmisc >

// Licensed IP
#define LICENSED_CLASS_IP "84.247."

public plugin_init() {
    register_plugin("licensed class", "0.1", "wolfy");
    
    new LICENSED_IP[20];
    get_user_ip(0, LICENSED_IP, 21, 1);
    
    if(!containi(LICENSED_IP, LICENSED_CLASS_IP))
    {
        server_print("You have no licensed class ip, the plugin will not work.")
        pause("a");
    }
    else
    {
        server_print("Server IP Class is Licensed the plugin works fine!")
    }
}
it doesn't whanna work, what can i do ?

Thanks
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers

Last edited by CryWolf; 04-21-2012 at 04:22.
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 04-21-2012 , 04:32   Re: Licensed Class
Reply With Quote #2

amxmisc is not required. containi function returns a value which is not equal with -1 on match. get_user_ip with first argument zero will return net_address command value. I don't think you can block one plugin. If I start my server with command net_address set on 84.247. your plugin will accept me.
__________________

Last edited by claudiuhks; 04-21-2012 at 04:35.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 04-21-2012 , 04:56   Re: Licensed Class
Reply With Quote #3

I know that, but still i whanna make it work, can you give me an example of how would you do it, if you whant or anyone else, i'll really apreciated

Thank you.
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 04-21-2012 , 05:11   Re: Licensed Class
Reply With Quote #4

PHP Code:
#include < amxmodx >

// Licensed IP
#define LICENSED_CLASS_IP "84.247."

public plugin_init() {
    new 
LICENSED_IP[24];
    
get_user_ip(0LICENSED_IP231);
    
    if( !( -
!= containi(LICENSED_IPLICENSED_CLASS_IP)) )
       
set_fail_state("You have no licensed class ip, the plugin will not work.");

__________________

Last edited by claudiuhks; 04-21-2012 at 05:12.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Old 04-21-2012, 05:12
BadJoke
This message has been deleted by asherkin. Reason: Spam.
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 04-21-2012 , 05:26   Re: Licensed Class
Reply With Quote #5

Thanks claudiuhks i shall use it!

BadJoke: nu cred ca sunt permise alte limbi inafara de engleza conform acestei sectiuni, mai ales locatia ta ) bafta baieti!
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
Old 04-21-2012, 05:29
BadJoke
This message has been deleted by asherkin. Reason: Spam.
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 04-27-2012 , 11:45   Re: Licensed Class
Reply With Quote #6

BUMP:

This metod allows me to use 2 or 3 IP classes in the same plugin ? or i just need to create them separate ?

Thanks
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 04-27-2012 , 21:03   Re: Licensed Class
Reply With Quote #7

just use equali
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-28-2012 , 00:28   Re: Licensed Class
Reply With Quote #8

PHP Code:
new const LicensedIP[][] = 
{
    
"192.1.",
    
"191.13.",
    
"212.212.",
    
"33.3.",
    
"75.55.",
    
"121.88."
}
    
public 
plugin_init() 
{
    if( !
CheckServerIP() )
    {
        
server_print("You have no licensed class ip, the plugin will not work.")
        
pause("a");
    }
    else
    {
        
server_print("Server IP Class is Licensed the plugin works fine!")
    }
}

bool:CheckServerIP()
{
    new 
szIP16 ] , bool:bFound;
    
    
get_user_ipszIP charsmaxszIP ) , );
    
    for ( new 
sizeofLicensedIP ) ; i++ )
    {
        if ( 
equalszIP LicensedIP] , strlenLicensedIP] ) ) )
        {
            
bFound true;
            break;
        }
    }
    
    return 
bFound;

__________________

Last edited by Bugsy; 04-28-2012 at 00:30.
Bugsy is offline
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 04-28-2012 , 03:03   Re: Licensed Class
Reply With Quote #9

Thank you Bugsy, verry much!
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers

Last edited by CryWolf; 04-28-2012 at 03:07. Reason: it works.
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
Reply


Thread Tools
Display Modes

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 20:13.


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