AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   A better way to check? (https://forums.alliedmods.net/showthread.php?t=135976)

asd13 08-21-2010 12:49

A better way to check?
 
Is there a better way to check or is it okay? : ))

PHP Code:

#include < amxmodx >
#include < regex >

new const IP [ ] = "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";

new 
g_Message[192];
new 
g_ReturnValue;
new 
g_Error[64];

public 
plugin_init() {
    
register_plugin"PLUGIN" "VERSION" "AUTHOR" );
    
    
register_clcmd"say" ,        "CheckSay" );
    
register_clcmd"say_team" ,    "CheckSay" );
}


public 
CheckSayid ) {
    
read_argsg_Message 191 );
    
    new 
Regex:g_CheckIp regex_matchg_Message IP g_ReturnValue g_Error 63 );
    if( 
g_ReturnValue ) {
        
client_printid print_chat "[ INFO ] Advertising is not allowed!" );
        
regex_freeg_CheckIp );
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;




All times are GMT -4. The time now is 21:52.

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