Raised This Month: $51 Target: $400
 12% 

Plugin like df_responses (executes server commands)


Post New Thread Reply   
 
Thread Tools Display Modes
terrum
AlliedModders Donor
Join Date: Apr 2006
Location: United Kingdom
Old 09-30-2009 , 12:52   Re: Plugin like df_responses (executes server commands)
Reply With Quote #31

Works perfectly now Thanks so so much. Will karma you both lots when I get the chance.

EDIT: Sorry to be so picky and greedy though, But could you take a look at this and help me with that too? If not, Thanks anyway http://forums.alliedmods.net/showthread.php?p=945225
__________________
Thanks,
Terrum.


terrum is offline
Send a message via AIM to terrum Send a message via MSN to terrum Send a message via Skype™ to terrum
meigyoku
BANNED
Join Date: Apr 2009
Old 09-30-2009 , 15:22   Re: Plugin like df_responses (executes server commands)
Reply With Quote #32

Exolent[jNr] , I compile it for CS 1.6 but fault:

Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
Error: Undefined symbol "TrieCreate" on line 13
Warning: Tag mismatch on line 13
Error: Undefined symbol "TrieDestroy" on line 21
Error: Undefined symbol "TrieSetCell" on line 57
Error: Undefined symbol "szCommand" on line 71
Error: Number of arguments does not match definition on line 71
Error: Undefined symbol "TrieGetCell" on line 74
Warning: Symbol is assigned a value that is never used: "g_tArrayPos" on line 104
6 Errors.
Could not locate output file C:\Program Files\AMX Mod X\amxxstudio\Untitled.amx (compile failed).
meigyoku is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-30-2009 , 15:38   Re: Plugin like df_responses (executes server commands)
Reply With Quote #33

Update your AMXX to 1.8.1
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
meigyoku
BANNED
Join Date: Apr 2009
Old 09-30-2009 , 15:54   Re: Plugin like df_responses (executes server commands)
Reply With Quote #34

I use amxx 1.8.1
Amxx-Studio 1.4.3
meigyoku is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-30-2009 , 16:28   Re: Plugin like df_responses (executes server commands)
Reply With Quote #35

The include files your compiler uses aren't 1.8.1
Reinstall the AMXX package on your computer.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
meigyoku
BANNED
Join Date: Apr 2009
Old 10-01-2009 , 01:24   Re: Plugin like df_responses (executes server commands)
Reply With Quote #36

Welcome to the AMX Mod X 1.8.1-300 Compiler.
====================
OK! Thank you!
meigyoku is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 04-25-2010 , 09:35   Re: Plugin like df_responses (executes server commands)
Reply With Quote #37

I added possibility to pass arguments from chat to execute command.

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < celltrie >

#define MAX_ARGS 5
#define MAX_ARG_LEN 64

new Trie:g_tArrayPos;
new Array:
g_aCommands;
new Array:
g_aFlags;
new Array:
g_aHideCmd;

public 
plugin_init( ) {
    
register_plugin"Say Command Macro""0.0.2""Exolent" );
    
    
register_clcmd"say""CmdSay" );
    
    
g_tArrayPos TrieCreate( );
    
g_aCommands ArrayCreate128 );
    
g_aFlags ArrayCreate);
    
g_aHideCmd ArrayCreate);
    
    
LoadCommands( );
}

public 
plugin_end( ) {
    
TrieDestroyg_tArrayPos );
    
ArrayDestroyg_aCommands );
    
ArrayDestroyg_aFlags );
    
ArrayDestroyg_aHideCmd );
}

LoadCommands( ) {
    new 
szFilename128 ];
    
get_configsdirszFilename127 );
    
addszFilename127"/say_macros.ini" );
    
    if( !
file_existsszFilename) ) {
        new 
iFile fopenszFilename"wt" );
        if( 
iFile ) {
            
fcloseiFile );
        }
        return;
    }
    
    new 
iFile fopenszFilename"rt" );
    if( !
iFile ) {
        return;
    }
    
    new 
szData512 ], szCommand32 ], szExecute128 ], szFlags27 ], szHide], iPos;
    while( !
feofiFile ) ) {
        
fgetsiFileszData511 );
        
trimszData );
        
        if( !
szData]
        || 
szData] == ';'
        
|| szData] == '/' && szData] == '/' ) {
            continue;
        }
        
        
parseszDataszCommand31szExecute127szFlags26szHide);
        
strtolowerszCommand );
        
TrieSetCellg_tArrayPosszCommandiPos );
        
ArrayPushStringg_aCommandsszExecute );
        
ArrayPushCellg_aFlagsread_flagsszFlags ) );
        
ArrayPushCellg_aHideCmdstr_to_numszHide ) );
        
iPos++;
    }
    
    
fcloseiFile );
}


public 
CmdSayclient ) {
    static 
szMessage194 ], lenijkszTmp];
    static 
szArg[MAX_ARGS][MAX_ARG_LEN], argsCnt;
    
read_argsszMessage193 );

    
len strlen(szMessage)-1
    argsCnt 
0
    k 
= -1
    
while(++i<len){
        if(
k>=0){
            if(
szMessage[i] == '^"'){
                
szArg[argsCnt++][k] = '^0';
                
k=-1;
                
+= formatexszMessage[j], 193-j"$%d"argsCnt );
            }else{
                if(
k<MAX_ARG_LEN)
                    
szArg[argsCnt][k++] = szMessage[i];
            }
        }else{
            if(
szMessage[i] == '^"'){
                if(
argsCnt<MAX_ARGS)
                    
k=0;
            }else{
                
szMessage[j++] = szMessage[i];
            }
        }
    }
    
