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. #pragma deprecated Use client_disconnected() instead.
forward client_disconnect(id); forward client_disconnect(id);
/** /**
* Called when a client is disconnected from the server. * Called when a client is disconnected from the server.
* *
* @note This will be called in some additional cases that client_disconnect doesn't cover, * @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. * Retrieves the current date in year, month and day.
* *
* @param hour Variable to store year in * @param year Variable to store year in
* @param minute Variable to store month in * @param month Variable to store month in
* @param second Variable to store day in * @param day Variable to store day in
* *
* @noreturn * @noreturn
*/ */

File diff suppressed because it is too large Load Diff

View File

@ -1,422 +1,422 @@
/* Float arithmetic /* Float arithmetic
* *
* (c) Copyright 1999, Artran, Inc. * (c) Copyright 1999, Artran, Inc.
* Written by Greg Garner (gmg@artran.com) * Written by Greg Garner (gmg@artran.com)
* Modified in March 2001 to include user defined * Modified in March 2001 to include user defined
* operators for the floating point functions. * operators for the floating point functions.
* *
* This file is provided as is (no warranties). * This file is provided as is (no warranties).
*/ */
#if defined _float_included #if defined _float_included
#endinput #endinput
#endif #endif
#define _float_included #define _float_included
#pragma rational Float #pragma rational Float
/** /**
* Different methods of rounding * Different methods of rounding
*/ */
enum floatround_method { enum floatround_method {
floatround_round = 0, floatround_round = 0,
floatround_floor, floatround_floor,
floatround_ceil, floatround_ceil,
floatround_tozero floatround_tozero
}; };
/** /**
* Different units of measurement for angles * Different units of measurement for angles
*/ */
enum anglemode { enum anglemode {
radian = 0, radian = 0,
degrees, degrees,
grades grades
}; };
/** /**
* Converts an integer into a floating point value. * Converts an integer into a floating point value.
* *
* @param value Value to be converted * @param value Value to be converted
* *
* @return Converted value * @return Converted value
*/ */
native Float:float(value); native Float:float(value);
/** /**
* Converts a string into a floating point value. * Converts a string into a floating point value.
* *
* @param string Input string to be converted * @param string Input string to be converted
* *
* @return Converted value * @return Converted value
*/ */
native Float:floatstr(const string[]); native Float:floatstr(const string[]);
/** /**
* Returns the fractional part of a floating point value * Returns the fractional part of a floating point value
* *
* @param string Floating point value to get the fractional part from * @param string Floating point value to get the fractional part from
* *
* @return The fractional part * @return The fractional part
*/ */
native Float:floatfract(Float:value); native Float:floatfract(Float:value);
/** /**
* Rounds a floating point value to an integer value * Rounds a floating point value to an integer value
* *
* @note For the list of available rounding methods look at * @note For the list of available rounding methods look at
* floatround_method enumeration. * floatround_method enumeration.
* *
* @param value Floating point value to be rounded * @param value Floating point value to be rounded
* @param method Rounding method * @param method Rounding method
* *
* @return Converted value * @return Converted value
*/ */
native floatround(Float:value, floatround_method:method=floatround_round); native floatround(Float:value, floatround_method:method=floatround_round);
/** /**
* Compares two floating point values. * Compares two floating point values.
* *
* @param fOne First value to be compared * @param fOne First value to be compared
* @param fTwo Second value to be compared * @param fTwo Second value to be compared
* *
* @return If arguments are equal, returns 0. * @return If arguments are equal, returns 0.
* If the first one is greater, returns 1. * If the first one is greater, returns 1.
* If the second one is greater, returns -1. * If the second one is greater, returns -1.
*/ */
native floatcmp(Float:fOne, Float:fTwo); native floatcmp(Float:fOne, Float:fTwo);
/** /**
* Returns the square root of a floating point value * Returns the square root of a floating point value
* *
* @note Same as floatpower(value, 0.5) * @note Same as floatpower(value, 0.5)
* *
* @param value Floating point value to get square root from * @param value Floating point value to get square root from
* *
* @return Square root of the input value * @return Square root of the input value
*/ */
native Float:floatsqroot(Float:value); native Float:floatsqroot(Float:value);
/** /**
* Returns the value raised to the power of the exponent * Returns the value raised to the power of the exponent
* *
* @param value Floating point value to be raised * @param value Floating point value to be raised
* @param exponent The exponent * @param exponent The exponent
* *
* @return Value raised to the power of the exponent * @return Value raised to the power of the exponent
*/ */
native Float:floatpower(Float:value, Float:exponent); native Float:floatpower(Float:value, Float:exponent);
/** /**
* Returns the logarithm of value * Returns the logarithm of value
* *
* @param value Floating point value to calculate the logarithm for * @param value Floating point value to calculate the logarithm for
* @param base The optional logarithmic base to use. * @param base The optional logarithmic base to use.
* Defaults to 10, or the natural logarithm * Defaults to 10, or the natural logarithm
* *
* @return Square root of the input value * @return Square root of the input value
*/ */
native Float:floatlog(Float:value, Float:base=10.0); native Float:floatlog(Float:value, Float:base=10.0);
/** /**
* Returns the sine of a given angle * Returns the sine of a given angle
* *
* @note For available units of measurements(modes) look at the anglemode enum * @note For available units of measurements(modes) look at the anglemode enum
* *
* @param value The angle to calculate the sine from * @param value The angle to calculate the sine from
* @param mode What unit of measurement is the angle specified in * @param mode What unit of measurement is the angle specified in
* Defaults to radians * Defaults to radians
* *
* @return The sine of a given angle * @return The sine of a given angle
*/ */
native Float:floatsin(Float:value, anglemode:mode=radian); native Float:floatsin(Float:value, anglemode:mode=radian);
/** /**
* Returns the cosine of a given angle * Returns the cosine of a given angle
* *
* @note For available units of measurements(modes) look at the anglemode enum * @note For available units of measurements(modes) look at the anglemode enum
* *
* @param value The angle to calculate the cosine from * @param value The angle to calculate the cosine from
* @param mode What unit of measurement is the angle specified in * @param mode What unit of measurement is the angle specified in
* Defaults to radians * Defaults to radians
* *
* @return The cosine of a given angle * @return The cosine of a given angle
*/ */
native Float:floatcos(Float:value, anglemode:mode=radian); native Float:floatcos(Float:value, anglemode:mode=radian);
/** /**
* Returns the tangent of a given angle * Returns the tangent of a given angle
* *
* @note For available units of measurements(modes) look at the anglemode enum * @note For available units of measurements(modes) look at the anglemode enum
* *
* @param value The angle to calculate the tangent from * @param value The angle to calculate the tangent from
* @param mode What unit of measurement is the angle specified in * @param mode What unit of measurement is the angle specified in
* Defaults to radians * Defaults to radians
* *
* @return The tangent of a given angle * @return The tangent of a given angle
*/ */
native Float:floattan(Float:value, anglemode:mode=radian); native Float:floattan(Float:value, anglemode:mode=radian);
/** /**
* Returns the hyperbolic sine of a given angle * Returns the hyperbolic sine of a given angle
* *
* @note For available units of measurements(modes) look at the anglemode enum * @note For available units of measurements(modes) look at the anglemode enum
* *
* @param value The angle to calculate the hyperbolic sine from * @param value The angle to calculate the hyperbolic sine from
* @param mode What unit of measurement is the angle specified in * @param mode What unit of measurement is the angle specified in
* Defaults to radians * Defaults to radians
* *
* @return The hyperbolic sine of a given angle * @return The hyperbolic sine of a given angle
*/ */
native Float:floatsinh(Float:angle, anglemode:mode=radian); native Float:floatsinh(Float:angle, anglemode:mode=radian);
/** /**
* Returns the hyperbolic cosine of a given angle * Returns the hyperbolic cosine of a given angle
* *
* @note For available units of measurements(modes) look at the anglemode enum * @note For available units of measurements(modes) look at the anglemode enum
* *
* @param value The angle to calculate the hyperbolic cosine from * @param value The angle to calculate the hyperbolic cosine from
* @param mode What unit of measurement is the angle specified in * @param mode What unit of measurement is the angle specified in
* Defaults to radians * Defaults to radians
* *
* @return The hyperbolic cosine of a given angle * @return The hyperbolic cosine of a given angle
*/ */
native Float:floatcosh(Float:angle, anglemode:mode=radian); native Float:floatcosh(Float:angle, anglemode:mode=radian);
/** /**
* Returns the hyperbolic tangent of a given angle * Returns the hyperbolic tangent of a given angle
* *
* @note For available units of measurements(modes) look at the anglemode enum * @note For available units of measurements(modes) look at the anglemode enum
* *
* @param value The angle to calculate the hyperbolic tangent from * @param value The angle to calculate the hyperbolic tangent from
* @param mode What unit of measurement is the angle specified in * @param mode What unit of measurement is the angle specified in
* Defaults to radians * Defaults to radians
* *
* @return The hyperbolic tangent of a given angle * @return The hyperbolic tangent of a given angle
*/ */
native Float:floattanh(Float:angle, anglemode:mode=radian); native Float:floattanh(Float:angle, anglemode:mode=radian);
/** /**
* Returns the absolute value of a floating point value * Returns the absolute value of a floating point value
* *
* @param value The floating point value to get the absolute value from * @param value The floating point value to get the absolute value from
* *
* @return The absolute value * @return The absolute value
*/ */
native Float:floatabs(Float:value); native Float:floatabs(Float:value);
/* Return the angle of a sine, cosine or tangent. /* Return the angle of a sine, cosine or tangent.
* The output angle may be in radians, degrees, or grades. */ * The output angle may be in radians, degrees, or grades. */
/** /**
* Returns the angle of the given tangent * Returns the angle of the given tangent
* *
* @note For available units of measurements(modes) look at the anglemode enum * @note For available units of measurements(modes) look at the anglemode enum
* *
* @param value The tangent to calculate the angle from * @param value The tangent to calculate the angle from
* @param mode What unit of measurement should the output angle be in * @param mode What unit of measurement should the output angle be in
* *
* @return The angle of a tangent * @return The angle of a tangent
*/ */
native Float:floatatan(Float:angle, {anglemode,_}:radix); native Float:floatatan(Float:angle, {anglemode,_}:radix);
/** /**
* Returns the angle of the given cosine * Returns the angle of the given cosine
* *
* @note For available units of measurements(modes) look at the anglemode enum * @note For available units of measurements(modes) look at the anglemode enum
* *
* @param value The cosine to calculate the angle from * @param value The cosine to calculate the angle from
* @param mode What unit of measurement should the output angle be in * @param mode What unit of measurement should the output angle be in
* *
* @return The angle of a cosine * @return The angle of a cosine
*/ */
native Float:floatacos(Float:angle, {anglemode,_}:radix); native Float:floatacos(Float:angle, {anglemode,_}:radix);
/** /**
* Returns the angle of the given sine * Returns the angle of the given sine
* *
* @note For available units of measurements(modes) look at the anglemode enum * @note For available units of measurements(modes) look at the anglemode enum
* *
* @param value The sine to calculate the angle from * @param value The sine to calculate the angle from
* @param mode What unit of measurement should the output angle be in * @param mode What unit of measurement should the output angle be in
* *
* @return The angle of a sine * @return The angle of a sine
*/ */
native Float:floatasin(Float:angle, {anglemode,_}:radix); native Float:floatasin(Float:angle, {anglemode,_}:radix);
/** /**
* Computes the principal value of arctangent of y/x * Computes the principal value of arctangent of y/x
* *
* @note Someone should verify this native, not sure what it actually does. * @note Someone should verify this native, not sure what it actually does.
* @note For available units of measurements(modes) look at the anglemode enum * @note For available units of measurements(modes) look at the anglemode enum
* *
* @param x Value representing the proportion of the x-coordinate. * @param x Value representing the proportion of the x-coordinate.
* @param y Value representing the proportion of the x-coordinate. * @param y Value representing the proportion of the x-coordinate.
* @param mode What unit of measurement should the output angle be in * @param mode What unit of measurement should the output angle be in
* *
* @return Arctangent of y/x * @return Arctangent of y/x
*/ */
native Float:floatatan2(Float:x, Float:y, {anglemode,_}:radix); native Float:floatatan2(Float:x, Float:y, {anglemode,_}:radix);
/* Multiply two floats together */ /* Multiply two floats together */
native Float:floatmul(Float:oper1, Float:oper2); native Float:floatmul(Float:oper1, Float:oper2);
/* Divide the dividend float by the divisor float */ /* Divide the dividend float by the divisor float */
native Float:floatdiv(Float:dividend, Float:divisor); native Float:floatdiv(Float:dividend, Float:divisor);
/* Add two floats together */ /* Add two floats together */
native Float:floatadd(Float:dividend, Float:divisor); native Float:floatadd(Float:dividend, Float:divisor);
/* Subtract oper2 float from oper1 float */ /* Subtract oper2 float from oper1 float */
native Float:floatsub(Float:oper1, Float:oper2); native Float:floatsub(Float:oper1, Float:oper2);
/* user defined operators */ /* user defined operators */
native Float:operator*(Float:oper1, Float:oper2) = floatmul; native Float:operator*(Float:oper1, Float:oper2) = floatmul;
native Float:operator/(Float:oper1, Float:oper2) = floatdiv; native Float:operator/(Float:oper1, Float:oper2) = floatdiv;
native Float:operator+(Float:oper1, Float:oper2) = floatadd; native Float:operator+(Float:oper1, Float:oper2) = floatadd;
native Float:operator-(Float:oper1, Float:oper2) = floatsub; native Float:operator-(Float:oper1, Float:oper2) = floatsub;
stock Float:operator++(Float:oper) stock Float:operator++(Float:oper)
return oper+1.0; return oper+1.0;
stock Float:operator--(Float:oper) stock Float:operator--(Float:oper)
return oper-1.0; return oper-1.0;
stock Float:operator-(Float:oper) stock Float:operator-(Float:oper)
return oper^Float:cellmin; /* IEEE values are sign/magnitude */ return oper^Float:cellmin; /* IEEE values are sign/magnitude */
stock Float:operator*(Float:oper1, oper2) stock Float:operator*(Float:oper1, oper2)
return floatmul(oper1, float(oper2)); /* "*" is commutative */ return floatmul(oper1, float(oper2)); /* "*" is commutative */
stock Float:operator/(Float:oper1, oper2) stock Float:operator/(Float:oper1, oper2)
return floatdiv(oper1, float(oper2)); return floatdiv(oper1, float(oper2));
stock Float:operator/(oper1, Float:oper2) stock Float:operator/(oper1, Float:oper2)
return floatdiv(float(oper1), oper2); return floatdiv(float(oper1), oper2);
stock Float:operator+(Float:oper1, oper2) stock Float:operator+(Float:oper1, oper2)
return floatadd(oper1, float(oper2)); /* "+" is commutative */ return floatadd(oper1, float(oper2)); /* "+" is commutative */
stock Float:operator-(Float:oper1, oper2) stock Float:operator-(Float:oper1, oper2)
return floatsub(oper1, float(oper2)); return floatsub(oper1, float(oper2));
stock Float:operator-(oper1, Float:oper2) stock Float:operator-(oper1, Float:oper2)
return floatsub(float(oper1), oper2); return floatsub(float(oper1), oper2);
stock bool:operator==(Float:oper1, Float:oper2) stock bool:operator==(Float:oper1, Float:oper2)
return floatcmp(oper1, oper2) == 0; return floatcmp(oper1, oper2) == 0;
stock bool:operator==(Float:oper1, oper2) stock bool:operator==(Float:oper1, oper2)
return floatcmp(oper1, float(oper2)) == 0; /* "==" is commutative */ return floatcmp(oper1, float(oper2)) == 0; /* "==" is commutative */
stock bool:operator!=(Float:oper1, Float:oper2) stock bool:operator!=(Float:oper1, Float:oper2)
return floatcmp(oper1, oper2) != 0; return floatcmp(oper1, oper2) != 0;
stock bool:operator!=(Float:oper1, oper2) stock bool:operator!=(Float:oper1, oper2)
return floatcmp(oper1, float(oper2)) != 0; /* "==" is commutative */ return floatcmp(oper1, float(oper2)) != 0; /* "==" is commutative */
stock bool:operator>(Float:oper1, Float:oper2) stock bool:operator>(Float:oper1, Float:oper2)
return floatcmp(oper1, oper2) > 0; return floatcmp(oper1, oper2) > 0;
stock bool:operator>(Float:oper1, oper2) stock bool:operator>(Float:oper1, oper2)
return floatcmp(oper1, float(oper2)) > 0; return floatcmp(oper1, float(oper2)) > 0;
stock bool:operator>(oper1, Float:oper2) stock bool:operator>(oper1, Float:oper2)
return floatcmp(float(oper1), oper2) > 0; return floatcmp(float(oper1), oper2) > 0;
stock bool:operator>=(Float:oper1, Float:oper2) stock bool:operator>=(Float:oper1, Float:oper2)
return floatcmp(oper1, oper2) >= 0; return floatcmp(oper1, oper2) >= 0;
stock bool:operator>=(Float:oper1, oper2) stock bool:operator>=(Float:oper1, oper2)
return floatcmp(oper1, float(oper2)) >= 0; return floatcmp(oper1, float(oper2)) >= 0;
stock bool:operator>=(oper1, Float:oper2) stock bool:operator>=(oper1, Float:oper2)
return floatcmp(float(oper1), oper2) >= 0; return floatcmp(float(oper1), oper2) >= 0;
stock bool:operator<(Float:oper1, Float:oper2) stock bool:operator<(Float:oper1, Float:oper2)
return floatcmp(oper1, oper2) < 0; return floatcmp(oper1, oper2) < 0;
stock bool:operator<(Float:oper1, oper2) stock bool:operator<(Float:oper1, oper2)
return floatcmp(oper1, float(oper2)) < 0; return floatcmp(oper1, float(oper2)) < 0;
stock bool:operator<(oper1, Float:oper2) stock bool:operator<(oper1, Float:oper2)
return floatcmp(float(oper1), oper2) < 0; return floatcmp(float(oper1), oper2) < 0;
stock bool:operator<=(Float:oper1, Float:oper2) stock bool:operator<=(Float:oper1, Float:oper2)
return floatcmp(oper1, oper2) <= 0; return floatcmp(oper1, oper2) <= 0;
stock bool:operator<=(Float:oper1, oper2) stock bool:operator<=(Float:oper1, oper2)
return floatcmp(oper1, float(oper2)) <= 0; return floatcmp(oper1, float(oper2)) <= 0;
stock bool:operator<=(oper1, Float:oper2) stock bool:operator<=(oper1, Float:oper2)
return floatcmp(float(oper1), oper2) <= 0; return floatcmp(float(oper1), oper2) <= 0;
stock bool:operator!(Float:oper) stock bool:operator!(Float:oper)
return (_:oper & ((-1)/2)) == 0; /* -1 = all bits to 1; /2 = remove most significant bit (sign) return (_:oper & ((-1)/2)) == 0; /* -1 = all bits to 1; /2 = remove most significant bit (sign)
works on both 32bit and 64bit systems; no constant required */ works on both 32bit and 64bit systems; no constant required */
/* forbidden operations */ /* forbidden operations */
forward operator%(Float:oper1, Float:oper2); forward operator%(Float:oper1, Float:oper2);
forward operator%(Float:oper1, oper2); forward operator%(Float:oper1, oper2);
forward operator%(oper1, Float:oper2); forward operator%(oper1, Float:oper2);
/** /**
* Returns whichever value is the smaller one * Returns whichever value is the smaller one
* *
* @param ValueA The first value * @param ValueA The first value
* @param ValueB The second value * @param ValueB The second value
* *
* @return ValueA if it is smaller than ValueB, and vice versa * @return ValueA if it is smaller than ValueB, and vice versa
*/ */
stock Float:floatmin(Float:ValueA, Float:ValueB) stock Float:floatmin(Float:ValueA, Float:ValueB)
{ {
if (ValueA<=ValueB) if (ValueA<=ValueB)
{ {
return ValueA; return ValueA;
} }
return ValueB; return ValueB;
} }
/** /**
* Returns whichever value is the greater one * Returns whichever value is the greater one
* *
* @param ValueA The first value * @param ValueA The first value
* @param ValueB The second value * @param ValueB The second value
* *
* @return ValueA if it is greater than ValueB, and vice versa * @return ValueA if it is greater than ValueB, and vice versa
*/ */
stock Float:floatmax(Float:ValueA, Float:ValueB) stock Float:floatmax(Float:ValueA, Float:ValueB)
{ {
if (ValueA>=ValueB) if (ValueA>=ValueB)
{ {
return ValueA; return ValueA;
} }
return ValueB; return ValueB;
} }
/** /**
* Clamps a value between a minimum and a maximum floating point value * Clamps a value between a minimum and a maximum floating point value
* *
* @param Value The value to be clamped * @param Value The value to be clamped
* @param MinValue Minimum value * @param MinValue Minimum value
* @param MaxValue Maximum value * @param MaxValue Maximum value
* *
* @return The Value clamped between MinValue and MaxValue * @return The Value clamped between MinValue and MaxValue
*/ */
stock Float:floatclamp(Float:Value, Float:MinValue, Float:MaxValue) stock Float:floatclamp(Float:Value, Float:MinValue, Float:MaxValue)
{ {
if (Value<=MinValue) if (Value<=MinValue)
{ {
return MinValue; return MinValue;
} }
if (Value>=MaxValue) if (Value>=MaxValue)
{ {
return MaxValue; return MaxValue;
} }
return Value; return Value;
} }

