Add a param to register_*cmd() and get_*cmd() to indiquate info is a multilingual key + modify plugin

This commit is contained in:
Arkshine
2016-02-02 23:07:53 +01:00
committed by Arkshine
parent 664c25bdac
commit 9054643fe8
6 changed files with 77 additions and 31 deletions

View File

@ -78,7 +78,7 @@ public cmdHelp(id, level, cid)
console_print(id, "^n----- %L -----", id, "HELP_COMS")
new info[128], cmd[32], eflags
new info[128], cmd[32], eflags, bool:is_info_ml
new end = start + lHelpAmount
if (end > clcmdsnum)
@ -88,7 +88,13 @@ public cmdHelp(id, level, cid)
for (new i = start; i < end; i++)
{
get_concmd(i, cmd, charsmax(cmd), eflags, info, charsmax(info), flags, id)
get_concmd(i, cmd, charsmax(cmd), eflags, info, charsmax(info), flags, id, is_info_ml)
if (is_info_ml)
{
LookupLangKey(info, charsmax(info), info, id);
}
console_print(id, "%3d: %s %s", i + 1, cmd, info)
}

View File

@ -78,8 +78,14 @@ stock cmd_access(id, level, cid, num, bool:accesssilent = false)
}
if (read_argc() < num)
{
new hcmd[32], hinfo[128], hflag;
get_concmd(cid, hcmd, charsmax(hcmd), hflag, hinfo, charsmax(hinfo), level);
new hcmd[32], hinfo[128], hflag, bool:info_ml;
get_concmd(cid, hcmd, charsmax(hcmd), hflag, hinfo, charsmax(hinfo), level, info_ml);
if (info_ml)
{
LookupLangKey(hinfo, charsmax(hinfo), hinfo, id);
}
console_print(id, "%L: %s %s", id, "USAGE", hcmd, hinfo);
return 0;
}

View File

@ -1749,12 +1749,13 @@ native remove_user_flags(index, flags = -1, id = 0);
* @param info Command description
* @param FlagManager 0 opts out of flag manager, 1 opts in, -1 selects
* automatically
* @param info_ml If true, the parameter "info" will be looked up as multilingual key
*
* @return Command id, 0 on failure
* @error If an invalid callback function is specified, an error
* will be thrown.
*/
native register_clcmd(const client_cmd[], const function[], flags = -1, const info[] = "", FlagManager = -1);
native register_clcmd(const client_cmd[], const function[], flags = -1, const info[] = "", FlagManager = -1, bool:info_ml = false);
/**
* Registers a callback to be called when the client or server executes a
@ -1774,12 +1775,13 @@ native register_clcmd(const client_cmd[], const function[], flags = -1, const in
* @param info Command description
* @param FlagManager 0 opts out of flag manager, 1 opts in, -1 selects
* automatically
* @param info_ml If true, the parameter "info" will be looked up as multilingual key
*
* @return Command id, 0 on failure
* @error If an invalid callback function is specified, an error
* will be thrown.
*/
native register_concmd(const cmd[], const function[], flags = -1, const info[] = "", FlagManager = -1);
native register_concmd(const cmd[], const function[], flags = -1, const info[] = "", FlagManager = -1, bool:info_ml = false);
/**
* Registers a callback to be called when the server executes a command from the
@ -1792,12 +1794,13 @@ native register_concmd(const cmd[], const function[], flags = -1, const info[] =
* @param function Callback function
* @param flags Admin privilege flags required
* @param info Command description
* @param info_ml If true, the parameter "info" will be looked up as multilingual key
*
* @return Command id, 0 on failure
* @error If an invalid callback function is specified, an error
* will be thrown.
*/
native register_srvcmd(const server_cmd[], const function[], flags = -1, const info[] = "");
native register_srvcmd(const server_cmd[], const function[], flags = -1, const info[] = "", bool:info_ml = false);
/**
* Retrieves information about a client command.
@ -1813,10 +1816,11 @@ native register_srvcmd(const server_cmd[], const function[], flags = -1, const i
* @param len2 Maximum description buffer size
* @param flag Only considers commands that can be accessed with
* the specified privilege flags
* @param info_ml Variable to store whether the parameter "info" is a multilingual key
*
* @return 1 on success, 0 if command was not found
*/
native get_clcmd(index, command[], len1, &flags, info[], len2, flag);
native get_clcmd(index, command[], len1, &flags, info[], len2, flag, &bool:info_ml = false);
/**
* Returns number of registered client commands.
@ -1845,10 +1849,11 @@ native get_clcmdsnum(flag);
* @param len2 Maximum description buffer size
* @param flag Only considers commands that can be accessed with
* the specified privilege flags
* @param info_ml Variable to store whether the parameter "info" is a multilingual key
*
* @return 1 on success, 0 if command was not found
*/
native get_srvcmd(index, server_cmd[], len1, &flags, info[], len2, flag);
native get_srvcmd(index, server_cmd[], len1, &flags, info[], len2, flag, &bool:info_ml = false);
/**
* Returns number of registered server commands.
@ -1880,10 +1885,11 @@ native get_srvcmdsnum(flag);
* @param id If set to 0 only server commands will be considered,
* positive will only consider client commands, otherwise
* all console commands will be considered
* @param info_ml Variable to store whether the parameter "info" is a multilingual key
*
* @return 1 on success, 0 if command was not found
*/
native get_concmd(index, cmd[], len1, &flags, info[], len2, flag, id = -1);
native get_concmd(index, cmd[], len1, &flags, info[], len2, flag, id = -1, &bool:info_ml = false);
/**
* Returns the parent plugin id of a console command.