/*
    AMX Mod X include file.

    ¦ Author  : Arkshine
    ¦ Plugin  : Cvar Util
    ¦ Version : v1.0.0
    
    (!) Support : http://forums.alliedmods.net/showthread.php?t=147286

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see http://www.gnu.org/licenses/.
*/

#if defined _cvar_util_included
    #endinput
#endif
#define _cvar_util_included

/**
 * Called when a cvar's value is changed.
 *
 * @param handleCvar    Handle to the cvar that was changed.
 * @param oldValue      String containing the value of the convar before it was changed.
 * @param newValue      String containing the new value of the convar.
 */
forward CvarHookChanged( handleCvar, const oldValue[], const newValue[] );

/**
 * Creates a hook for when a cvar's value is changed.
 * Example of callback : OnCvarChange( handleCvar, const oldValue[], const newValue[] )
 *
 * @param handleCvar    Handle to the cvar.
 * @param callback      The forward to call.
 */
native CvarHookChange( handleCvar, const callback[] );

/**
 * Starts a forward back up.
 * Use the return value from register_cvar or get_cvar_pointer here.
 *
 * @param handleCvar    The forward to re-enable.
 */
native CvarEnableHook( handleCvar );

/**
 * Stops a ham forward from triggering.
 * Use the return value from register_cvar or get_cvar_pointer here.
 *
 * @param handleCvar    Handle to the cvar.
 * @param handleCvar    The forward to stop.
 */
native CvarDisableHook( handleCvar );

/**
 * Force a cvar to be locked to a provided value.
 * Value which can be either a string or a float.
 *
 * @param handleCvar    Handle to the cvar.
 * @param value         The value to lock as string.
 * @param fvalue        The value to lock as float.
 */
native CvarLockValue( handleCvar, const value[] = "", const Float:fvalue = 0.0 );

/**
 * Unlock a cvar to force to use a specific value.
 *
 * @param               Handle to the cvar.
 */
native CvarUnlockValue( handleCvar );

/**
 * Check if a cvar is locked.
 *
 * @param               Handle to the cvar.
 * @return              -1 if not locked otherwise the plugin id from where it's locked.
 */
native CvarIsLocked( handleCvar );

/**
 * Get the cvar name from it's handle.
 *
 * @param handleCvar    Handle to the cvar.
 * @param cvar          The buffer to store the string in.
 * @param len           The string size of the buffer.
 * @return              The length of the cvar name.
 */
native CvarGetName( handleCvar, const cvar[], len );