I understand, but why do you still need case for constant variable? You can do it without swtich - case.
This is the example:
PHP Code:
new const Stuff[][] =
{
"",
"say /hp",
"say /armor"
}
new const healthPotion[] =
{
0,
10,
20,
30
}
new const armorPotion[] =
{
0,
10,
20,
30
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
for(new i = 1; i < sizeof(Stuff); i++) register_clcmd(Stuff[i], "TheOneFunction");
}
public TheOneFunction(iIndex)
{
new szCmd[33];
read_argv(4, szCmd, sizeof szCmd);
new iNum;
if (contain(szCmd, "/hp"))
{
replace(szCmd, sizeof szCmd, "/hp ", "");
iNum = str_to_num(szCmd);
new iHealth = get_user_health(iIndex);
set_user_health(iIndex, iHealth + healthPotion[iNum]);
}
else if (contain(szCmd, "/ammo"))
{
replace(szCmd, sizeof szCmd, "/ammo ", "");
iNum = str_to_num(szCmd);
new iArmor = get_user_armor(iIndex);
set_user_armor(iIndex, iArmor + armorPotion[iNum]);
}
}
__________________