yes, i posted the fix for that problem
you overkill your mind doing what you want to do, there is a simpler way:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#define PREFIX "^4[TAG]^1"
enum (+=1)
{
CMD_VALUE_INT = 0,
CMD_VALUE_FLOAT
}
enum _:CMD_STRUCT
{
CMD_NAME [32],
CMD_INCHAT [32],
CMD_SRV [32],
CMD_USAGE [128],
CMD_LEVEL,
CMD_TYPE
};
new const CommandsList[Commands][CMD_STRUCT] =
{
// !rt - flag o (SuperAdmin)
{ "RoundTime", "rt", "mp_roundtime", "", ADMIN_LEVEL_C, CMD_VALUE_FLOAT },
{ "StartMoney", "sm", "mp_startmoney", "", ADMIN_LEVEL_C, CMD_VALUE_INT }
}
enum _:Commands
{
ROUND_TIME
}
public plugin_init()
{
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);
break // you want to break the loop here. you found the command, but the user doesn't has the access so is no reason to continue the loop
}
CommandSelector(i, client, param); //we know position of the command info, it's "i", so we just pass it as cmd_id
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
// Say Command Handler (Selector).
CommandSelector(cmd_id, client, param[])
{
switch(CommandsList[cmd_id][CMD_TYPE]) //we use cmd_type to know how we should set the value to the cvar pointer
{
case CMD_VALUE_INT:
{
set_pcvar_num(gCmdPointer[cmd_id], str_to_num(param))
}
case CMD_VALUE_FLOAT:
{
set_pcvar_float(gCmdPointer[cmd_id], str_to_float(param))
}
}
PrintHasSetCmd(0, client, CMD_ID, param);
}
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);
}