summaryrefslogtreecommitdiff
path: root/source/sourcemod/scripting/include/smlib/concommands.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/scripting/include/smlib/concommands.inc
parent341db13a008dc12bb22ceb50452d93d01476308c (diff)
move source stuff to its own folder
Diffstat (limited to 'source/sourcemod/scripting/include/smlib/concommands.inc')
-rw-r--r--source/sourcemod/scripting/include/smlib/concommands.inc45
1 files changed, 45 insertions, 0 deletions
diff --git a/source/sourcemod/scripting/include/smlib/concommands.inc b/source/sourcemod/scripting/include/smlib/concommands.inc
new file mode 100644
index 0000000..2bd708f
--- /dev/null
+++ b/source/sourcemod/scripting/include/smlib/concommands.inc
@@ -0,0 +1,45 @@
+#if defined _smlib_concommands_included
+ #endinput
+#endif
+#define _smlib_concommands_included
+
+#include <sourcemod>
+#include <smlib/clients>
+
+/**
+ * Checks if a ConCommand has one or more flags set.
+ *
+ * @param command ConCommand name.
+ * @param flags Flags to check.
+ * @return True if flags are set, false otherwise.
+ */
+stock bool ConCommand_HasFlags(const char[] command, int flags)
+{
+ return GetCommandFlags(command) & flags > 0;
+}
+
+/**
+ * Adds one or more flags to a ConCommand.
+ *
+ * @param command ConCommand name.
+ * @param flags Flags to add.
+ */
+stock void ConCommand_AddFlags(const char[] command, int flags)
+{
+ int newFlags = GetCommandFlags(command);
+ newFlags |= flags;
+ SetCommandFlags(command, newFlags);
+}
+
+/**
+ * Removes one ore more flags from a ConCommand.
+ *
+ * @param command ConCommand name.
+ * @param flags Flags to remove
+ */
+stock void ConCommand_RemoveFlags(const char[] command, int flags)
+{
+ int newFlags = GetCommandFlags(command);
+ newFlags &= ~flags;
+ SetCommandFlags(command, newFlags);
+}