summaryrefslogtreecommitdiff
path: root/sourcemod-1.5-dev/scripting/include/smlib/concommands.inc
diff options
context:
space:
mode:
authornavewindre <nw@moneybot.cc>2023-11-13 14:28:08 +0100
committernavewindre <nw@moneybot.cc>2023-11-13 14:28:08 +0100
commitda518fdc0f32839730ccdee8098b59c6f842d93f (patch)
treed6f856a6148c0b4d5819f88f068b7287b8044513 /sourcemod-1.5-dev/scripting/include/smlib/concommands.inc
parentbc678b10830cdaef64bcc592ca2524ebe0fcdc45 (diff)
ya
Diffstat (limited to 'sourcemod-1.5-dev/scripting/include/smlib/concommands.inc')
-rw-r--r--sourcemod-1.5-dev/scripting/include/smlib/concommands.inc47
1 files changed, 47 insertions, 0 deletions
diff --git a/sourcemod-1.5-dev/scripting/include/smlib/concommands.inc b/sourcemod-1.5-dev/scripting/include/smlib/concommands.inc
new file mode 100644
index 0000000..a90fd1c
--- /dev/null
+++ b/sourcemod-1.5-dev/scripting/include/smlib/concommands.inc
@@ -0,0 +1,47 @@
+#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 String:command[], const flags)
+{
+ return bool:(GetCommandFlags(command) & flags);
+}
+
+/**
+ * Adds one or more flags to a ConCommand.
+ *
+ * @param command ConCommand name.
+ * @param flags Flags to add.
+ * @noreturn
+ */
+stock ConCommand_AddFlags(const String:command[], const flags)
+{
+ new 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
+ * @noreturn
+ */
+stock ConCommand_RemoveFlags(const String:command[], const flags)
+{
+ new newFlags = GetCommandFlags(command);
+ newFlags &= ~flags;
+ SetCommandFlags(command, newFlags);
+}