added functions for getting arguments
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40523
This commit is contained in:
parent
2ba612fed7
commit
43051a0571
@ -391,6 +391,29 @@ static cell_t sm_RegAdminCmd(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t sm_GetCmdArgs(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
return engine->Cmd_Argc() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell_t sm_GetCmdArg(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
const char *arg = engine->Cmd_Argv(params[1]);
|
||||||
|
|
||||||
|
pContext->StringToLocalUTF8(params[2], params[3], arg, NULL);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell_t sm_GetCmdArgString(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
const char *args = engine->Cmd_Args();
|
||||||
|
|
||||||
|
pContext->StringToLocalUTF8(params[1], params[2], args, NULL);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
REGISTER_NATIVES(convarNatives)
|
REGISTER_NATIVES(convarNatives)
|
||||||
{
|
{
|
||||||
{"CreateConVar", sm_CreateConVar},
|
{"CreateConVar", sm_CreateConVar},
|
||||||
@ -413,5 +436,8 @@ REGISTER_NATIVES(convarNatives)
|
|||||||
{"ResetConVar", sm_ResetConVar},
|
{"ResetConVar", sm_ResetConVar},
|
||||||
{"RegServerCmd", sm_RegServerCmd},
|
{"RegServerCmd", sm_RegServerCmd},
|
||||||
{"RegConsoleCmd", sm_RegConsoleCmd},
|
{"RegConsoleCmd", sm_RegConsoleCmd},
|
||||||
|
{"GetCmdArgString", sm_GetCmdArgString},
|
||||||
|
{"GetCmdArgs", sm_GetCmdArgs},
|
||||||
|
{"GetCmdArg", sm_GetCmdArg},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
@ -132,6 +132,36 @@ native RegAdminCmd(const String:cmd[],
|
|||||||
const String:group[]="",
|
const String:group[]="",
|
||||||
flags=0);
|
flags=0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of arguments from the current console or server command.
|
||||||
|
* @note Unlike the HL2 engine call, this does not include the command itself.
|
||||||
|
*
|
||||||
|
* @return Number of arguments to the current command.
|
||||||
|
*/
|
||||||
|
native GetCmdArgs();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a command argument given its index, from the current console or
|
||||||
|
* server command.
|
||||||
|
* @note Argument indexes start at 1; 0 retrieves the command name.
|
||||||
|
*
|
||||||
|
* @param argnum Argument number to retrieve.
|
||||||
|
* @param buffer Buffer to use for storing the string.
|
||||||
|
* @param maxlength Maximum length of the buffer.
|
||||||
|
* @noreturn
|
||||||
|
*/
|
||||||
|
native GetCmdArg(argnum, String:buffer[], maxlength);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the entire command argument string in one lump from the current
|
||||||
|
* console or server command.
|
||||||
|
*
|
||||||
|
* @param buffer Buffer to use for storing the string.
|
||||||
|
* @param maxlength Maximum length of the buffer.
|
||||||
|
* @noreturn
|
||||||
|
*/
|
||||||
|
native GetCmdArgString(String:buffer[], maxlength);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new console variable.
|
* Creates a new console variable.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user