I misunderstood the problem.
It looks like the first column of the
skinCT variable represent the index of the models and second one the index of the players, and you want to save the values of the first column by player authid. If that's the case, the code you provided already does the job, otherwise you need to be more specific.
As for the menu, something like this
Code:
#include <amxmodx>
enum _:ModelData
{
NAME[32],
MODEL[32],
COST
}
new const Models[][ModelData] = {
{"Name to show in menu here", "folder name inside cstrike/models/player", 2000},
{"Another model", "folder name inside cstrike/models/player", 3000},
{"Another model", "folder name inside cstrike/models/player", 4000}
// add more models
}
public plugin_init()
{
register_plugin("Plugin", "Version", "Author")
register_clcmd("say /models", "CommandSayModels")
}
public plugin_precache()
{
for (new i = 0, buf[128]; i < sizeof Models; i++)
{
formatex(buf, charsmax(buf), "models/player/%s/%s.mdl", Models[i][MODEL], Models[i][MODEL])
precache_model(buf)
// Precache model T.mdl
formatex(buf, charsmax(buf), "models/player/%s/%sT.mdl", Models[i][MODEL], Models[i][MODEL])
if (file_exists(buf))
precache_generic(buf)
}
}
public CommandSayModels(index)
{
ShowModelsMenu(index)
return PLUGIN_HANDLED
}
ShowModelsMenu(index, page=0)
{
new menu = menu_create("Models Menu", "HandleModelsMenu")
for (new i = 0, buf[56], len, info[3]; i < sizeof Models; i++)
{
len = copy(buf, charsmax(buf), Models[i][NAME])
// if the player doesn't have that skin, add the cost
if (has_skin == false)
len += formatex(buf[len], charsmax(buf) - len, " \y%d$", Models[i][COST])
num_to_str(i, info, charsmax(info))
menu_additem(menu, buf, info)
}
menu_display(index, menu, clamp(page, 0, menu_pages(menu) - 1))
}
public HandleModelsMenu(index, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new info[3]
menu_item_getinfo(menu, item, _, info, charsmax(info))
menu_destroy(menu)
new model_index = str_to_num(info)
// do something with model_index
return PLUGIN_HANDLED
}
__________________