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:
parent
651745b1d4
commit
cec42bdcae
@ -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,
|
||||
|
@ -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
|
||||
*/
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,422 +1,422 @@
|
||||
/* Float arithmetic
|
||||
*
|
||||
* (c) Copyright 1999, Artran, Inc.
|
||||
* Written by Greg Garner (gmg@artran.com)
|
||||
* Modified in March 2001 to include user defined
|
||||
* operators for the floating point functions.
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _float_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _float_included
|
||||
|
||||
#pragma rational Float
|
||||
|
||||
/**
|
||||
* Different methods of rounding
|
||||
*/
|
||||
enum floatround_method {
|
||||
floatround_round = 0,
|
||||
floatround_floor,
|
||||
floatround_ceil,
|
||||
floatround_tozero
|
||||
};
|
||||
|
||||
/**
|
||||
* Different units of measurement for angles
|
||||
*/
|
||||
enum anglemode {
|
||||
radian = 0,
|
||||
degrees,
|
||||
grades
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts an integer into a floating point value.
|
||||
*
|
||||
* @param value Value to be converted
|
||||
*
|
||||
* @return Converted value
|
||||
*/
|
||||
native Float:float(value);
|
||||
|
||||
/**
|
||||
* Converts a string into a floating point value.
|
||||
*
|
||||
* @param string Input string to be converted
|
||||
*
|
||||
* @return Converted value
|
||||
*/
|
||||
native Float:floatstr(const string[]);
|
||||
|
||||
/**
|
||||
* Returns the fractional part of a floating point value
|
||||
*
|
||||
* @param string Floating point value to get the fractional part from
|
||||
*
|
||||
* @return The fractional part
|
||||
*/
|
||||
native Float:floatfract(Float:value);
|
||||
|
||||
/**
|
||||
* Rounds a floating point value to an integer value
|
||||
*
|
||||
* @note For the list of available rounding methods look at
|
||||
* floatround_method enumeration.
|
||||
*
|
||||
* @param value Floating point value to be rounded
|
||||
* @param method Rounding method
|
||||
*
|
||||
* @return Converted value
|
||||
*/
|
||||
native floatround(Float:value, floatround_method:method=floatround_round);
|
||||
|
||||
/**
|
||||
* Compares two floating point values.
|
||||
*
|
||||
* @param fOne First value to be compared
|
||||
* @param fTwo Second value to be compared
|
||||
*
|
||||
* @return If arguments are equal, returns 0.
|
||||
* If the first one is greater, returns 1.
|
||||
* If the second one is greater, returns -1.
|
||||
*/
|
||||
native floatcmp(Float:fOne, Float:fTwo);
|
||||
|
||||
/**
|
||||
* Returns the square root of a floating point value
|
||||
*
|
||||
* @note Same as floatpower(value, 0.5)
|
||||
*
|
||||
* @param value Floating point value to get square root from
|
||||
*
|
||||
* @return Square root of the input value
|
||||
*/
|
||||
native Float:floatsqroot(Float:value);
|
||||
|
||||
/**
|
||||
* Returns the value raised to the power of the exponent
|
||||
*
|
||||
* @param value Floating point value to be raised
|
||||
* @param exponent The exponent
|
||||
*
|
||||
* @return Value raised to the power of the exponent
|
||||
*/
|
||||
native Float:floatpower(Float:value, Float:exponent);
|
||||
|
||||
/**
|
||||
* Returns the logarithm of value
|
||||
*
|
||||
* @param value Floating point value to calculate the logarithm for
|
||||
* @param base The optional logarithmic base to use.
|
||||
* Defaults to 10, or the natural logarithm
|
||||
*
|
||||
* @return Square root of the input value
|
||||
*/
|
||||
native Float:floatlog(Float:value, Float:base=10.0);
|
||||
|
||||
/**
|
||||
* Returns the sine of a given angle
|
||||
*
|
||||
* @note For available units of measurements(modes) look at the anglemode enum
|
||||
*
|
||||
* @param value The angle to calculate the sine from
|
||||
* @param mode What unit of measurement is the angle specified in
|
||||
* Defaults to radians
|
||||
*
|
||||
* @return The sine of a given angle
|
||||
*/
|
||||
native Float:floatsin(Float:value, anglemode:mode=radian);
|
||||
|
||||
/**
|
||||
* Returns the cosine of a given angle
|
||||
*
|
||||
* @note For available units of measurements(modes) look at the anglemode enum
|
||||
*
|
||||
* @param value The angle to calculate the cosine from
|
||||
* @param mode What unit of measurement is the angle specified in
|
||||
* Defaults to radians
|
||||
*
|
||||
* @return The cosine of a given angle
|
||||
*/
|
||||
native Float:floatcos(Float:value, anglemode:mode=radian);
|
||||
|
||||
/**
|
||||
* Returns the tangent of a given angle
|
||||
*
|
||||
* @note For available units of measurements(modes) look at the anglemode enum
|
||||
*
|
||||
* @param value The angle to calculate the tangent from
|
||||
* @param mode What unit of measurement is the angle specified in
|
||||
* Defaults to radians
|
||||
*
|
||||
* @return The tangent of a given angle
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param value The angle to calculate the hyperbolic sine from
|
||||
* @param mode What unit of measurement is the angle specified in
|
||||
* Defaults to radians
|
||||
*
|
||||
* @return The hyperbolic sine of a given angle
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param value The angle to calculate the hyperbolic cosine from
|
||||
* @param mode What unit of measurement is the angle specified in
|
||||
* Defaults to radians
|
||||
*
|
||||
* @return The hyperbolic cosine of a given angle
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param value The angle to calculate the hyperbolic tangent from
|
||||
* @param mode What unit of measurement is the angle specified in
|
||||
* Defaults to radians
|
||||
*
|
||||
* @return The hyperbolic tangent of a given angle
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @return The absolute value
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param value The tangent to calculate the angle from
|
||||
* @param mode What unit of measurement should the output angle be in
|
||||
*
|
||||
* @return The angle of a tangent
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param value The cosine to calculate the angle from
|
||||
* @param mode What unit of measurement should the output angle be in
|
||||
*
|
||||
* @return The angle of a cosine
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param value The sine to calculate the angle from
|
||||
* @param mode What unit of measurement should the output angle be in
|
||||
*
|
||||
* @return The angle of a sine
|
||||
*/
|
||||
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.
|
||||
* @note For available units of measurements(modes) look at the anglemode enum
|
||||
*
|
||||
* @param x 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
|
||||
*
|
||||
* @return Arctangent of y/x
|
||||
*/
|
||||
native Float:floatatan2(Float:x, Float:y, {anglemode,_}:radix);
|
||||
|
||||
|
||||
|
||||
/* Multiply two floats together */
|
||||
native Float:floatmul(Float:oper1, Float:oper2);
|
||||
|
||||
/* Divide the dividend float by the divisor float */
|
||||
native Float:floatdiv(Float:dividend, Float:divisor);
|
||||
|
||||
/* Add two floats together */
|
||||
native Float:floatadd(Float:dividend, Float:divisor);
|
||||
|
||||
/* Subtract oper2 float from oper1 float */
|
||||
native Float:floatsub(Float:oper1, Float:oper2);
|
||||
|
||||
/* user defined operators */
|
||||
native Float:operator*(Float:oper1, Float:oper2) = floatmul;
|
||||
native Float:operator/(Float:oper1, Float:oper2) = floatdiv;
|
||||
native Float:operator+(Float:oper1, Float:oper2) = floatadd;
|
||||
native Float:operator-(Float:oper1, Float:oper2) = floatsub;
|
||||
|
||||
stock Float:operator++(Float:oper)
|
||||
return oper+1.0;
|
||||
|
||||
stock Float:operator--(Float:oper)
|
||||
return oper-1.0;
|
||||
|
||||
stock Float:operator-(Float:oper)
|
||||
return oper^Float:cellmin; /* IEEE values are sign/magnitude */
|
||||
|
||||
stock Float:operator*(Float:oper1, oper2)
|
||||
return floatmul(oper1, float(oper2)); /* "*" is commutative */
|
||||
|
||||
stock Float:operator/(Float:oper1, oper2)
|
||||
return floatdiv(oper1, float(oper2));
|
||||
|
||||
stock Float:operator/(oper1, Float:oper2)
|
||||
return floatdiv(float(oper1), oper2);
|
||||
|
||||
stock Float:operator+(Float:oper1, oper2)
|
||||
return floatadd(oper1, float(oper2)); /* "+" is commutative */
|
||||
|
||||
stock Float:operator-(Float:oper1, oper2)
|
||||
return floatsub(oper1, float(oper2));
|
||||
|
||||
stock Float:operator-(oper1, Float:oper2)
|
||||
return floatsub(float(oper1), oper2);
|
||||
|
||||
stock bool:operator==(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) == 0;
|
||||
|
||||
stock bool:operator==(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) == 0; /* "==" is commutative */
|
||||
|
||||
stock bool:operator!=(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) != 0;
|
||||
|
||||
stock bool:operator!=(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) != 0; /* "==" is commutative */
|
||||
|
||||
stock bool:operator>(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) > 0;
|
||||
|
||||
stock bool:operator>(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) > 0;
|
||||
|
||||
stock bool:operator>(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) > 0;
|
||||
|
||||
stock bool:operator>=(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) >= 0;
|
||||
|
||||
stock bool:operator>=(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) >= 0;
|
||||
|
||||
stock bool:operator>=(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) >= 0;
|
||||
|
||||
stock bool:operator<(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) < 0;
|
||||
|
||||
stock bool:operator<(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) < 0;
|
||||
|
||||
stock bool:operator<(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) < 0;
|
||||
|
||||
stock bool:operator<=(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) <= 0;
|
||||
|
||||
stock bool:operator<=(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) <= 0;
|
||||
|
||||
stock bool:operator<=(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) <= 0;
|
||||
|
||||
stock bool:operator!(Float:oper)
|
||||
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 */
|
||||
/* forbidden operations */
|
||||
forward operator%(Float:oper1, Float:oper2);
|
||||
forward operator%(Float:oper1, oper2);
|
||||
forward operator%(oper1, Float:oper2);
|
||||
|
||||
|
||||
/**
|
||||
* Returns whichever value is the smaller one
|
||||
*
|
||||
* @param ValueA The first value
|
||||
* @param ValueB The second value
|
||||
*
|
||||
* @return ValueA if it is smaller than ValueB, and vice versa
|
||||
*/
|
||||
stock Float:floatmin(Float:ValueA, Float:ValueB)
|
||||
{
|
||||
if (ValueA<=ValueB)
|
||||
{
|
||||
return ValueA;
|
||||
}
|
||||
|
||||
return ValueB;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whichever value is the greater one
|
||||
*
|
||||
* @param ValueA The first value
|
||||
* @param ValueB The second value
|
||||
*
|
||||
* @return ValueA if it is greater than ValueB, and vice versa
|
||||
*/
|
||||
stock Float:floatmax(Float:ValueA, Float:ValueB)
|
||||
{
|
||||
if (ValueA>=ValueB)
|
||||
{
|
||||
return ValueA;
|
||||
}
|
||||
|
||||
return ValueB;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clamps a value between a minimum and a maximum floating point value
|
||||
*
|
||||
* @param Value The value to be clamped
|
||||
* @param MinValue Minimum value
|
||||
* @param MaxValue Maximum value
|
||||
*
|
||||
* @return The Value clamped between MinValue and MaxValue
|
||||
*/
|
||||
stock Float:floatclamp(Float:Value, Float:MinValue, Float:MaxValue)
|
||||
{
|
||||
if (Value<=MinValue)
|
||||
{
|
||||
return MinValue;
|
||||
}
|
||||
if (Value>=MaxValue)
|
||||
{
|
||||
return MaxValue;
|
||||
}
|
||||
|
||||
return Value;
|
||||
/* Float arithmetic
|
||||
*
|
||||
* (c) Copyright 1999, Artran, Inc.
|
||||
* Written by Greg Garner (gmg@artran.com)
|
||||
* Modified in March 2001 to include user defined
|
||||
* operators for the floating point functions.
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*/
|
||||
|
||||
#if defined _float_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _float_included
|
||||
|
||||
#pragma rational Float
|
||||
|
||||
/**
|
||||
* Different methods of rounding
|
||||
*/
|
||||
enum floatround_method {
|
||||
floatround_round = 0,
|
||||
floatround_floor,
|
||||
floatround_ceil,
|
||||
floatround_tozero
|
||||
};
|
||||
|
||||
/**
|
||||
* Different units of measurement for angles
|
||||
*/
|
||||
enum anglemode {
|
||||
radian = 0,
|
||||
degrees,
|
||||
grades
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts an integer into a floating point value.
|
||||
*
|
||||
* @param value Value to be converted
|
||||
*
|
||||
* @return Converted value
|
||||
*/
|
||||
native Float:float(value);
|
||||
|
||||
/**
|
||||
* Converts a string into a floating point value.
|
||||
*
|
||||
* @param string Input string to be converted
|
||||
*
|
||||
* @return Converted value
|
||||
*/
|
||||
native Float:floatstr(const string[]);
|
||||
|
||||
/**
|
||||
* Returns the fractional part of a floating point value
|
||||
*
|
||||
* @param string Floating point value to get the fractional part from
|
||||
*
|
||||
* @return The fractional part
|
||||
*/
|
||||
native Float:floatfract(Float:value);
|
||||
|
||||
/**
|
||||
* Rounds a floating point value to an integer value
|
||||
*
|
||||
* @note For the list of available rounding methods look at
|
||||
* floatround_method enumeration.
|
||||
*
|
||||
* @param value Floating point value to be rounded
|
||||
* @param method Rounding method
|
||||
*
|
||||
* @return Converted value
|
||||
*/
|
||||
native floatround(Float:value, floatround_method:method=floatround_round);
|
||||
|
||||
/**
|
||||
* Compares two floating point values.
|
||||
*
|
||||
* @param fOne First value to be compared
|
||||
* @param fTwo Second value to be compared
|
||||
*
|
||||
* @return If arguments are equal, returns 0.
|
||||
* If the first one is greater, returns 1.
|
||||
* If the second one is greater, returns -1.
|
||||
*/
|
||||
native floatcmp(Float:fOne, Float:fTwo);
|
||||
|
||||
/**
|
||||
* Returns the square root of a floating point value
|
||||
*
|
||||
* @note Same as floatpower(value, 0.5)
|
||||
*
|
||||
* @param value Floating point value to get square root from
|
||||
*
|
||||
* @return Square root of the input value
|
||||
*/
|
||||
native Float:floatsqroot(Float:value);
|
||||
|
||||
/**
|
||||
* Returns the value raised to the power of the exponent
|
||||
*
|
||||
* @param value Floating point value to be raised
|
||||
* @param exponent The exponent
|
||||
*
|
||||
* @return Value raised to the power of the exponent
|
||||
*/
|
||||
native Float:floatpower(Float:value, Float:exponent);
|
||||
|
||||
/**
|
||||
* Returns the logarithm of value
|
||||
*
|
||||
* @param value Floating point value to calculate the logarithm for
|
||||
* @param base The optional logarithmic base to use.
|
||||
* Defaults to 10, or the natural logarithm
|
||||
*
|
||||
* @return Square root of the input value
|
||||
*/
|
||||
native Float:floatlog(Float:value, Float:base=10.0);
|
||||
|
||||
/**
|
||||
* Returns the sine of a given angle
|
||||
*
|
||||
* @note For available units of measurements(modes) look at the anglemode enum
|
||||
*
|
||||
* @param value The angle to calculate the sine from
|
||||
* @param mode What unit of measurement is the angle specified in
|
||||
* Defaults to radians
|
||||
*
|
||||
* @return The sine of a given angle
|
||||
*/
|
||||
native Float:floatsin(Float:value, anglemode:mode=radian);
|
||||
|
||||
/**
|
||||
* Returns the cosine of a given angle
|
||||
*
|
||||
* @note For available units of measurements(modes) look at the anglemode enum
|
||||
*
|
||||
* @param value The angle to calculate the cosine from
|
||||
* @param mode What unit of measurement is the angle specified in
|
||||
* Defaults to radians
|
||||
*
|
||||
* @return The cosine of a given angle
|
||||
*/
|
||||
native Float:floatcos(Float:value, anglemode:mode=radian);
|
||||
|
||||
/**
|
||||
* Returns the tangent of a given angle
|
||||
*
|
||||
* @note For available units of measurements(modes) look at the anglemode enum
|
||||
*
|
||||
* @param value The angle to calculate the tangent from
|
||||
* @param mode What unit of measurement is the angle specified in
|
||||
* Defaults to radians
|
||||
*
|
||||
* @return The tangent of a given angle
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param value The angle to calculate the hyperbolic sine from
|
||||
* @param mode What unit of measurement is the angle specified in
|
||||
* Defaults to radians
|
||||
*
|
||||
* @return The hyperbolic sine of a given angle
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param value The angle to calculate the hyperbolic cosine from
|
||||
* @param mode What unit of measurement is the angle specified in
|
||||
* Defaults to radians
|
||||
*
|
||||
* @return The hyperbolic cosine of a given angle
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param value The angle to calculate the hyperbolic tangent from
|
||||
* @param mode What unit of measurement is the angle specified in
|
||||
* Defaults to radians
|
||||
*
|
||||
* @return The hyperbolic tangent of a given angle
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @return The absolute value
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param value The tangent to calculate the angle from
|
||||
* @param mode What unit of measurement should the output angle be in
|
||||
*
|
||||
* @return The angle of a tangent
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param value The cosine to calculate the angle from
|
||||
* @param mode What unit of measurement should the output angle be in
|
||||
*
|
||||
* @return The angle of a cosine
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param value The sine to calculate the angle from
|
||||
* @param mode What unit of measurement should the output angle be in
|
||||
*
|
||||
* @return The angle of a sine
|
||||
*/
|
||||
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.
|
||||
* @note For available units of measurements(modes) look at the anglemode enum
|
||||
*
|
||||
* @param x 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
|
||||
*
|
||||
* @return Arctangent of y/x
|
||||
*/
|
||||
native Float:floatatan2(Float:x, Float:y, {anglemode,_}:radix);
|
||||
|
||||
|
||||
|
||||
/* Multiply two floats together */
|
||||
native Float:floatmul(Float:oper1, Float:oper2);
|
||||
|
||||
/* Divide the dividend float by the divisor float */
|
||||
native Float:floatdiv(Float:dividend, Float:divisor);
|
||||
|
||||
/* Add two floats together */
|
||||
native Float:floatadd(Float:dividend, Float:divisor);
|
||||
|
||||
/* Subtract oper2 float from oper1 float */
|
||||
native Float:floatsub(Float:oper1, Float:oper2);
|
||||
|
||||
/* user defined operators */
|
||||
native Float:operator*(Float:oper1, Float:oper2) = floatmul;
|
||||
native Float:operator/(Float:oper1, Float:oper2) = floatdiv;
|
||||
native Float:operator+(Float:oper1, Float:oper2) = floatadd;
|
||||
native Float:operator-(Float:oper1, Float:oper2) = floatsub;
|
||||
|
||||
stock Float:operator++(Float:oper)
|
||||
return oper+1.0;
|
||||
|
||||
stock Float:operator--(Float:oper)
|
||||
return oper-1.0;
|
||||
|
||||
stock Float:operator-(Float:oper)
|
||||
return oper^Float:cellmin; /* IEEE values are sign/magnitude */
|
||||
|
||||
stock Float:operator*(Float:oper1, oper2)
|
||||
return floatmul(oper1, float(oper2)); /* "*" is commutative */
|
||||
|
||||
stock Float:operator/(Float:oper1, oper2)
|
||||
return floatdiv(oper1, float(oper2));
|
||||
|
||||
stock Float:operator/(oper1, Float:oper2)
|
||||
return floatdiv(float(oper1), oper2);
|
||||
|
||||
stock Float:operator+(Float:oper1, oper2)
|
||||
return floatadd(oper1, float(oper2)); /* "+" is commutative */
|
||||
|
||||
stock Float:operator-(Float:oper1, oper2)
|
||||
return floatsub(oper1, float(oper2));
|
||||
|
||||
stock Float:operator-(oper1, Float:oper2)
|
||||
return floatsub(float(oper1), oper2);
|
||||
|
||||
stock bool:operator==(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) == 0;
|
||||
|
||||
stock bool:operator==(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) == 0; /* "==" is commutative */
|
||||
|
||||
stock bool:operator!=(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) != 0;
|
||||
|
||||
stock bool:operator!=(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) != 0; /* "==" is commutative */
|
||||
|
||||
stock bool:operator>(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) > 0;
|
||||
|
||||
stock bool:operator>(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) > 0;
|
||||
|
||||
stock bool:operator>(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) > 0;
|
||||
|
||||
stock bool:operator>=(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) >= 0;
|
||||
|
||||
stock bool:operator>=(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) >= 0;
|
||||
|
||||
stock bool:operator>=(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) >= 0;
|
||||
|
||||
stock bool:operator<(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) < 0;
|
||||
|
||||
stock bool:operator<(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) < 0;
|
||||
|
||||
stock bool:operator<(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) < 0;
|
||||
|
||||
stock bool:operator<=(Float:oper1, Float:oper2)
|
||||
return floatcmp(oper1, oper2) <= 0;
|
||||
|
||||
stock bool:operator<=(Float:oper1, oper2)
|
||||
return floatcmp(oper1, float(oper2)) <= 0;
|
||||
|
||||
stock bool:operator<=(oper1, Float:oper2)
|
||||
return floatcmp(float(oper1), oper2) <= 0;
|
||||
|
||||
stock bool:operator!(Float:oper)
|
||||
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 */
|
||||
/* forbidden operations */
|
||||
forward operator%(Float:oper1, Float:oper2);
|
||||
forward operator%(Float:oper1, oper2);
|
||||
forward operator%(oper1, Float:oper2);
|
||||
|
||||
|
||||
/**
|
||||
* Returns whichever value is the smaller one
|
||||
*
|
||||
* @param ValueA The first value
|
||||
* @param ValueB The second value
|
||||
*
|
||||
* @return ValueA if it is smaller than ValueB, and vice versa
|
||||
*/
|
||||
stock Float:floatmin(Float:ValueA, Float:ValueB)
|
||||
{
|
||||
if (ValueA<=ValueB)
|
||||
{
|
||||
return ValueA;
|
||||
}
|
||||
|
||||
return ValueB;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whichever value is the greater one
|
||||
*
|
||||
* @param ValueA The first value
|
||||
* @param ValueB The second value
|
||||
*
|
||||
* @return ValueA if it is greater than ValueB, and vice versa
|
||||
*/
|
||||
stock Float:floatmax(Float:ValueA, Float:ValueB)
|
||||
{
|
||||
if (ValueA>=ValueB)
|
||||
{
|
||||
return ValueA;
|
||||
}
|
||||
|
||||
return ValueB;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clamps a value between a minimum and a maximum floating point value
|
||||
*
|
||||
* @param Value The value to be clamped
|
||||
* @param MinValue Minimum value
|
||||
* @param MaxValue Maximum value
|
||||
*
|
||||
* @return The Value clamped between MinValue and MaxValue
|
||||
*/
|
||||
stock Float:floatclamp(Float:Value, Float:MinValue, Float:MaxValue)
|
||||
{
|
||||
if (Value<=MinValue)
|
||||
{
|
||||
return MinValue;
|
||||
}
|
||||
if (Value>=MaxValue)
|
||||
{
|
||||
return MaxValue;
|
||||
}
|
||||
|
||||
return Value;
|
||||
}
|
@ -1,304 +1,306 @@
|
||||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// 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:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
//
|
||||
// Fun Functions
|
||||
//
|
||||
|
||||
#if defined _fun_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _fun_included
|
||||
|
||||
#pragma reqlib fun
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib fun
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Tells whether receiver hears sender via voice communication.
|
||||
*
|
||||
* @param receiver Receiver
|
||||
* @param sender Sender
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
native get_client_listen(receiver, sender);
|
||||
|
||||
/**
|
||||
* Sets who can listen who.
|
||||
*
|
||||
* @param receiver Receiver
|
||||
* @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.
|
||||
* @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
|
||||
*
|
||||
* @param index Client index
|
||||
* @param godmode 1 to enable godmode, 0 to disable
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_godmode(index, godmode = 0);
|
||||
|
||||
/**
|
||||
* Tells whether a player has godmode on
|
||||
*
|
||||
* @param index Client index
|
||||
*
|
||||
* @return 1 if player has godmode on, 0 if not
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native get_user_godmode(index);
|
||||
|
||||
/**
|
||||
* Sets player's armor amount
|
||||
*
|
||||
* @param index Client index
|
||||
* @param armor The armor amount to set
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_armor(index, armor);
|
||||
|
||||
/**
|
||||
* Sets player's health amount
|
||||
*
|
||||
* @param index Client index
|
||||
* @param health The health amount to set
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_health(index, health);
|
||||
|
||||
/**
|
||||
* Moves a player to the given origin
|
||||
*
|
||||
* @param index Client index
|
||||
* @param origin Origin to move a player to
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_origin(index, const origin[3]);
|
||||
|
||||
/**
|
||||
* 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 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 amount Render amount (0 to 255)
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
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_".
|
||||
*
|
||||
* @noreturn
|
||||
* @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.
|
||||
*
|
||||
* @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
|
||||
* 2 - head
|
||||
* 4 - chest
|
||||
* 8 - stomach
|
||||
* 16 - left arm
|
||||
* 32 - right arm
|
||||
* 64 - left leg
|
||||
* 128 - right leg
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* 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.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param target The target player
|
||||
*
|
||||
* @return The bitsum of @target's body parts @index is able to hit
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native get_user_hitzones(index, target);
|
||||
|
||||
/**
|
||||
* Sets player's maximum movement speed
|
||||
*
|
||||
* @param index Client index
|
||||
* @param speed The maximum speed player will be able to run at
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_maxspeed(index, Float:speed = -1.0);
|
||||
|
||||
/**
|
||||
* Gets player's maximum movement speed
|
||||
*
|
||||
* @param index Client index
|
||||
*
|
||||
* @return Player's maximum movement speed
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native Float:get_user_maxspeed(index);
|
||||
|
||||
/**
|
||||
* Sets player's gravity
|
||||
*
|
||||
* @param index Client index
|
||||
* @param gravity Gravity value to set, 1.0 being normal gravity (800)
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_gravity(index, Float:gravity = 1.0);
|
||||
|
||||
/**
|
||||
* Gets player's gravity
|
||||
*
|
||||
* @param index Client index
|
||||
*
|
||||
* @return Player's gravity value, 1.0 being normal gravity (800)
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native Float:get_user_gravity(index);
|
||||
|
||||
/**
|
||||
* Spawns an entity
|
||||
*
|
||||
* @param index Entity index
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native spawn(index);
|
||||
|
||||
/**
|
||||
* Sets player's noclip
|
||||
*
|
||||
* @param index Client index
|
||||
* @param noclip 1 to enable noclip, 0 to disable
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_noclip(index, noclip = 0);
|
||||
|
||||
/**
|
||||
* Gets player's noclip
|
||||
*
|
||||
* @param index Client index
|
||||
*
|
||||
* @return 1 if noclip is enabled, 0 if disabled
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native get_user_noclip(index);
|
||||
|
||||
/**
|
||||
* Tells whether a player has silent footsteps
|
||||
*
|
||||
* @param index Client index
|
||||
*
|
||||
* @return 1 if silent footsteps are enabled, 0 if not
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native get_user_footsteps(index);
|
||||
|
||||
/**
|
||||
* Sets player's silent footsteps
|
||||
*
|
||||
* @param index Client index
|
||||
* @param set 1 if player should have silent footsteps, 0 otherwise
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_footsteps(id, set = 1);
|
||||
|
||||
/**
|
||||
* Strips all weapons from a player, including their knife.
|
||||
*
|
||||
* @param index Client index
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native strip_user_weapons(index);
|
||||
|
||||
/**
|
||||
* Sets player's frags amount
|
||||
*
|
||||
* @param index Client index
|
||||
* @param frags The amount of frags to set
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_frags(index, frags);
|
||||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// 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:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
//
|
||||
// Fun Functions
|
||||
//
|
||||
|
||||
#if defined _fun_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _fun_included
|
||||
|
||||
#pragma reqlib fun
|
||||
#if !defined AMXMODX_NOAUTOLOAD
|
||||
#pragma loadlib fun
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Tells whether receiver hears sender via voice communication.
|
||||
*
|
||||
* @param receiver Receiver
|
||||
* @param sender Sender
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
native get_client_listen(receiver, sender);
|
||||
|
||||
/**
|
||||
* Sets who can listen who.
|
||||
*
|
||||
* @param receiver Receiver
|
||||
* @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
|
||||
* @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.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param godmode 1 to enable godmode, 0 to disable
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_godmode(index, godmode = 0);
|
||||
|
||||
/**
|
||||
* Tells whether a player has godmode on.
|
||||
*
|
||||
* @param index Client index
|
||||
*
|
||||
* @return 1 if player has godmode on, 0 if not
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native get_user_godmode(index);
|
||||
|
||||
/**
|
||||
* Sets player's armor amount.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param armor The armor amount to set
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_armor(index, armor);
|
||||
|
||||
/**
|
||||
* Sets player's health amount.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param health The health amount to set
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_health(index, health);
|
||||
|
||||
/**
|
||||
* Moves a player to the given origin.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param origin Origin to move a player to
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_origin(index, const origin[3]);
|
||||
|
||||
/**
|
||||
* 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 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 amount Render amount (0 to 255)
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
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_"
|
||||
*
|
||||
* @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 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
|
||||
* 2 - head
|
||||
* 4 - chest
|
||||
* 8 - stomach
|
||||
* 16 - left arm
|
||||
* 32 - right arm
|
||||
* 64 - left leg
|
||||
* 128 - right leg
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* 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.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param target The target player
|
||||
*
|
||||
* @return The bitsum of @target's body parts @index is able to hit
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native get_user_hitzones(index, target);
|
||||
|
||||
/**
|
||||
* Sets player's maximum movement speed.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param speed The maximum speed player will be able to run at
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_maxspeed(index, Float:speed = -1.0);
|
||||
|
||||
/**
|
||||
* Gets player's maximum movement speed.
|
||||
*
|
||||
* @param index Client index
|
||||
*
|
||||
* @return Player's maximum movement speed
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native Float:get_user_maxspeed(index);
|
||||
|
||||
/**
|
||||
* Sets player's gravity.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param gravity Gravity value to set, 1.0 being normal gravity (800)
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_gravity(index, Float:gravity = 1.0);
|
||||
|
||||
/**
|
||||
* Gets player's gravity.
|
||||
*
|
||||
* @param index Client index
|
||||
*
|
||||
* @return Player's gravity value, 1.0 being normal gravity (800)
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native Float:get_user_gravity(index);
|
||||
|
||||
/**
|
||||
* Spawns an entity.
|
||||
*
|
||||
* @param index Entity index
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native spawn(index);
|
||||
|
||||
/**
|
||||
* Enables or disables player's noclip.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param noclip 1 to enable noclip, 0 to disable
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_noclip(index, noclip = 0);
|
||||
|
||||
/**
|
||||
* Gets whether a player has noclip enabled or not.
|
||||
*
|
||||
* @param index Client index
|
||||
*
|
||||
* @return 1 if noclip is enabled, 0 if disabled
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native get_user_noclip(index);
|
||||
|
||||
/**
|
||||
* Tells whether a player has silent footsteps enabled.
|
||||
*
|
||||
* @param index Client index
|
||||
*
|
||||
* @return 1 if silent footsteps are enabled, 0 if not
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native get_user_footsteps(index);
|
||||
|
||||
/**
|
||||
* Enables or disables player's silent footsteps.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param set 1 if player should have silent footsteps, 0 otherwise
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_footsteps(id, set = 1);
|
||||
|
||||
/**
|
||||
* Strips all weapons from a player, including their knife.
|
||||
*
|
||||
* @param index Client index
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native strip_user_weapons(index);
|
||||
|
||||
/**
|
||||
* Sets player's frags amount.
|
||||
*
|
||||
* @param index Client index
|
||||
* @param frags The amount of frags to set
|
||||
*
|
||||
* @noreturn
|
||||
* @error If player is not connected or not within the range
|
||||
* of 1 to MaxClients.
|
||||
*/
|
||||
native set_user_frags(index, frags);
|
||||
|
@ -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,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[]);
|
||||
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Sets the global language target.
|
||||
* 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.
|
||||
*
|
||||
|
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user