Start prop spawner

This commit is contained in:
Jackzie 2024-01-05 19:47:33 -06:00
parent 0b189669b5
commit 015aa8081d
4 changed files with 78 additions and 2 deletions

Binary file not shown.

View file

@ -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;

View file

@ -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;
}

View file

@ -16,6 +16,7 @@ static float EMPTY_ANG[3] = { 0.0, 0.0, 0.0 };
#include <gamemodes/ents>
#include <smlib/effects>
#include <multicolors>
#include <adminmenu>
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 <hats/walls.sp>
#include <hats/hats.sp>
#include <hats/hat_presets.sp>
#include <hats/props.sp>
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;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////