View File

@ -1,304 +1,306 @@
// vim: set ts=4 sw=4 tw=99 noet: // vim: set ts=4 sw=4 tw=99 noet:
// //
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO"). // AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team. // Copyright (C) The AMX Mod X Development Team.
// //
// This software is licensed under the GNU General Public License, version 3 or higher. // This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit: // Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license // https://alliedmods.net/amxmodx-license
// //
// Fun Functions // Fun Functions
// //
#if defined _fun_included #if defined _fun_included
#endinput #endinput
#endif #endif
#define _fun_included #define _fun_included
#pragma reqlib fun #pragma reqlib fun
#if !defined AMXMODX_NOAUTOLOAD #if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib fun #pragma loadlib fun
#endif #endif
/** /**
* Tells whether receiver hears sender via voice communication. * Tells whether receiver hears sender via voice communication.
* *
* @param receiver Receiver * @param receiver Receiver
* @param sender Sender * @param sender Sender
* *
* @return 1 if receiver hears the sender, 0 otherwise. * @return 1 if receiver hears the sender, 0 otherwise.
* @error If receiver or sender are not connected or not * @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); native get_client_listen(receiver, sender);
/** /**
* Sets who can listen who. * Sets who can listen who.
* *
* @param receiver Receiver * @param receiver Receiver
* @param sender Sender * @param sender Sender
* @param listen 1 if receiver should be able to hear sender, 0 if not * @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 * @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 set_client_listen(receiver, sender, listen); native set_client_listen(receiver, sender, listen);
/** /**
* Sets player's godmode * Sets player's godmode.
* *
* @param index Client index * @param index Client index
* @param godmode 1 to enable godmode, 0 to disable * @param godmode 1 to enable godmode, 0 to disable
* *
* @noreturn * @noreturn
* @error If player is not connected or not within the range * @error If player is not connected or not within the range
* of 1 to MaxClients. * of 1 to MaxClients.
*/ */
native set_user_godmode(index, godmode = 0); 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 * @param index Client index
* *
* @return 1 if player has godmode on, 0 if not * @return 1 if player has godmode on, 0 if not
* @error If player is not connected or not within the range * @error If player is not connected or not within the range
* of 1 to MaxClients. * of 1 to MaxClients.
*/ */
native get_user_godmode(index); native get_user_godmode(index);
/** /**
* Sets player's armor amount * Sets player's armor amount.
* *
* @param index Client index * @param index Client index
* @param armor The armor amount to set * @param armor The armor amount to set
* *
* @noreturn * @noreturn
* @error If player is not connected or not within the range * @error If player is not connected or not within the range
* of 1 to MaxClients. * of 1 to MaxClients.
*/ */
native set_user_armor(index, armor); native set_user_armor(index, armor);
/** /**
* Sets player's health amount * Sets player's health amount.
* *
* @param index Client index * @param index Client index
* @param health The health amount to set * @param health The health amount to set
* *
* @noreturn * @noreturn
* @error If player is not connected or not within the range * @error If player is not connected or not within the range
* of 1 to MaxClients. * of 1 to MaxClients.
*/ */
native set_user_health(index, health); 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 index Client index
* @param origin Origin to move a player to * @param origin Origin to move a player to
* *
* @noreturn * @noreturn
* @error If player is not connected or not within the range * @error If player is not connected or not within the range
* of 1 to MaxClients. * of 1 to MaxClients.
*/ */
native set_user_origin(index, const origin[3]); 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: * @note A really useful render modes reference:
* https://sites.google.com/site/svenmanor/rendermodes * https://sites.google.com/site/svenmanor/rendermodes
* *
* @param index Client index * @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 r The amount of red color (0 to 255)
* @param g The amount of green 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 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) * @param amount Render amount (0 to 255)
* *
* @noreturn * @noreturn
* @error If player is not connected or not within the range * @error If player is not connected or not within the range
* of 1 to MaxClients. * of 1 to MaxClients.
*/ */
native set_user_rendering(index, fx = kRenderFxNone, r = 0, g = 0, b = 0, render = kRenderNormal, amount = 0); native set_user_rendering(index, fx = kRenderFxNone, r = 0, g = 0, b = 0, render = kRenderNormal, amount = 0);
/** /**
* Gives an item to a player. * Gives an item to a player.
* *
* @param index Client index * @param index Client index
* @param item Classname of the item to give. Should start with either * @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
* @error If player is not connected or not within the range * given or the item failed to create, it will return 0.
* of 1 to MaxClients or item creation fails. * If the item was removed, it will return -1
*/ * @error If player is not connected or not within the range
native give_item(index, const item[]); * 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: * Sets (adds, removes) hit zones for a player.
* 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
* @param index Client index * hit @target only in the head.
* @param target The target player *
* @param body A bitsum of the body parts that can/can't be shot. * @param index Client index
* 1 generic * @param target The target player
* 2 - head * @param body A bitsum of the body parts that can/can't be shot:
* 4 - chest * 1 - generic
* 8 - stomach * 2 - head
* 16 - left arm * 4 - chest
* 32 - right arm * 8 - stomach
* 64 - left leg * 16 - left arm
* 128 - right leg * 32 - right arm
* * 64 - left leg
* @noreturn * 128 - right leg
* @error If player is not connected or not within the range *
* of 1 to MaxClients. * @noreturn
*/ * @error If player is not connected or not within the range
native set_user_hitzones(index = 0, target = 0, body = 255); * of 1 to MaxClients.
*/
/** native set_user_hitzones(index = 0, target = 0, body = 255);
* Gets the set of hit zone "rules" between @index and @target players.
* /**
* @note For the body part bitsum take a look at the set_user_hitzones() native. * Gets the set of hit zone "rules" between @index and @target players.
* *
* @param index Client index * @note For the body part bitsum take a look at the set_user_hitzones() native.
* @param target The target player *
* * @param index Client index
* @return The bitsum of @target's body parts @index is able to hit * @param target The target player
* @error If player is not connected or not within the range *
* of 1 to MaxClients. * @return The bitsum of @target's body parts @index is able to hit
*/ * @error If player is not connected or not within the range
native get_user_hitzones(index, target); * of 1 to MaxClients.
*/
/** native get_user_hitzones(index, target);
* Sets player's maximum movement speed
* /**
* @param index Client index * Sets player's maximum movement speed.
* @param speed The maximum speed player will be able to run at *
* * @param index Client index
* @noreturn * @param speed The maximum speed player will be able to run at
* @error If player is not connected or not within the range *
* of 1 to MaxClients. * @noreturn
*/ * @error If player is not connected or not within the range
native set_user_maxspeed(index, Float:speed = -1.0); * of 1 to MaxClients.
*/
/** native set_user_maxspeed(index, Float:speed = -1.0);
* Gets player's maximum movement speed
* /**
* @param index Client index * Gets player's maximum movement speed.
* *
* @return Player's maximum movement speed * @param index Client index
* @error If player is not connected or not within the range *
* of 1 to MaxClients. * @return Player's maximum movement speed
*/ * @error If player is not connected or not within the range
native Float:get_user_maxspeed(index); * of 1 to MaxClients.
*/
/** native Float:get_user_maxspeed(index);
* Sets player's gravity
* /**
* @param index Client index * Sets player's gravity.
* @param gravity Gravity value to set, 1.0 being normal gravity (800) *
* * @param index Client index
* @noreturn * @param gravity Gravity value to set, 1.0 being normal gravity (800)
* @error If player is not connected or not within the range *
* of 1 to MaxClients. * @noreturn
*/ * @error If player is not connected or not within the range
native set_user_gravity(index, Float:gravity = 1.0); * of 1 to MaxClients.
*/
/** native set_user_gravity(index, Float:gravity = 1.0);
* Gets player's gravity
* /**
* @param index Client index * Gets player's gravity.
* *
* @return Player's gravity value, 1.0 being normal gravity (800) * @param index Client index
* @error If player is not connected or not within the range *
* of 1 to MaxClients. * @return Player's gravity value, 1.0 being normal gravity (800)
*/ * @error If player is not connected or not within the range
native Float:get_user_gravity(index); * of 1 to MaxClients.
*/
/** native Float:get_user_gravity(index);
* Spawns an entity
* /**
* @param index Entity index * Spawns an entity.
* *
* @noreturn * @param index Entity index
* @error If player is not connected or not within the range *
* of 1 to MaxClients. * @noreturn
*/ * @error If player is not connected or not within the range
native spawn(index); * of 1 to MaxClients.
*/
/** native spawn(index);
* Sets player's noclip
* /**
* @param index Client index * Enables or disables player's noclip.
* @param noclip 1 to enable noclip, 0 to disable *
* * @param index Client index
* @noreturn * @param noclip 1 to enable noclip, 0 to disable
* @error If player is not connected or not within the range *
* of 1 to MaxClients. * @noreturn
*/ * @error If player is not connected or not within the range
native set_user_noclip(index, noclip = 0); * of 1 to MaxClients.
*/
/** native set_user_noclip(index, noclip = 0);
* Gets player's noclip
* /**
* @param index Client index * Gets whether a player has noclip enabled or not.
* *
* @return 1 if noclip is enabled, 0 if disabled * @param index Client index
* @error If player is not connected or not within the range *
* of 1 to MaxClients. * @return 1 if noclip is enabled, 0 if disabled
*/ * @error If player is not connected or not within the range
native get_user_noclip(index); * of 1 to MaxClients.
*/
/** native get_user_noclip(index);
* Tells whether a player has silent footsteps
* /**
* @param index Client index * Tells whether a player has silent footsteps enabled.
* *
* @return 1 if silent footsteps are enabled, 0 if not * @param index Client index
* @error If player is not connected or not within the range *
* of 1 to MaxClients. * @return 1 if silent footsteps are enabled, 0 if not
*/ * @error If player is not connected or not within the range
native get_user_footsteps(index); * of 1 to MaxClients.
*/
/** native get_user_footsteps(index);
* Sets player's silent footsteps
* /**
* @param index Client index * Enables or disables player's silent footsteps.
* @param set 1 if player should have silent footsteps, 0 otherwise *
* * @param index Client index
* @noreturn * @param set 1 if player should have silent footsteps, 0 otherwise
* @error If player is not connected or not within the range *
* of 1 to MaxClients. * @noreturn
*/ * @error If player is not connected or not within the range
native set_user_footsteps(id, set = 1); * of 1 to MaxClients.
*/
/** native set_user_footsteps(id, set = 1);
* Strips all weapons from a player, including their knife.
* /**
* @param index Client index * Strips all weapons from a player, including their knife.
* *
* @noreturn * @param index Client index
* @error If player is not connected or not within the range *
* of 1 to MaxClients. * @noreturn
*/ * @error If player is not connected or not within the range
native strip_user_weapons(index); * of 1 to MaxClients.
*/
/** native strip_user_weapons(index);
* Sets player's frags amount
* /**
* @param index Client index * Sets player's frags amount.
* @param frags The amount of frags to set *
* * @param index Client index
* @noreturn * @param frags The amount of frags to set
* @error If player is not connected or not within the range *
* of 1 to MaxClients. * @noreturn
*/ * @error If player is not connected or not within the range
native set_user_frags(index, frags); * of 1 to MaxClients.
*/
native set_user_frags(index, frags);

