This tutorial will about it using a commands in messagemode like: .kick, .ban and other commands if you need.
First, hook a say command or say_team in plugin_init()
Code: Select all
#include <amxmodx>
#include <amxmisc>
public plugin_init()
{
register_plugin("Say Commands","0.0.1","SmileY");
register_clcmd("say","cmdSAY");
register_clcmd("say_team","cmdSAY");
}
public cmdSAY(id)
{
new Args[192];
read_args(Args,charsmax(Args)); // Hook the args in a global say or say_team command
remove_quotes(Args);
// if contain a symbol in a begin of string, then use like as console command
if(Args[0] == '.' /*Add Here your style of commands, like '.' or '!' for example*/)
{
client_cmd(id,Args);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
} Code: Select all
register_clcmd(".kill","cmdKill",ADMIN_SLAY,"<Name | #id>"); Code: Select all
// Remember: This function is registred in console and has a .kill command!
public cmdKill(id,level,cid) // And done, use your function like in console xD
{
if(!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED;
new Arg[32];
read_argv(1,Arg,charsmax(Arg));
new iPlayer = cmd_target(id,Arg,CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF | CMDTARGET_ONLY_ALIVE);
if(!iPlayer) return PLUGIN_HANDLED;
new szName[2][32];
get_user_name(id,szName[0],charsmax(szName[]));
get_user_name(iPlayer,szName[1],charsmax(szName[]));
user_silentkill(iPlayer);
client_print(0,print_chat,"* %s has ninja killed %s",szName[0],szName[1]);
return PLUGIN_HANDLED;
} If your like to register all commands in another plugin its works!
