summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/include/smlib/concommands.inc
blob: 2bd708f77b3b8dd46c4ce5c2a52efb4d81491128 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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);
}