View File

@ -16,19 +16,43 @@
#endif #endif
#define _lang_included #define _lang_included
//return the number of languages loaded /**
* Returns the number of languages loaded.
*
* @return Number of languages loaded.
*/
native get_langsnum(); 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]); 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 * Registers a dictionary file, making sure the words are in the dictionary.
// given. (e.g. register_dictionary("file.txt") will be addons/amxx/data/file.txt). *
* @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[]); 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[]); native lang_exists(const name[]);
enum TransKey enum TransKey
@ -37,35 +61,55 @@ 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[]); native TransKey:CreateLangKey(const key[]);
/** /**
* Finds a translation key id without adding on failure. * Finds a translation key index without adding on failure.
* Returns -1 on not found. *
* @param key Key to search for
*
* @return Key index, or -1 if not found
*/ */
native TransKey:GetLangTransKey(const key[]); 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[]); native AddTranslation(const lang[3], TransKey:key, const phrase[]);
/** /**
* Looks up the translation of the key for the given type * 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 This does NOT format the output text! For example, if the key
* NOTE: LANG_PLAYER is invalid in this, use a player index * contains %s, the outputted text will also contain %s.
* or LANG_SERVER * @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); native LookupLangKey(Output[], OutputSize, const Key[], &id);
/** /**
* Sets the global language target. * Sets the global language target.
* *
* @note This is useful for creating functions * @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, * indexes can be specified but the error will occur during translation,
* not during this function call. * not during this function call.
* *

View File

@ -26,23 +26,27 @@ enum
timeunit_weeks, timeunit_weeks,
}; };
// seconds are in each time unit /* Seconds in each time unit */
#define SECONDS_IN_MINUTE 60 #define SECONDS_IN_MINUTE 60
#define SECONDS_IN_HOUR 3600 #define SECONDS_IN_HOUR 3600
#define SECONDS_IN_DAY 86400 #define SECONDS_IN_DAY 86400
#define SECONDS_IN_WEEK 604800 #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) 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) if (unitCnt > 0)
{ {
// determine the number of each time unit there are // 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]; new timeElement[5][33];
if (weekCnt > 0) 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) 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) 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) 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) 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) switch(maxElementIdx)
{ {
case 0: format(output, outputLen, "%s", timeElement[0]); case 0: formatex(output, outputLen, "%s", timeElement[0]);
case 1: format(output, outputLen, "%s %L %s", timeElement[0], id, "TIME_ELEMENT_AND", timeElement[1]); case 1: formatex(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 2: formatex(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 3: formatex(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 4: formatex(output, outputLen, "%s, %s, %s, %s %L %s", timeElement[0], timeElement[1], timeElement[2], timeElement[3], id, "TIME_ELEMENT_AND", timeElement[4]);
} }
} }
} }