Add ConVar.GetDescription() method (#1449)
* Add ConVar.GetDescription() method Issue #1432 * Update basecommands.sp Add prints description of ConVar * Revert "Update basecommands.sp" This reverts commit ad485069a837f602bdeeeb50f9e02452b3860ecd. * Remove GetConVarDescription() function
This commit is contained in:
parent
e552466886
commit
5a72644486
@ -650,6 +650,23 @@ static cell_t sm_GetConVarName(IPluginContext *pContext, const cell_t *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t sm_GetConVarDescription(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
Handle_t hndl = static_cast<Handle_t>(params[1]);
|
||||
HandleError err;
|
||||
ConVar *pConVar;
|
||||
|
||||
if ((err=g_ConVarManager.ReadConVarHandle(hndl, &pConVar))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
|
||||
}
|
||||
|
||||
pContext->StringToLocalUTF8(params[2], params[3], pConVar->GetHelpText(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool s_QueryAlreadyWarned = false;
|
||||
|
||||
static cell_t sm_QueryClientConVar(IPluginContext *pContext, const cell_t *params)
|
||||
@ -1510,6 +1527,7 @@ REGISTER_NATIVES(consoleNatives)
|
||||
{"ConVar.GetBounds", sm_GetConVarBounds},
|
||||
{"ConVar.SetBounds", sm_SetConVarBounds},
|
||||
{"ConVar.GetName", sm_GetConVarName},
|
||||
{"ConVar.GetDescription", sm_GetConVarDescription},
|
||||
{"ConVar.ReplicateToClient", ConVar_ReplicateToClient},
|
||||
{"ConVar.AddChangeHook", sm_HookConVarChange},
|
||||
{"ConVar.RemoveChangeHook", sm_UnhookConVarChange},
|
||||
|
@ -225,6 +225,12 @@ methodmap ConVar < Handle
|
||||
// @param maxlength Maximum length of string buffer.
|
||||
public native void GetName(char[] name, int maxlength);
|
||||
|
||||
// Retrieves the description of a console variable.
|
||||
//
|
||||
// @param buffer Buffer to store the description of the convar.
|
||||
// @param maxlength Maximum length of string buffer.
|
||||
public native void GetDescription(char[] buffer, int maxlength);
|
||||
|
||||
// Replicates a convar value to a specific client. This does not change the actual convar value.
|
||||
//
|
||||
// @param client Client index
|
||||
|
Loading…
Reference in New Issue
Block a user