this one.
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
new const PREFIX[] = "^4[System]^1";
enum _:Commands
{
RESTART_ROUND, // how can hook that for public
ALLTALK,
ROUND_TIME,
SLAY
};
new const CommandsName[ Commands ] [ ] =
{
"Restart Round",
"Alltalk",
"RoundTime",
"Slay"
};
new const InChat[ Commands ] [ ] =
{
"rr",
"alltalk",
"rt",
"slay"
};
new const AccessLevel[ Commands ] =
{
ADMIN_KICK, // flag = c
ADMIN_KICK,
ADMIN_LEVEL_C, // flag o
ADMIN_SLAY
};
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd( "say", "HandleSay");
}
public HandleSay(client)
{
new Array:params;
new said[64];
new cmdline[64];
new param[32];
new i = 0,iPos = 0;
read_argv(1, said, charsmax(said));
params = ArrayCreate(sizeof(param));
formatex(cmdline, charsmax(cmdline), "%s ", said);
while(iPos < strlen(cmdline))
{
i = split_string(cmdline[iPos += i], " ", param, charsmax(param));
ArrayPushString(params, param);
}
ArrayGetString(params, 0, cmdline, charsmax(cmdline));
ArrayGetString(params, 1, param, charsmax(param));
for (new i = 0; i < Commands; i++)
{
if (!(get_user_flags(client) & AccessLevel[i]))
continue;
if (equali(cmdline[1], InChat[i]))
{
// Chat Logic.
switch(i)
{
case RESTART_ROUND:
CmdRoundRestart(client, param);
case ALLTALK:
CmdTalk(client, param);
case SLAY:
CmdSlay(client, param);
case ROUND_TIME:
CmdRoundTime(client, param);
}
ArrayDestroy(params);
return PLUGIN_HANDLED; // i want hide the command so HANDLED.
}
}
ArrayDestroy(params);
return PLUGIN_CONTINUE;
}
CmdRoundRestart(client, param[])
{
new num = str_to_num(param);
set_cvar_num("sv_restart", num > 0 ? num : 1);
client_print_color(0, print_chat, "^3%n ^1has set ^4%s ^1to ^4^"%i^"", client, CommandsName[RESTART_ROUND], num);
client_print_color(client, print_team_red, "You changed the^4 %s^1 to: %d", CommandsName[RESTART_ROUND], num);
}
CmdTalk(client, param[])
{
if (strlen(param) <= 0)
{
client_print_color(client, print_team_red, "Error: Not Parameter. ^4 %s^1 Requierd 0 or 1", CommandsName[ALLTALK]);
return;
}
new num = str_to_num(param);
set_cvar_num( "sv_alltalk", num > 0 ? 1 : 0 );
client_print_color(0, print_chat, "^3%n ^1has set ^4%s ^1to ^4^"%i^"", client, CommandsName[ALLTALK], num);
client_print_color(client, print_team_red, "You changed the^4 %s^1 to: %d", CommandsName[ALLTALK], num);
}
CmdSlay(client, param[])
{
new player = find_player("afkl", param);
if (!player)
{
client_print_color(client, print_chat, "^3Error^1: You must write a valid player.");
return PLUGIN_CONTINUE;
}
new target = get_user_userid(player);
client_cmd(client, "amx_slay #%i", target);
client_print_color(0, print_chat, "^3%n ^1has slayed ^4%n", client, target, CommandsName[SLAY]);
return PLUGIN_CONTINUE;
}
CmdRoundTime(client, param[])
{
new num = str_to_num(param);
if ( str_to_float( param ) >= 0.0 )
{
client_print_color(0, print_team_red, "%s ^3%n^1 has changed the ^4Round Time^1.", PREFIX, client);
client_print_color(client, print_team_red, "You changed the^4 Round Time^1 to: %.2f", str_to_float( param ) );
set_cvar_num( "mp_roundtime", num > 0 ? 1 : 0 );
}
}