diff --git a/plugins/l4d2_hats.smx b/plugins/l4d2_hats.smx index f047dd4..d949b57 100644 Binary files a/plugins/l4d2_hats.smx and b/plugins/l4d2_hats.smx differ diff --git a/scripting/include/hats/hat_presets.sp b/scripting/include/hats/hat_presets.sp index 5e96687..c140325 100644 --- a/scripting/include/hats/hat_presets.sp +++ b/scripting/include/hats/hat_presets.sp @@ -36,7 +36,7 @@ enum struct HatPreset { int Apply(int client) { float offset[3], angles[3]; - int entity = this.Spawn(offset); + int entity = this.Spawn(); EquipHat(client, entity, this.type, HAT_PRESET); this.GetLocation(client, offset, angles); hatData[client].offset = offset; diff --git a/scripting/include/hats/props.sp b/scripting/include/hats/props.sp new file mode 100644 index 0000000..e126424 --- /dev/null +++ b/scripting/include/hats/props.sp @@ -0,0 +1,69 @@ +public void OnAdminMenuReady(Handle topMenuHandle) { + TopMenu topMenu = TopMenu.FromHandle(topMenuHandle); + if(topMenu != g_topMenu) { + TopMenuObject propSpawner = topMenu.AddCategory("Prop Spawner (Alpha)", Category_Handler); + if(propSpawner != INVALID_TOPMENUOBJECT) { + topMenu.AddItem("Spawn Prop", AdminMenu_Spawn, propSpawner, "sm_prop"); + topMenu.AddItem("Edit Props", AdminMenu_Edit, propSpawner, "sm_prop"); + topMenu.AddItem("Delete Props", AdminMenu_Delete, propSpawner, "sm_prop"); + topMenu.AddItem("Save / Load", AdminMenu_SaveLoad, propSpawner, "sm_prop"); + + } + } + g_topMenu = topMenu; + +} + +void Category_Handler(TopMenu topmenu, TopMenuAction action, TopMenuObject topobj_id, int param, char[] buffer, int maxlength) { + if(action == TopMenuAction_DisplayTitle) { + Format(buffer, maxlength, "Select a task:"); + } else if(action == TopMenuAction_DisplayOption) { + Format(buffer, maxlength, "Spawn Props"); + } +} +void AdminMenu_Spawn(TopMenu topmenu, TopMenuAction action, TopMenuObject object_id, int param, char[] buffer, int maxlength) { + if(action == TopMenuAction_SelectOption) { + if(!FindConVar("sv_cheats").BoolValue) { + ReplyToCommand(param, "[Props] Enable cheats to use the prop spawner"); + return; + } + // TODO: + /* + Flow: + 1. /admin -> Prop Spawner -> Spawn -> [category] -> [prop] + 2. ghost spawner active (press '?somekey?' to switch spawn mode) + 3. continue on place. press button to press? + */ + // Menu menu = new Menu(Handler_Spawn); + // menu.SetTitle("Spawn Method:"); + + // menu.AddItem("p", "Physics"); + // menu.AddItem("s", "Solid"); + // menu.AddItem("n", "Non Solid"); + + // menu.ExitBackButton = true; + // menu.ExitButton = true; + // menu.Display(param, MENU_TIME_FOREVER); + } +} +void AdminMenu_Edit(TopMenu topmenu, TopMenuAction action, TopMenuObject object_id, int param, char[] buffer, int maxlength) { + +} +void AdminMenu_Delete(TopMenu topmenu, TopMenuAction action, TopMenuObject object_id, int param, char[] buffer, int maxlength) { + +} +void AdminMenu_SaveLoad(TopMenu topmenu, TopMenuAction action, TopMenuObject object_id, int param, char[] buffer, int maxlength) { + +} + +int Handler_Spawn(Menu menu, MenuAction action, int client, int param2) { + if (action == MenuAction_Select) { + static char info[2]; + if(info[0] == 'p') { + + } + + } else if (action == MenuAction_End) + delete menu; + return 0; +} \ No newline at end of file diff --git a/scripting/l4d2_hats.sp b/scripting/l4d2_hats.sp index dabbf69..8f7d82e 100644 --- a/scripting/l4d2_hats.sp +++ b/scripting/l4d2_hats.sp @@ -16,6 +16,7 @@ static float EMPTY_ANG[3] = { 0.0, 0.0, 0.0 }; #include #include #include +#include bool tempGod[MAXPLAYERS+1]; @@ -35,10 +36,12 @@ ConVar cvar_sm_hats_rainbow_speed; ConVar cvar_sm_hats_blacklist_enabled; ConVar cvar_sm_hats_max_distance; +TopMenu g_topMenu; #include #include #include +#include public Plugin myinfo = { @@ -72,7 +75,6 @@ public void OnPluginStart() { RegAdminCmd("sm_mkwall", Command_MakeWall, ADMFLAG_CHEATS); RegAdminCmd("sm_walls", Command_ManageWalls, ADMFLAG_CHEATS); RegAdminCmd("sm_wall", Command_ManageWalls, ADMFLAG_CHEATS); - RegAdminCmd("sm_edit", Command_ManageWalls, ADMFLAG_CHEATS); RegConsoleCmd("sm_hatp", Command_DoAHatPreset); cvar_sm_hats_blacklist_enabled = CreateConVar("sm_hats_blacklist_enabled", "1", "Is the prop blacklist enabled", FCVAR_NONE, true, 0.0, true, 1.0); @@ -106,6 +108,11 @@ public void OnPluginStart() { LoadPresets(); } +public void OnLibraryRemoved(const char[] name) { + if (StrEqual(name, "adminmenu", false)) { + g_topMenu = null; + } +} ///////////////////////////////////////////////////////////////////////////////////////////////