PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
enum _:CMD_STRUCT
{
CMD_NAME [32],
CMD_INCHAT [32],
CMD_SRV [32],
CMD_USAGE [128],
CMD_LEVEL,
};
enum _:Commands
{
ROUND_TIME
}
new const CommandsList[Commands][CMD_STRUCT] =
{
// !rt - flag o (SuperAdmin)
{"RoundTime", "rt", "mp_roundtime", "", ADMIN_LEVEL_C},
}
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd ("say", "HandleSay");
register_clcmd ("say_team", "HandleSay");
}
// Say Command Handler.
public HandleSay(client)
{
new said[32];
new param[32];
new szMessage[charsmax(said) + charsmax(param) + 2];
read_argv(1, szMessage, charsmax(szMessage));
argbreak(szMessage, said, charsmax(param), param, charsmax(param));
for (new i = 0; i < Commands; i++)
{
if (equali(said[1], CommandsList[i][CMD_INCHAT]))
{
if (!(get_user_flags(client) & CommandsList[i][CMD_LEVEL]))
{
client_print_color(client, print_team_default, "%s ^3Error^1: You don't have Access Level.", PREFIX);
continue;
}
CommandSelector(i, client, param);
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
// Say Command Handler (Selector).
CommandSelector(cmd, client, param[])
{
switch(cmd)
{
case ROUND_TIME: CmdRoundTime (client, param);
}
}
// Command: Round Time.
CmdRoundTime(client, param[])
{
new num;
if (CheckMinMax(client, param, num, 1, 9))
{
set_pcvar_float(gCmdPointer[ROUND_TIME], float(num));
PrintHasSetCmd(0, client, ROUND_TIME, fmt("%.1f", num));
}
return;
}
PrintHasSetCmd(id, client, cmd, param[])
{
client_print_color(id, print_team_default, "%s ^3%n ^1has set ^4%s ^1to ^4^"%s^"", PREFIX, client, CommandsList[cmd][CMD_NAME], param);
}
// Check Min to Max.
bool:CheckMinMax(client, param[], &num, const min, const max)
{
num = str_to_num(param);
if ( !( min <= num <= max ) || !param[0])
{
client_print_color(client , print_team_default, "%s Value must be %d or %d", PREFIX, min, max);
return false;
}
/*if ( !( min <= num && num <= max) || !param[0])
{
client_print_color(client, print_team_default, "%s Value must be between %d and %d", PREFIX, min, max);
return false;
}*/
return true;
}