AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   add console_print here (https://forums.alliedmods.net/showthread.php?t=147913)

BackStats 01-15-2011 16:15

add console_print here
 
After blocking any command from the list it should display a message on the console player.
Ex: Forbidden command on the server.

PHP Code:

#define USING_CSTRIKE

#include <amxmodx>
#include <amxmisc>
#if defined USING_CSTRIKE
#include <cstrike>

new Trie:g_tCommands;
new 
g_iCount;
#endif

new g_szConfigFileName[ ] = { "commands_blocker.ini" };

public 
plugin_init( )
{
    
register_plugin"Commands Blocker""0.1.1""DruX" );
    
    
#if defined USING_CSTRIKE
    
g_tCommands TrieCreate( );
    
#endif
    
    
ReadFileData( );
}

#if defined USING_CSTRIKE
public plugin_end( )
{
    
TrieDestroyg_tCommands );
}

public 
CS_InternalCommandid, const szCommand[ ] )
{
    if ( 
TrieKeyExistsg_tCommandsszCommand ) )
    {
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}
#endif

public BlockCommandid )
{
    return 
PLUGIN_HANDLED;
}

ReadFileData( )
{
    new 
szConfigsDir64 ];
    
get_localinfo"amxx_configsdir"szConfigsDircharsmaxszConfigsDir ) );
    
    new 
szFilePath64 ];
    
formatexszFilePathcharsmaxszFilePath ), "%s/%s"szConfigsDirg_szConfigFileName );
    
    if ( !
file_existsszFilePath ) )
    {
        
set_fail_state"Customization file needed." );
    }
    
    new 
szData191 ];
    
    new 
fFile fopenszFilePath"rt" );
    
    while ( !
feoffFile ) )
    {
        
fgetsfFileszDatacharsmaxszData ) );
        
        
trimszData );
        
        if ( !
szData] || szData] == ';' || szData] == '/' &&  szData] == '/' )
        {
            continue;
        }
        
        
strtolowerszData );
        
        
#if defined USING_CSTRIKE
        
TrieSetCellg_tCommandsszDatag_iCount );
        
g_iCount++;
        
#endif
        
        
register_clcmdszData"BlockCommand" );
    }
    
    
fclosefFile );



fezh 01-15-2011 16:43

Re: add console_print here
 
Just wondering, why would you want such a thing?

BackStats 01-15-2011 17:00

Re: add console_print here
 
Just wondering.

fysiks 01-15-2011 19:36

Re: add console_print here
 
So, what's the question? BTW


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

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