szMessage[j] = '^0';
    if(
k!=-1){
        
szArg[argsCnt++][k] = '^0';
    }
    
strtolowerszMessage );

    static 
iArrayPos;
    if( 
TrieGetCellg_tArrayPosszMessageiArrayPos ) ) {
        if( !
accessclientArrayGetCellg_aFlagsiArrayPos ) ) ) {
            
client_printclientprint_chat"* You have no access to that command!" );
        } else {
            static 
szExecute128 ];
            
ArrayGetStringg_aCommandsiArrayPosszExecute127 );
            
            static 
szName32 ];
            
get_user_nameclientszName31 );
            
replace_allszName31"'""" );
            
replace_allszName31"^"", "" );
            
            static szAuthid[ 35 ];
            get_user_authid( client, szAuthid, 34 );
            
            static szIP[ 32 ];
            get_user_ip( client, szIP, 31, 1 );
            
            static szUserid[ 6 ];
            formatex( szUserid, 5, "
#%i", get_user_userid( client ) );
            
            
replace_allszExecute127"''""^"" );
            replace_all( szExecute, 127, "
$name", szName );
            replace_all( szExecute, 127, "
$steamid", szAuthid );
            replace_all( szExecute, 127, "
$ip", szIP );
            replace_all( szExecute, 127, "
$userid", szUserid );
            for( i=0; i<argsCnt; i++ ) {
                format( szTmp, 4, "
$%d", i+1);
                replace_all( szExecute, 127, szTmp, szArg[i] );
            }

            server_cmd( "
%s", szExecute );
            
            if( ArrayGetCell( g_aHideCmd, iArrayPos ) ) {
                return PLUGIN_HANDLED;
            }
        }
    }
    
    return PLUGIN_CONTINUE;

Config file (save it in addons/amxmodx/configs/say_macros.ini):
Code:
; "say command" "execute command" "admin flags" "hide command from chat"
; 
; Example:
; "menu" "amxmodxmenu" "u" "1"
; This will work when you say:
; say "menu"
; And it will hide your text "menu" from chat
; 
; To not hide the text, leave that part out, or set it to 0
; Example:
; "menu" "amxmodxmenu" "u"
; "kickmenu" "amx_kickmeu" "u" "0"
; 
; In the execute command, you can use these to pass yourself into the execute:
; - $name = your name
; - $steamid = your steamid
; - $ip = your ip
; - $userid = your userid
; 
; Example:
; "godon" "amx_godmode $userid 1" "m"
; "godoff" "amx_godmode $userid 0" "m"
;
; You can also use '' (two apostrophes) to represent quotes inside of the execute command,
; since (example) "amx_nick "name1" "name2"" would cause errors.
; 
; Example:
; "gametype hns" "amx_gametype ''HideNSeek Mod''; exec ''addons/amxmodx/configs/hidenseek.cfg''; sv_restart 1" "a"
; 
; If you are using the $name, $ip, or $steamid in a way that needs quotes,
; you will need to add them yourself.
; 
; Example:
; "ban me" "amx_ban ''$steamid'' 0 ''lol banned myself :D''" ""
;
;
; Passing arguments from chat to execute command:
; before comparing chat input to defined say commands, all "CONTENT" are replaced with $1, $2, $3
; after that all $number in execute command are replaced with adequate CONTENT
;
; Example1:
; "csay $1 color $2" "amx_csay $2 $name said $1 using $2 color" ""
; now if player named Player1 write in chat: csay "some message" color "green"
; then it will trigger in server console: "amx_csay green Player1 said some message using green color"
;
; Example2;
; "!nick $1 $2" "amx_nick ''$1'' ''$2''" ""
; now writing in chat: !nick "player1" "test nick"
; will trigger in server console: "amx_nick ^"Player1^" ^"test nick^""
;
; More examples (you can use them all at the same time):
; "!kick $1" "amx_kick ''$1''" "c"    ;kick without reason
; "!kick $1 $2" "amx_kick ''$1'' ''$2''" "c"    ;kick with reason
; "!ban5 $1" "amx_ban ''$1'' 5" "d"    ;short ban without reason
; "!ban5 $1 $2" "amx_ban ''$1'' 5 ''$2''" "d"    ;short ban with reason
; "!pban $1 $2" "amx_ban ''$1'' 0 ''$2''" "d"    ;permanent ban with reason
; "!hostname $1" "hostname ''$1''" "a"    ;set hostname
__________________
Impossible is Nothing

Last edited by Sylwester; 10-31-2011 at 02:49.
Sylwester is offline
RuF
Junior Member
Join Date: May 2010
Old 07-14-2010 , 15:48   Re: Plugin like df_responses (executes server commands)
Reply With Quote #38

"!hostname $1" "hostname ''$1''" "a" ;set hostname

doesnt work... $1 has a problem
__________________
RuF is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 07-14-2010 , 18:02   Re: Plugin like df_responses (executes server commands)
Reply With Quote #39

1. Make sure that plugin is running.
2. Config file must be in addons\amxmodx\configs\say_macros.ini
3. Check if you have access to chat command.
4. Arguments of chat commands must be enclosed in apostrophes when you write them in chat like this:
!hostname "new hostname"
!nick "player1" "new name"
__________________
Impossible is Nothing
Sylwester is offline
SilverShadow
Junior Member
Join Date: Aug 2014
Old 08-17-2014 , 15:35   Re: Plugin like df_responses (executes server commands)
Reply With Quote #40

ev

Last edited by SilverShadow; 09-17-2017 at 14:17. Reason: e
SilverShadow 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 02:31.


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