Merge pull request #2 from alliedmodders/master

Sync
This commit is contained in:
OciXCrom 2018-07-23 18:51:15 +02:00 committed by GitHub
commit a167170d18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1407 additions and 1395 deletions

View File

@ -92,7 +92,7 @@ bool CloseNewMenus(CPlayer *pPlayer)
Menu::Menu(const char *title, AMX *amx, int fid) : m_Title(title), m_ItemColor("\\r"), Menu::Menu(const char *title, AMX *amx, int fid) : m_Title(title), m_ItemColor("\\r"),
m_NeverExit(false), m_AutoColors(g_coloredmenus), thisId(0), func(fid), m_NeverExit(false), m_AutoColors(g_coloredmenus), thisId(0), func(fid),
isDestroying(false), pageCallback(-1), items_per_page(7) isDestroying(false), pageCallback(-1), showPageNumber(true), items_per_page(7)
{ {
CPluginMngr::CPlugin *pPlugin = g_plugins.findPluginFast(amx); CPluginMngr::CPlugin *pPlugin = g_plugins.findPluginFast(amx);
menuId = g_menucmds.registerMenuId(title, amx); menuId = g_menucmds.registerMenuId(title, amx);
@ -357,7 +357,7 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
m_Text = nullptr; m_Text = nullptr;
char buffer[255]; char buffer[255];
if (items_per_page && (pages != 1)) if (showPageNumber && items_per_page && (pages != 1))
{ {
if (m_AutoColors) if (m_AutoColors)
ke::SafeSprintf(buffer, sizeof(buffer), "\\y%s %d/%d\n\\w\n", m_Title.chars(), page + 1, pages); ke::SafeSprintf(buffer, sizeof(buffer), "\\y%s %d/%d\n\\w\n", m_Title.chars(), page + 1, pages);
@ -983,6 +983,11 @@ static cell AMX_NATIVE_CALL menu_setprop(AMX *amx, cell *params)
unregisterSPForward(pMenu->pageCallback); unregisterSPForward(pMenu->pageCallback);
pMenu->pageCallback = callback; pMenu->pageCallback = callback;
break;
}
case MPROP_SHOWPAGE:
{
pMenu->showPageNumber = (get_amxaddr(amx, params[3]) != 0);
break; break;
} }
case MPROP_SET_NUMBER_COLOR: case MPROP_SET_NUMBER_COLOR:

View File

@ -31,6 +31,7 @@
#define MPROP_PADMENU 9 #define MPROP_PADMENU 9
#define MPROP_SET_NUMBER_COLOR 10 #define MPROP_SET_NUMBER_COLOR 10
#define MPROP_PAGE_CALLBACK 11 #define MPROP_PAGE_CALLBACK 11
#define MPROP_SHOWPAGE 12
typedef int (*MENUITEM_CALLBACK)(int, int, int); typedef int (*MENUITEM_CALLBACK)(int, int, int);
@ -125,6 +126,7 @@ public:
int func; int func;
bool isDestroying; bool isDestroying;
int pageCallback; int pageCallback;
bool showPageNumber;
public: public:
unsigned int items_per_page; unsigned int items_per_page;
}; };

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,306 +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_"
* *
* @return Item entity index. If an invalid item name is * @return Item entity index. If an invalid item name is
* given or the item failed to create, it will return 0. * given or the item failed to create, it will return 0.
* If the item was removed, it will return -1 * If the item was removed, it will return -1
* @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 or item creation fails. * of 1 to MaxClients or item creation fails.
*/ */
native give_item(index, const item[]); native give_item(index, const item[]);
/** /**
* Sets (adds, removes) hit zones for a player. * Sets (adds, removes) hit zones for a player.
* *
* @note This actually sets rules of how any player can hit any other. * @note This actually sets rules of how any player can hit any other.
* Example: set_user_hitzones(id, target, 2) - makes @id able to * Example: set_user_hitzones(id, target, 2) - makes @id able to
* hit @target only in the head. * hit @target only in the head.
* *
* @param index Client index * @param index Client index
* @param target The target player * @param target The target player
* @param body A bitsum of the body parts that can/can't be shot: * @param body A bitsum of the body parts that can/can't be shot:
* 1 - generic * 1 - generic
* 2 - head * 2 - head
* 4 - chest * 4 - chest
* 8 - stomach * 8 - stomach
* 16 - left arm * 16 - left arm
* 32 - right arm * 32 - right arm
* 64 - left leg * 64 - left leg
* 128 - right leg * 128 - right leg
* *
* @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_hitzones(index = 0, target = 0, body = 255); native set_user_hitzones(index = 0, target = 0, body = 255);
/** /**
* Gets the set of hit zone "rules" between @index and @target players. * 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. * @note For the body part bitsum take a look at the set_user_hitzones() native.
* *
* @param index Client index * @param index Client index
* @param target The target player * @param target The target player
* *
* @return The bitsum of @target's body parts @index is able to hit * @return The bitsum of @target's body parts @index is able to hit
* @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_hitzones(index, target); native get_user_hitzones(index, target);
/** /**
* Sets player's maximum movement speed. * Sets player's maximum movement speed.
* *
* @param index Client index * @param index Client index
* @param speed The maximum speed player will be able to run at * @param speed The maximum speed player will be able to run at
* *
* @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_maxspeed(index, Float:speed = -1.0); native set_user_maxspeed(index, Float:speed = -1.0);
/** /**
* Gets player's maximum movement speed. * Gets player's maximum movement speed.
* *
* @param index Client index * @param index Client index
* *
* @return Player's maximum movement speed * @return Player's maximum movement speed
* @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 Float:get_user_maxspeed(index); native Float:get_user_maxspeed(index);
/** /**
* Sets player's gravity. * Sets player's gravity.
* *
* @param index Client index * @param index Client index
* @param gravity Gravity value to set, 1.0 being normal gravity (800) * @param gravity Gravity value to set, 1.0 being normal gravity (800)
* *
* @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_gravity(index, Float:gravity = 1.0); native set_user_gravity(index, Float:gravity = 1.0);
/** /**
* Gets player's gravity. * Gets player's gravity.
* *
* @param index Client index * @param index Client index
* *
* @return Player's gravity value, 1.0 being normal gravity (800) * @return Player's gravity value, 1.0 being normal gravity (800)
* @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 Float:get_user_gravity(index); native Float:get_user_gravity(index);
/** /**
* Spawns an entity. * Spawns an entity.
* *
* @param index Entity index * @param index Entity index
* *
* @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 spawn(index); native spawn(index);
/** /**
* Enables or disables player's noclip. * Enables or disables player's noclip.
* *
* @param index Client index * @param index Client index
* @param noclip 1 to enable noclip, 0 to disable * @param noclip 1 to enable noclip, 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_noclip(index, noclip = 0); native set_user_noclip(index, noclip = 0);
/** /**
* Gets whether a player has noclip enabled or not. * Gets whether a player has noclip enabled or not.
* *
* @param index Client index * @param index Client index
* *
* @return 1 if noclip is enabled, 0 if disabled * @return 1 if noclip is enabled, 0 if disabled
* @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_noclip(index); native get_user_noclip(index);
/** /**
* Tells whether a player has silent footsteps enabled. * Tells whether a player has silent footsteps enabled.
* *
* @param index Client index * @param index Client index
* *
* @return 1 if silent footsteps are enabled, 0 if not * @return 1 if silent footsteps are enabled, 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_footsteps(index); native get_user_footsteps(index);
/** /**
* Enables or disables player's silent footsteps. * Enables or disables player's silent footsteps.
* *
* @param index Client index * @param index Client index
* @param set 1 if player should have silent footsteps, 0 otherwise * @param set 1 if player should have silent footsteps, 0 otherwise
* *
* @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_footsteps(id, set = 1); native set_user_footsteps(id, set = 1);
/** /**
* Strips all weapons from a player, including their knife. * Strips all weapons from a player, including their knife.
* *
* @param index Client index * @param index Client index
* *
* @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 strip_user_weapons(index); native strip_user_weapons(index);
/** /**
* Sets player's frags amount. * Sets player's frags amount.
* *
* @param index Client index * @param index Client index
* @param frags The amount of frags to set * @param frags The amount of frags 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_frags(index, frags); native set_user_frags(index, frags);

View File

@ -81,6 +81,11 @@
*/ */
#define MPROP_PAGE_CALLBACK 11 #define MPROP_PAGE_CALLBACK 11
/**
* Whether to show the page number in menu title (param1 = bool, true = default)
*/
#define MPROP_SHOWPAGE 12
/** /**
* @deprecated * @deprecated
*/ */