From 3d4e1ffd64b38634c46ddc602bd4c1ad257f9ecb Mon Sep 17 00:00:00 2001 From: Kyle Sanderson Date: Mon, 12 Aug 2013 00:42:56 +0100 Subject: [PATCH] Added helper stock to check if a command exists. (bug 5510, r=asherkin) --- plugins/include/console.inc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/include/console.inc b/plugins/include/console.inc index eeb178d2..f7dd9900 100644 --- a/plugins/include/console.inc +++ b/plugins/include/console.inc @@ -938,6 +938,16 @@ native bool:AddCommandListener(CommandListener:callback, const String:command[]= */ native RemoveCommandListener(CommandListener:callback, const String:command[]=""); +/** + * Returns true if the supplied command exists. + * + * @param command Command to find. + * @return True if command is found, false otherwise. + */ +stock bool:CommandExists(const String:command[]) +{ + return (GetCommandFlags(command) != INVALID_FCVAR_FLAGS); +} /** * Global listener for the chat commands. *