summaryrefslogtreecommitdiff
path: root/source/sourcemod-1.5-dev/scripting/include/smlib/menus.inc
diff options
context:
space:
mode:
authoraura <nw@moneybot.cc>2026-02-17 23:42:09 +0100
committeraura <nw@moneybot.cc>2026-02-17 23:42:09 +0100
commit5e2eb7d67ae933b7566f1944d0bb7744da03d586 (patch)
tree054acff1113270a9cd07933df760f3768c1b6853 /source/sourcemod-1.5-dev/scripting/include/smlib/menus.inc
parent341db13a008dc12bb22ceb50452d93d01476308c (diff)
move source stuff to its own folder
Diffstat (limited to 'source/sourcemod-1.5-dev/scripting/include/smlib/menus.inc')
-rw-r--r--source/sourcemod-1.5-dev/scripting/include/smlib/menus.inc38
1 files changed, 38 insertions, 0 deletions
diff --git a/source/sourcemod-1.5-dev/scripting/include/smlib/menus.inc b/source/sourcemod-1.5-dev/scripting/include/smlib/menus.inc
new file mode 100644
index 0000000..c0c825d
--- /dev/null
+++ b/source/sourcemod-1.5-dev/scripting/include/smlib/menus.inc
@@ -0,0 +1,38 @@
+#if defined _smlib_menus_included
+ #endinput
+#endif
+#define _smlib_menus_included
+
+#include <sourcemod>
+#include <smlib/math>
+
+/**
+ * Adds an option to a menu with a String display but an integer
+ * identifying the option.
+ *
+ * @param menu Handle to the menu
+ * @param value Integer value for the option
+ * @param display Display text for the menu
+ * @noreturn
+ */
+stock Menu_AddIntItem(Handle:menu, any:value, String:display[])
+{
+ decl String:buffer[INT_MAX_DIGITS + 1];
+ IntToString(value, buffer, sizeof(buffer));
+ AddMenuItem(menu, buffer, display);
+}
+
+/**
+ * Retrieves an integer-value choice from a menu, where the
+ * menu's information strings were created as integers.
+ *
+ * @param menu Handle to the menu
+ * @param param2 The item position selected from the menu.
+ * @return Integer choice from the menu, or 0 if the integer could not be parsed.
+ */
+stock any:Menu_GetIntItem(Handle:menu, any:param2)
+{
+ decl String:buffer[INT_MAX_DIGITS + 1];
+ GetMenuItem(menu, param2, buffer, sizeof(buffer));
+ return StringToInt(buffer);
+}