Hey all! Now, I want to ask if it is possible to switch between the size numbers of a constant. I tried with a loop, switching and cases, doeasn't work. I want to know, because I register a clcmds with a constant. They are doing pretty simillar stuff and that's why I want to add all of the functions for these cmds in one. I will give an example - the cmds are 10. Five of them give you HP, the other five give you Armor. But we will get simplier - there are two cmds. The one is giving HP, the other is giving Armor. And I'm registering the with loop like this:
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "X"
#define VERSION "1.0"
#define AUTHOR "Flicker"
new const Stuff[][]=
{
""
"say /hp",
"say /armor"
}
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
for(new i = 1; i < sizeof(Stuff); i++)
register_clcmd(Stuff[i], "TheOneFunction")
}
public TheOneFunction(id)
{
//Here I want to switch between each num of the const size. Like
//in case 1 it will set_user_healt, in case the num of the size is 2 - it will set_user_armor
//Is that possible?
}
Tried with this:
PHP Code:
public TheOneFunction(id)
{
for(new i = 1; i < sizeof(Stuff); i++)
{
switch(i)
{
case 1:
case 2:
}
}
}
Didn't work. Thanks in advance.
__________________