First I find the key values like this.
PHP Code:
LoadCampaignValues(Handle: kv, Handle: campaign_handle)
{
decl String: campaign_name[64];
do
{
// First get the section name
KvGetSectionName(kv, campaign_name, sizeof(campaign_name));
// If it needs to be translated, do so
if (StrContains(campaign_name, "L_", true) != -1)
{
Format(campaign_name, sizeof(campaign_name), "%T", campaign_name, LANG_SERVER);
}
AddMenuItem(campaign_handle, campaign_name, campaign_name);
} while (KvGotoNextKey(kv));
}
Then in the handler I have this.
PHP Code:
// Get the chosen campaign name
GetMenuItem(CampaignMenu, position, campaign_selected, sizeof(campaign_selected));
I have campaign_selected be a global string so I can use it in both functions.
The biggest problem is trying to keep it dynamic. It would be fairly easy if I was dealing with a set amount of values.