Raised This Month: $ Target: $400
 0% 

Commands in CHAT


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
shnxiyahu
Member
Join Date: Jun 2010
Old 12-08-2010 , 13:06   Commands in CHAT
Reply With Quote #1

There is any plugin that used to write commands in CHAT ?
example : if I'll write !kick X in the CHAT it will kick the player X ?

I found this : (credit to katna)
PHP Code:
#include <amxmodx>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new const AmxCmds[][]= { "ct","t","roundtime","ft","freezetime","revive","restart","rr","gag","ungag","bury",
"unbury","rocket","kick","ban","slay","slap","map","glow""noclip""godmode""pause",
"heal""weapon""ff","pass","nopass""gravity","aa","alltalk""restartserver" }


public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd"say""HandleSay" );
    
register_clcmd"say_team""HandleSay" );
}

public 
HandleSay(id) {
    new 
message[128];
    
read_argv(1message127);
    for(new 
i=0;i<sizeof(AmxCmds);i++) {
        new 
cmd[33];
        
formatex(cmd,32,"!%s",AmxCmds[i])
        if(
containi(message,cmd) == 0) {
            if(!(
get_user_flags(id) & ADMIN_CVAR))
                return 
PLUGIN_CONTINUE;
            
HandleChatCmd(id,i);
            return 
PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
HandleChatCmd(idtype) {
    new 
message[128], cmd[33], arg[65], arg2[65], name[32];
    
read_argv (1message128);
    
get_user_name(id,name,31);
    
parse(message,cmd,32,arg,64,arg2,64);
    
    switch(
type) {
        case 
1// !ct
        
case 2// !t
        
case 3// !roundtime
        
case 4,5// !ft,!freezetime
        // and you keep continue...
    
}

Now , if I want !rr to do restart like (admin_rcon sv_restart 1) , how to do this ?

Last edited by shnxiyahu; 12-08-2010 at 18:26.
shnxiyahu is offline
 



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 01:58.


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