API documentation fix for some .inc files (#489)

* Fixed param information

* Removed whitespace that prevented the API to generate client_disconnected information

* Fixed documentation.

* Update lang.inc

* Documentation fix

(g/s)et_user_hitzones() functions weren't generating properly in the API due to a whitespace in front of the comment blocks. @return for give item() was missing.

* Whitespace prevented API documentation from generating

* Update lang.inc
This commit is contained in:
OciXCrom 2018-07-10 14:42:45 +02:00 committed by Vincent Herbet
parent 651745b1d4
commit cec42bdcae
7 changed files with 1485 additions and 1435 deletions

View File

@ -178,7 +178,7 @@ forward client_authorized(id, const authid[]);
#pragma deprecated Use client_disconnected() instead.
forward client_disconnect(id);
/**
/**
* Called when a client is disconnected from the server.
*
* @note This will be called in some additional cases that client_disconnect doesn't cover,

View File

@ -167,9 +167,9 @@ native time(&hour = 0, &minute = 0, &second = 0);
/**
* Retrieves the current date in year, month and day.
*
* @param hour Variable to store year in
* @param minute Variable to store month in
* @param second Variable to store day in
* @param year Variable to store year in
* @param month Variable to store month in
* @param day Variable to store day in
*
* @noreturn
*/

View File

@ -168,7 +168,7 @@ native delete_file(const file[], bool:use_valve_fs = false, const valve_path_id[
*/
native file_exists(const file[], bool:use_valve_fs = false);
/**
/**
* Renames a file.
*
* @param oldname New path to the file

View File

@ -157,7 +157,7 @@ native Float:floatcos(Float:value, anglemode:mode=radian);
*/
native Float:floattan(Float:value, anglemode:mode=radian);
/**
/**
* Returns the hyperbolic sine of a given angle
*
* @note For available units of measurements(modes) look at the anglemode enum
@ -170,7 +170,7 @@ native Float:floattan(Float:value, anglemode:mode=radian);
*/
native Float:floatsinh(Float:angle, anglemode:mode=radian);
/**
/**
* Returns the hyperbolic cosine of a given angle
*
* @note For available units of measurements(modes) look at the anglemode enum
@ -183,7 +183,7 @@ native Float:floatsinh(Float:angle, anglemode:mode=radian);
*/
native Float:floatcosh(Float:angle, anglemode:mode=radian);
/**
/**
* Returns the hyperbolic tangent of a given angle
*
* @note For available units of measurements(modes) look at the anglemode enum
@ -196,7 +196,7 @@ native Float:floatcosh(Float:angle, anglemode:mode=radian);
*/
native Float:floattanh(Float:angle, anglemode:mode=radian);
/**
/**
* Returns the absolute value of a floating point value
*
* @param value The floating point value to get the absolute value from
@ -208,7 +208,7 @@ native Float:floatabs(Float:value);
/* Return the angle of a sine, cosine or tangent.
* The output angle may be in radians, degrees, or grades. */
/**
/**
* Returns the angle of the given tangent
*
* @note For available units of measurements(modes) look at the anglemode enum
@ -220,7 +220,7 @@ native Float:floatabs(Float:value);
*/
native Float:floatatan(Float:angle, {anglemode,_}:radix);
/**
/**
* Returns the angle of the given cosine
*
* @note For available units of measurements(modes) look at the anglemode enum
@ -232,7 +232,7 @@ native Float:floatatan(Float:angle, {anglemode,_}:radix);
*/
native Float:floatacos(Float:angle, {anglemode,_}:radix);
/**
/**
* Returns the angle of the given sine
*
* @note For available units of measurements(modes) look at the anglemode enum
@ -244,7 +244,7 @@ native Float:floatacos(Float:angle, {anglemode,_}:radix);
*/
native Float:floatasin(Float:angle, {anglemode,_}:radix);
/**
/**
* Computes the principal value of arctangent of y/x
*
* @note Someone should verify this native, not sure what it actually does.
@ -362,7 +362,7 @@ forward operator%(Float:oper1, oper2);
forward operator%(oper1, Float:oper2);
/**
/**
* Returns whichever value is the smaller one
*
* @param ValueA The first value
@ -380,7 +380,7 @@ stock Float:floatmin(Float:ValueA, Float:ValueB)
return ValueB;
}
/**
/**
* Returns whichever value is the greater one
*
* @param ValueA The first value
@ -398,7 +398,7 @@ stock Float:floatmax(Float:ValueA, Float:ValueB)
return ValueB;
}
/**
/**
* Clamps a value between a minimum and a maximum floating point value
*
* @param Value The value to be clamped

View File

@ -29,7 +29,7 @@
*
* @return 1 if receiver hears the sender, 0 otherwise.
* @error If receiver or sender are not connected or not
* within the range of 1 to MaxClients.
* within the range of 1 to MaxClients
*/
native get_client_listen(receiver, sender);
@ -40,14 +40,14 @@ native get_client_listen(receiver, sender);
* @param sender Sender
* @param listen 1 if receiver should be able to hear sender, 0 if not
*
* @return 0 if the setting can't be done for some reason.
* @return 0 if the setting can't be done for some reason
* @error If receiver or sender are not connected or not
* within the range of 1 to MaxClients.
*/
native set_client_listen(receiver, sender, listen);
/**
* Sets player's godmode
* Sets player's godmode.
*
* @param index Client index
* @param godmode 1 to enable godmode, 0 to disable
@ -59,7 +59,7 @@ native set_client_listen(receiver, sender, listen);
native set_user_godmode(index, godmode = 0);
/**
* Tells whether a player has godmode on
* Tells whether a player has godmode on.
*
* @param index Client index
*
@ -70,7 +70,7 @@ native set_user_godmode(index, godmode = 0);
native get_user_godmode(index);
/**
* Sets player's armor amount
* Sets player's armor amount.
*
* @param index Client index
* @param armor The armor amount to set
@ -82,7 +82,7 @@ native get_user_godmode(index);
native set_user_armor(index, armor);
/**
* Sets player's health amount
* Sets player's health amount.
*
* @param index Client index
* @param health The health amount to set
@ -94,7 +94,7 @@ native set_user_armor(index, armor);
native set_user_health(index, health);
/**
* Moves a player to the given origin
* Moves a player to the given origin.
*
* @param index Client index
* @param origin Origin to move a player to
@ -106,17 +106,17 @@ native set_user_health(index, health);
native set_user_origin(index, const origin[3]);
/**
* Sets player's rendering mode
* Sets player's rendering mode.
*
* @note A really useful render modes reference:
* https://sites.google.com/site/svenmanor/rendermodes
*
* @param index Client index
* @param fx Rendering effects. One of kRenderFx* constants.
* @param fx Rendering effects. One of kRenderFx* constants
* @param r The amount of red color (0 to 255)
* @param g The amount of green color (0 to 255)
* @param b The amount of blue color (0 to 255)
* @param render Render mode. One of kRender* constants.
* @param render Render mode. One of kRender* constants
* @param amount Render amount (0 to 255)
*
* @noreturn
@ -125,30 +125,32 @@ native set_user_origin(index, const origin[3]);
*/
native set_user_rendering(index, fx = kRenderFxNone, r = 0, g = 0, b = 0, render = kRenderNormal, amount = 0);
/**
/**
* Gives an item to a player.
*
* @param index Client index
* @param item Classname of the item to give. Should start with either
* "weapon_", "ammo_", "item_" or "tf_weapon_".
* "weapon_", "ammo_", "item_" or "tf_weapon_"
*
* @noreturn
* @return Item entity index. If an invalid item name is
* given or the item failed to create, it will return 0.
* If the item was removed, it will return -1
* @error If player is not connected or not within the range
* of 1 to MaxClients or item creation fails.
*/
native give_item(index, const item[]);
/**
/**
* Sets (adds, removes) hit zones for a player.
*
* @note This actually set rules of how any player can hit any other. Example:
* set_user_hitzones(id, target, 2);
* makes @id be able to hit @target only in the head.
* @note This actually sets rules of how any player can hit any other.
* Example: set_user_hitzones(id, target, 2) - makes @id able to
* hit @target only in the head.
*
* @param index Client index
* @param target The target player
* @param body A bitsum of the body parts that can/can't be shot.
* 1 generic
* @param body A bitsum of the body parts that can/can't be shot:
* 1 - generic
* 2 - head
* 4 - chest
* 8 - stomach
@ -178,7 +180,7 @@ native set_user_hitzones(index = 0, target = 0, body = 255);
native get_user_hitzones(index, target);
/**
* Sets player's maximum movement speed
* Sets player's maximum movement speed.
*
* @param index Client index
* @param speed The maximum speed player will be able to run at
@ -190,7 +192,7 @@ native get_user_hitzones(index, target);
native set_user_maxspeed(index, Float:speed = -1.0);
/**
* Gets player's maximum movement speed
* Gets player's maximum movement speed.
*
* @param index Client index
*
@ -201,7 +203,7 @@ native set_user_maxspeed(index, Float:speed = -1.0);
native Float:get_user_maxspeed(index);
/**
* Sets player's gravity
* Sets player's gravity.
*
* @param index Client index
* @param gravity Gravity value to set, 1.0 being normal gravity (800)
@ -213,7 +215,7 @@ native Float:get_user_maxspeed(index);
native set_user_gravity(index, Float:gravity = 1.0);
/**
* Gets player's gravity
* Gets player's gravity.
*
* @param index Client index
*
@ -224,7 +226,7 @@ native set_user_gravity(index, Float:gravity = 1.0);
native Float:get_user_gravity(index);
/**
* Spawns an entity
* Spawns an entity.
*
* @param index Entity index
*
@ -235,7 +237,7 @@ native Float:get_user_gravity(index);
native spawn(index);
/**
* Sets player's noclip
* Enables or disables player's noclip.
*
* @param index Client index
* @param noclip 1 to enable noclip, 0 to disable
@ -247,7 +249,7 @@ native spawn(index);
native set_user_noclip(index, noclip = 0);
/**
* Gets player's noclip
* Gets whether a player has noclip enabled or not.
*
* @param index Client index
*
@ -258,7 +260,7 @@ native set_user_noclip(index, noclip = 0);
native get_user_noclip(index);
/**
* Tells whether a player has silent footsteps
* Tells whether a player has silent footsteps enabled.
*
* @param index Client index
*
@ -269,7 +271,7 @@ native get_user_noclip(index);
native get_user_footsteps(index);
/**
* Sets player's silent footsteps
* Enables or disables player's silent footsteps.
*
* @param index Client index
* @param set 1 if player should have silent footsteps, 0 otherwise
@ -292,7 +294,7 @@ native set_user_footsteps(id, set = 1);
native strip_user_weapons(index);
/**
* Sets player's frags amount
* Sets player's frags amount.
*
* @param index Client index
* @param frags The amount of frags to set

View File

@ -16,19 +16,43 @@
#endif
#define _lang_included
//return the number of languages loaded
/**
* Returns the number of languages loaded.
*
* @return Number of languages loaded.
*/
native get_langsnum();
//sets name to the two-letter name of a language returned by get_langsnum
//index starts at 0
/**
* Returns the two-letter name of a language returned by get_langsnum()
*
* @param id Language index, starting at 0
* @param name Buffer to store the name in
*
* @noreturn
*/
native get_lang(id, name[3]);
//registers a dictionary file, making sure the words are in the dictionary
// the file should be in "addons/amxx/data/lang/", but only the name needs to be
// given. (e.g. register_dictionary("file.txt") will be addons/amxx/data/file.txt).
/**
* Registers a dictionary file, making sure the words are in the dictionary.
*
* @note The file should be in "addons/amxmodx/data/lang", but only the name
* needs to be given. For example, register_dictionary("file.txt") will
* be "addons/amxmodx/data/lang/file.txt".
*
* @param filename Dictionary file name
*
* @return On success, the function will return 1, otherwise it will
* return 0 if the file couldn't be found or opened, and -1 if
* the dictionary was already registered by a plugin
*/
native register_dictionary(const filename[]);
//returns 1 if the language is loaded, 0 otherwise.
/**
* Checks if the language is loaded.
*
* @return 1 if it is, 0 otherwise
*/
native lang_exists(const name[]);
enum TransKey
@ -37,27 +61,47 @@ enum TransKey
};
/**
* Adds or finds a translation key.
* Creates a new or finds an existing translation key.
*
* @param key Key to create or find
*
* @return Key index
*/
native TransKey:CreateLangKey(const key[]);
/**
* Finds a translation key id without adding on failure.
* Returns -1 on not found.
* Finds a translation key index without adding on failure.
*
* @param key Key to search for
*
* @return Key index, or -1 if not found
*/
native TransKey:GetLangTransKey(const key[]);
/**
* Adds a translation.
* Adds a new translation.
*
* @param lang Two-letter language name
* @param key Language key
* @param phrase Translated text
*
* @noreturn
*/
native AddTranslation(const lang[3], TransKey:key, const phrase[]);
/**
* Looks up the translation of the key for the given type
* This does NOT format the output text.
* eg: If the key includes %s, the outputted text will also contain %s.
* NOTE: LANG_PLAYER is invalid in this, use a player index
* or LANG_SERVER
* Looks up the translation of the key for the given type.
*
* @note This does NOT format the output text! For example, if the key
* contains %s, the outputted text will also contain %s.
* @note LANG_PLAYER is invalid in this, use a player index or LANG_SERVER.
*
* @param Output Buffer to store the output in
* @param OutputSize Maximum buffer size
* @param Key Language key
* @param id Client index or LANG_SERVER
*
* @return 1 on success, 0 otherwise
*/
native LookupLangKey(Output[], OutputSize, const Key[], &id);
@ -65,7 +109,7 @@ native LookupLangKey(Output[], OutputSize, const Key[], &id);
* Sets the global language target.
*
* @note This is useful for creating functions
* that will be compatible with the %l format specifier. Note that invalid
* that will be compatible with the %l format specifier. Note that invalid
* indexes can be specified but the error will occur during translation,
* not during this function call.
*

View File

@ -26,23 +26,27 @@ enum
timeunit_weeks,
};
// seconds are in each time unit
/* Seconds in each time unit */
#define SECONDS_IN_MINUTE 60
#define SECONDS_IN_HOUR 3600
#define SECONDS_IN_DAY 86400
#define SECONDS_IN_WEEK 604800
/* Stock by Brad */
/**
* Stock by Brad.
*
* @note You must add register_dictionary("time.txt") in plugin_init()
*
* @param id The player whose language the length should be translated to
* @param unitCnt The number of time units you want translated into verbose text
* @param type The type of unit (i.e. seconds, minutes, hours, days, weeks) that you are passing in
* @param output The variable you want the verbose text to be placed in
* @param outputLen The length of the output variable
*
* @noreturn
*/
stock get_time_length(id, unitCnt, type, output[], outputLen)
{
// IMPORTANT: You must add register_dictionary("time.txt") in plugin_init()
// id: The player whose language the length should be translated to (or 0 for server language).
// unitCnt: The number of time units you want translated into verbose text.
// type: The type of unit (i.e. seconds, minutes, hours, days, weeks) that you are passing in.
// output: The variable you want the verbose text to be placed in.
// outputLen: The length of the output variable.
if (unitCnt > 0)
{
// determine the number of each time unit there are
@ -74,23 +78,23 @@ stock get_time_length(id, unitCnt, type, output[], outputLen)
new timeElement[5][33];
if (weekCnt > 0)
format(timeElement[++maxElementIdx], 32, "%i %L", weekCnt, id, (weekCnt == 1) ? "TIME_ELEMENT_WEEK" : "TIME_ELEMENT_WEEKS");
format(timeElement[++maxElementIdx], charsmax(timeElement[]), "%i %L", weekCnt, id, (weekCnt == 1) ? "TIME_ELEMENT_WEEK" : "TIME_ELEMENT_WEEKS");
if (dayCnt > 0)
format(timeElement[++maxElementIdx], 32, "%i %L", dayCnt, id, (dayCnt == 1) ? "TIME_ELEMENT_DAY" : "TIME_ELEMENT_DAYS");
format(timeElement[++maxElementIdx], charsmax(timeElement[]), "%i %L", dayCnt, id, (dayCnt == 1) ? "TIME_ELEMENT_DAY" : "TIME_ELEMENT_DAYS");
if (hourCnt > 0)
format(timeElement[++maxElementIdx], 32, "%i %L", hourCnt, id, (hourCnt == 1) ? "TIME_ELEMENT_HOUR" : "TIME_ELEMENT_HOURS");
format(timeElement[++maxElementIdx], charsmax(timeElement[]), "%i %L", hourCnt, id, (hourCnt == 1) ? "TIME_ELEMENT_HOUR" : "TIME_ELEMENT_HOURS");
if (minuteCnt > 0)
format(timeElement[++maxElementIdx], 32, "%i %L", minuteCnt, id, (minuteCnt == 1) ? "TIME_ELEMENT_MINUTE" : "TIME_ELEMENT_MINUTES");
format(timeElement[++maxElementIdx], charsmax(timeElement[]), "%i %L", minuteCnt, id, (minuteCnt == 1) ? "TIME_ELEMENT_MINUTE" : "TIME_ELEMENT_MINUTES");
if (secondCnt > 0)
format(timeElement[++maxElementIdx], 32, "%i %L", secondCnt, id, (secondCnt == 1) ? "TIME_ELEMENT_SECOND" : "TIME_ELEMENT_SECONDS");
format(timeElement[++maxElementIdx], charsmax(timeElement[]), "%i %L", secondCnt, id, (secondCnt == 1) ? "TIME_ELEMENT_SECOND" : "TIME_ELEMENT_SECONDS");
switch(maxElementIdx)
{
case 0: format(output, outputLen, "%s", timeElement[0]);
case 1: format(output, outputLen, "%s %L %s", timeElement[0], id, "TIME_ELEMENT_AND", timeElement[1]);
case 2: format(output, outputLen, "%s, %s %L %s", timeElement[0], timeElement[1], id, "TIME_ELEMENT_AND", timeElement[2]);
case 3: format(output, outputLen, "%s, %s, %s %L %s", timeElement[0], timeElement[1], timeElement[2], id, "TIME_ELEMENT_AND", timeElement[3]);
case 4: format(output, outputLen, "%s, %s, %s, %s %L %s", timeElement[0], timeElement[1], timeElement[2], timeElement[3], id, "TIME_ELEMENT_AND", timeElement[4]);
case 0: formatex(output, outputLen, "%s", timeElement[0]);
case 1: formatex(output, outputLen, "%s %L %s", timeElement[0], id, "TIME_ELEMENT_AND", timeElement[1]);
case 2: formatex(output, outputLen, "%s, %s %L %s", timeElement[0], timeElement[1], id, "TIME_ELEMENT_AND", timeElement[2]);
case 3: formatex(output, outputLen, "%s, %s, %s %L %s", timeElement[0], timeElement[1], timeElement[2], id, "TIME_ELEMENT_AND", timeElement[3]);
case 4: formatex(output, outputLen, "%s, %s, %s, %s %L %s", timeElement[0], timeElement[1], timeElement[2], timeElement[3], id, "TIME_ELEMENT_AND", timeElement[4]);
}
}
}