ok thanks i have changed the props file. here is my code. I know it is wrong cause it doesn't work. Can anyone help me get this menu to load. It compiles but doesn't show menu in game.
PHP Code:
#include <sourcemod>
#define PLUGIN_VERSION "1.0"
new Handle:g_PropsMenu;
new Handle:kv;
public Plugin:myinfo =
{
name = "Props Menu",
author = "Mr.Pig",
description = "Props Menu",
version = PLUGIN_VERSION,
url = "http://www.sourcemod.net",
}
public OnPluginStart()
{
RegConsoleCmd("sm_props", Command_PropsMenu);
}
public OnMapStart()
{
g_PropsMenu = BuildMainMenu();
}
public OnMapEnd()
{
if (g_PropsMenu != INVALID_HANDLE)
{
CloseHandle(g_PropsMenu);
g_PropsMenu = INVALID_HANDLE;
}
}
Handle:BuildMainMenu()
{
kv = CreateKeyValues("Props");
new String:file[256], String:title[64], String:finalOutput[100];
BuildPath(Path_SM, file, 255, "configs/props.ini");
FileToKeyValues(kv, file);
if (!KvGotoFirstSubKey(kv))
{
SetFailState("Can't parse props file");
return INVALID_HANDLE;
}
decl String:name[30];
decl String:model[100];
do
{
KvGetSectionName(kv, model, sizeof(model));
FormatEx(finalOutput, sizeof(finalOutput), model);
PrecacheModel(finalOutput, true);
//height
decl String:sHeightFix[32];
KvGetString(kv, "heightfix", sHeightFix, sizeof(sHeightFix), "noo");
if(!StrEqual(sHeightFix, "noo"))
{
Format(finalOutput, sizeof(finalOutput), "%s||%s", finalOutput, sHeightFix);
}
}
while (KvGotoNextKey(kv));
KvRewind(kv);
SetMenuTitle(g_PropsMenu, "Choose a Prop");
return g_PropsMenu;
}
public Action:Command_PropsMenu(client, args)
{
if (g_PropsMenu == INVALID_HANDLE)
{
PrintToConsole(client, "The props file file was not found! command_PropsMenu");
return Plugin_Handled;
}
DisplayMenu(g_PropsMenu, client, MENU_TIME_FOREVER);
return Plugin_Handled;
}