Hi, I'm making an API to make it easier to create new menu based/xp based mods. One of the features of the API is a way to change how the menu looks and operates, for example, you can choose to have a T Menu and a CT Menu(menustyle1) or to have just one menu for both teams(menustyle0).
I have a cvar to do this and it seems to work just fine but it requires the item plugin to be changed.
I want to know if i should use only one plugin per item and just code both menustyle0(default) and menustyle1 in the same plugin, or if i should make maybe three plugins for each item(1 for menustyle0 and 2 for menustyle1), or two plugins for each item(1 for menustyle0 and 1 for menustyle1).
I dont know what the best option is, that's why I'm asking.
Also, i don't know if this thread is in the correct section.
Example for menustyle0 and menustyle1 in the same plugin:
PHP Code:
#include <amxmodx>
#include <fun>
#include <modapi>
#define PLUGIN "MAPI: Health"
#define VERSION "0.0.1"
#define AUTHOR "ReCon & TandborsteN"
new DESCRIPTION[128] = "You get x HP every time you spawn.";
new SAVENAME[33];
new SAVENAME_T[33];
new SAVENAME_CT[33];
new ALLCOST[33];
new TCOST[33];
new CTCOST[33];
enum _:PCVARS
{
NAME,
COST,
MAXLEVEL,
MAXAMOUNT,
SAVEID
};
new g_PC[PCVARS];
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
//PCVARS
g_PC[NAME] = register_cvar("mapi_hp_name", "Health");
g_PC[COST] = register_cvar("mapi_hp_cost", "250 200");
g_PC[MAXLEVEL] = register_cvar("mapi_hp_maxlevel", "5");
g_PC[MAXAMOUNT] = register_cvar("mapi_hp_maxamount", "100");
g_PC[SAVEID] = register_cvar("mapi_hp_savename", "Health");
new t_name[32];
get_pcvar_string(g_PC[NAME], t_name, sizeof(t_name) - 1);
get_pcvar_string(g_PC[SAVEID], SAVENAME, charsmax(SAVENAME));
get_pcvar_string(g_PC[COST], ALLCOST, charsmax(ALLCOST));
strtok(ALLCOST, TCOST, charsmax(TCOST), CTCOST, charsmax(CTCOST), ' ');
formatex(SAVENAME_T, charsmax(SAVENAME_T), "%s_T", SAVENAME);
formatex(SAVENAME_CT, charsmax(SAVENAME_T), "%s_CT", SAVENAME);
if(mapi_get_menustyle() == 1) {
mapi_register_item(t_name, DESCRIPTION, str_to_num(TCOST), 1,\
get_pcvar_num(g_PC[MAXLEVEL]), get_pcvar_num(g_PC[MAXAMOUNT]), 1, "OnSpawn", SAVENAME_T, "T", "T");
mapi_register_item(t_name, DESCRIPTION, str_to_num(CTCOST), 1,\
get_pcvar_num(g_PC[MAXLEVEL]), get_pcvar_num(g_PC[MAXAMOUNT]), 1, "OnSpawn", SAVENAME_CT, "CT", "CT");
} else {
mapi_register_item(t_name, DESCRIPTION, str_to_num(TCOST), 1,\
get_pcvar_num(g_PC[MAXLEVEL]), get_pcvar_num(g_PC[MAXAMOUNT]), 1, "OnSpawn", SAVENAME, "NONE");
}
}
public _OnSpawn(id) {
Set_Health(id);
}
public Set_Health(id) {
if(mapi_get_item_level(id, SAVENAME) >= 1) {
set_user_health(id, get_pcvar_num(g_PC[MAXAMOUNT]) / get_pcvar_num(g_PC[MAXLEVEL]) * mapi_get_item_level(id, SAVENAME) + 100);
}
}
As you can see, the item has to be registered three times in total and this has me a bit worried on the larger items such as weapon chance where there are multiple items registered in the same plugin.
I just want to know what the best option would be.
__________________