AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hide chat Triggers (https://forums.alliedmods.net/showthread.php?t=192251)

Caldeum 08-08-2012 04:27

Hide chat Triggers
 
Please can anyone convert this code to amxmodx? and add triggers.ini file where i can add custom triggers?

PHP Code:

public OnPluginStart()
{
    
RegConsoleCmd("say"OnSay);
    
RegConsoleCmd("say_team"OnSay);
    
    
HiddenChatTriggers CreateTrie( );
    
SetTrieValue(HiddenChatTriggers"rank"true);
}

public 
Action:OnSay(clientargs)
{
    
decl String:arg[8];
    
GetCmdArgString(argsizeof arg);
    
StripQuotes(arg);
    
    new 
dummy;
    
    if (
GetTrieValue(HiddenChatTriggersargdummy))
    {
        return 
Plugin_Handled;
    }
    
    switch (
arg[0])
    {
        case 
'/''!''.':
        {
            if (
GetTrieValue(HiddenChatTriggersarg[1], dummy))
            {
                return 
Plugin_Handled;
            }
        }
    }
    return 
Plugin_Continue;



Exolent[jNr] 08-08-2012 09:45

Re: Hide chat Triggers
 
To translate this code into Pawn:

Code:
new Trie:g_tTriggers; public plugin_init( ) {     register_clcmd( "say", "CmdSay" );     register_clcmd( "say_team", "CmdSay" );         g_tTriggers = TrieCreate( );     TrieSetCell( g_tTriggers, "rank", 1 ); } public CmdSay( iPlayer ) {     new szArgs[ 8 ];     read_args( szArgs, charsmax( szArgs ) );     remove_quotes( szArgs );         new iStart = ( szArgs[ 0 ] == '/' || szArgs[ 0 ] == '!' || szArgs[ 0 ] == '.' ) ? 1 : 0;         return TrieKeyExists( g_tTriggers, szArgs[ iStart ] ) ? PLUGIN_HANDLED : PLUGIN_CONTINUE; }

This is Scripting Help, so I expect you to be able to know how to code and be able to add the part for the file yourself, or ask for help if needed.
If you can't code, then I'll move this to Suggestions/Requests where it can be done for you.

Caldeum 08-08-2012 13:21

Re: Hide chat Triggers
 
ok thanks. i check this code doesn't work for me. Any help?

Exolent[jNr] 08-08-2012 14:14

Re: Hide chat Triggers
 
I had the start index check backwards. Should work now.

Caldeum 08-08-2012 14:41

Re: Hide chat Triggers
 
Code is hiding /rank and message of rank, i don't see message of trigger.

Exolent[jNr] 08-08-2012 14:47

Re: Hide chat Triggers
 
Put this plugin after the rank plugin.

Caldeum 08-08-2012 15:20

Re: Hide chat Triggers
 
Thanks. Love you :bacon:

Caldeum 08-19-2012 05:58

Re: Hide chat Triggers
 
When another player type /rank i see his message how to hide not only when i type but when other player too?


All times are GMT -4. The time now is 05:43.

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