Raised This Month: $51 Target: $400
 12% 

how to add menu items from keyvalue file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ambn
Veteran Member
Join Date: Feb 2015
Location: Fun servers
Old 01-20-2017 , 09:13   how to add menu items from keyvalue file
Reply With Quote #1

Guess there is a key value file and there is alsoa key called Name and a Value like this:
PHP Code:
"KeyValue"
{
    
"Item"
    
{
        
"Name"    "Value"
    
}
    
"Item2"
    
{
        
"Name2"    "Value2"
    
}
    
"Item3"
    
{
        
"Name3"    "Value3"
    
}

is there any way to add Names to menu from a key value file and handle their actions?
__________________

Last edited by ambn; 01-20-2017 at 09:14.
ambn is offline
noxuu
Member
Join Date: Dec 2015
Old 01-21-2017 , 10:27   Re: how to add menu items from keyvalue file
Reply With Quote #2

I using this:

Code:
KeyValues kv = CreateKeyValues("nox_shop");
	if(!kv.ImportFromFile(Shop_Config))
	{
		return;
	}
	
	if(!kv.GotoFirstSubKey())
	{
		return;
	}
	
	char MenuName[32];
	Menu menu = new Menu(MenuHandler_ShopType);
	menu.SetTitle("Shop Type");
	
	do
	{
		kv.GetSectionName(MenuName, sizeof(MenuName));
		menu.AddItem(MenuName, MenuName);
	} while (kv.GotoNextKey());
	delete kv;
	menu.Display(client, 0);
noxuu is offline
ambn
Veteran Member
Join Date: Feb 2015
Location: Fun servers
Old 01-21-2017 , 13:39   Re: how to add menu items from keyvalue file
Reply With Quote #3

well ok it's fixed but how about menu item actions and handles? can u give me yours ?
__________________
ambn is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode