2014-08-04 12:12:15 +00:00
|
|
|
// 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
|
|
|
|
|
|
|
|
//
|
|
|
|
// Counter-Strike Functions
|
|
|
|
//
|
2004-03-04 16:08:31 +00:00
|
|
|
|
|
|
|
#if defined _cstrike_included
|
2015-02-24 21:51:36 +00:00
|
|
|
#endinput
|
2004-03-04 16:08:31 +00:00
|
|
|
#endif
|
|
|
|
#define _cstrike_included
|
|
|
|
|
2015-02-24 22:56:17 +00:00
|
|
|
#pragma reqlib cstrike
|
|
|
|
#if !defined AMXMODX_NOAUTOLOAD
|
|
|
|
#pragma loadlib cstrike
|
2006-05-10 10:42:49 +00:00
|
|
|
#endif
|
2005-07-15 19:05:31 +00:00
|
|
|
|
2015-07-15 20:57:57 +00:00
|
|
|
#include <cstrike_const>
|
2015-02-18 15:24:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns client's deaths.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return Client deaths
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-07 20:06:04 +00:00
|
|
|
native cs_get_user_deaths(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets client's deaths.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param newdeaths New value to set
|
2015-07-04 14:21:48 +00:00
|
|
|
* @param scoreboard If true the scoreboard will be updated to reflect the new value.
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error
|
|
|
|
* will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2015-07-04 14:21:48 +00:00
|
|
|
native cs_set_user_deaths(index, newdeaths, bool:scoreboard = true);
|
2004-03-07 20:06:04 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns index of the entity that a hostage is following.
|
|
|
|
*
|
|
|
|
* @note Hostages can theoretically follow any entity in the game, so the
|
|
|
|
* returned entity index is not necessarily a client index.
|
|
|
|
*
|
|
|
|
* @param index Hostage entity index
|
|
|
|
*
|
|
|
|
* @return Entity index if hostage is following something, 0 otherwise
|
|
|
|
* @error If the provided entity index is not a hostage, an error will
|
|
|
|
* be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_get_hostage_foll(index);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets hostage to follow an entity.
|
|
|
|
*
|
|
|
|
* @note Hostages can theoretically follow any entity in the game, so the
|
|
|
|
* followedindex does not have to be a client index.
|
|
|
|
*
|
|
|
|
* @param index Hostage entity index
|
|
|
|
* @param followedindex New entity to follow
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the provided entity index is not a hostage, an
|
|
|
|
* error will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_set_hostage_foll(index, followedindex = 0);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns unique id of a hostage.
|
|
|
|
*
|
|
|
|
* @param index Hostage entity index
|
|
|
|
*
|
|
|
|
* @return Unique hostage id
|
|
|
|
* @error If the provided entity index is not a hostage, an error will
|
|
|
|
* be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_get_hostage_id(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns amount of ammo in the client's backpack for a specific weapon.
|
|
|
|
*
|
|
|
|
* @note For a list of possible weapon ids see the CSW_* constants in
|
|
|
|
* amxconst.inc
|
|
|
|
* @note Some weapons share ammo types and therefore ammo backpack pools. List
|
|
|
|
* of ammo types:
|
|
|
|
* ammo_338magnum - awp
|
|
|
|
* ammo_762nato - scout, ak47, g3sg1
|
|
|
|
* ammo_556natobox - m249
|
|
|
|
* ammo_556nato - famas, m4a1, aug, sg550, galil, sg552
|
|
|
|
* ammo_buckshot - m3, xm1014
|
|
|
|
* ammo_45acp - usp, ump45, mac10
|
|
|
|
* ammo_57mm - fiveseven, p90
|
|
|
|
* ammo_50ae - deagle
|
|
|
|
* ammo_357sig - p228
|
|
|
|
* ammo_9mm - glock, mp5, tmp, elites
|
|
|
|
* / - hegrenade
|
|
|
|
* / - flashbang
|
|
|
|
* / - smokegrenade
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param weapon Weapon id
|
|
|
|
*
|
|
|
|
* @return Amount of ammo in backpack
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, the client is not connected, or an invalid
|
|
|
|
* weapon id is provided, an error will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_get_user_bpammo(index, weapon);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets amount of ammo in the client's backpack for a specific weapon.
|
|
|
|
*
|
|
|
|
* @note For a list of possible weapon ids see the CSW_* constants in
|
|
|
|
* amxconst.inc
|
|
|
|
* @note Some weapons share ammo types and therefore ammo backpack pools. List
|
|
|
|
* of ammo types:
|
2015-02-24 21:51:36 +00:00
|
|
|
* ammo_338magnum - awp
|
|
|
|
* ammo_762nato - scout, ak47, g3sg1
|
|
|
|
* ammo_556natobox - m249
|
|
|
|
* ammo_556nato - famas, m4a1, aug, sg550, galil, sg552
|
|
|
|
* ammo_buckshot - m3, xm1014
|
|
|
|
* ammo_45acp - usp, ump45, mac10
|
|
|
|
* ammo_57mm - fiveseven, p90
|
|
|
|
* ammo_50ae - deagle
|
|
|
|
* ammo_357sig - p228
|
|
|
|
* ammo_9mm - glock, mp5, tmp, elites
|
|
|
|
* / - hegrenade
|
|
|
|
* / - flashbang
|
|
|
|
* / - smokegrenade
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param weapon Weapon id
|
|
|
|
* @param amount New backpack ammo amount to set
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, the client is not connected, or an invalid
|
|
|
|
* weapon id is provided, an error will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_set_user_bpammo(index, weapon, amount);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if the client has a defuse kit.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return 1 if the client has a defuse kit, 0 otherwise
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, the client is not connected, or an invalid
|
|
|
|
* weapon id is provided, an error will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_get_user_defuse(index);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the client's defusekit status and allows to set a custom HUD icon and
|
|
|
|
* color.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param defusekit If nonzero the client will have a defusekit, otherwise
|
|
|
|
* it will be removed
|
|
|
|
* @param r Red component of icon color
|
|
|
|
* @param g Green component of icon color
|
|
|
|
* @param b Blue component of icon color
|
|
|
|
* @param icon HUD sprite to use as icon
|
|
|
|
* @param flash If nonzero the icon will flash red
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error
|
|
|
|
* will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_set_user_defuse(index, defusekit = 1, r = 0, g = 160, b = 0, icon[] = "defuser", flash = 0);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if the client is inside a buyzone.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return 1 if the client is inside a buyzone, 0 otherwise
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_get_user_buyzone(index);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if the client has a primary weapon or a shield in the inventory.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return 1 if the client has a primary weapon or shield in the
|
|
|
|
* inventory, 0 otherwise
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2004-06-07 15:33:45 +00:00
|
|
|
*/
|
|
|
|
native cs_get_user_hasprim(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Retrieves the client's player model.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param model Buffer to copy model to
|
|
|
|
* @param len Maximum buffer size
|
|
|
|
*
|
|
|
|
* @return Number of cells written to buffer
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_get_user_model(index, model[], len);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the client's player model.
|
|
|
|
*
|
|
|
|
* @note This is not a one-time set. The CStrike module will remember the
|
|
|
|
* selected model and try to prevent attempts at changing the player
|
|
|
|
* model, or immediately re-apply it if necessary.
|
2015-07-09 11:36:53 +00:00
|
|
|
* @note Updating modelindex is useful for custom models which don't have
|
|
|
|
* the same structure as the default ones (hitbox, etc..). Model must
|
|
|
|
* be precached before.
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
2015-07-09 11:36:53 +00:00
|
|
|
* @param index Client index
|
|
|
|
* @param model Model name
|
|
|
|
* @param update_index If true, the modelindex is updated as well
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @noreturn
|
2015-07-09 11:36:53 +00:00
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, the client is not connected, the provided
|
|
|
|
* model is empty, or if modeindex is updated and the
|
|
|
|
* provided model is not precached, an error will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2015-07-09 11:36:53 +00:00
|
|
|
native cs_set_user_model(index, const model[], bool:update_index = false);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Resets the client's model.
|
|
|
|
*
|
|
|
|
* @note This lifts the model-lock set by a previous cs_set_user_model() call.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_reset_user_model(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns the client's amount of money.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return Amount of money
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_get_user_money(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the client's amount of money.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param money New amount to set
|
|
|
|
* @param flash If nonzero the HUD will flash the difference between new
|
|
|
|
* and old amount in red or green
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_set_user_money(index, money, flash = 1);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if the client's has night vision goggles.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return 1 if user has NVG, 0 otherwise
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-20 23:58:26 +00:00
|
|
|
native cs_get_user_nvg(index);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the client's night vision goggles.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param nvgoogles If nonzero the NVG will be added to the client's
|
|
|
|
* inventory, otherwise they will be removed from it
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error
|
|
|
|
* will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-20 23:58:26 +00:00
|
|
|
native cs_set_user_nvg(index, nvgoggles = 1);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if the client has the ability to plant the bomb.
|
|
|
|
*
|
|
|
|
* @note Only with this set can the client plant the bomb within the usual bomb
|
|
|
|
* target areas. If this is not set the user can not plant the bomb, even
|
|
|
|
* when he has one in the inventory.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return 1 if the client is able to plant the bomb, 0 otherwise
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_get_user_plant(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the client's ability to plant the bomb and displays or hides the bomb
|
|
|
|
* HUD icon.
|
|
|
|
*
|
|
|
|
* @note Only with this set can the client plant the bomb within the usual bomb
|
|
|
|
* target areas. If this is not set the user can not plant the bomb, even
|
|
|
|
* when he has one in the inventory. This is only correctly set when the
|
|
|
|
* client touches a bomb and picks it up "manually" (only possible for
|
|
|
|
* Terrorists), so this should be used if the bomb is added to the
|
|
|
|
* inventory through other means.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param plant If nonzero the client will be able to plant the bomb,
|
|
|
|
* otherwise he will be unable to
|
|
|
|
* @param showbombicon If nonzero the green C4 icon will be displayed on the
|
|
|
|
* client's hud, otherwise it will be hidden
|
|
|
|
*
|
|
|
|
* @return 1 if the client is able to plant the bomb, 0 otherwise
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error
|
|
|
|
* will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_set_user_plant(index, plant = 1, showbombicon = 1);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the client's team without killing the player, and sets the client model.
|
|
|
|
*
|
|
|
|
* @note For a list of valid team ids see the CsTeams enum, and for a list of
|
|
|
|
* valid internal model ids see the CsInternalModel enum.
|
|
|
|
*
|
2015-07-08 11:59:02 +00:00
|
|
|
* @param index Client index
|
|
|
|
* @param team Team id
|
|
|
|
* @param model Internal model id, if CS_DONTCHANGE the game will choose the model
|
2015-08-22 20:51:48 +00:00
|
|
|
or if CS_NORESET the game will not update it.
|
2015-07-08 11:59:02 +00:00
|
|
|
* @param send_teaminfo If true, a TeamInfo message will be sent
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
|
|
|
*/
|
2015-07-08 11:59:02 +00:00
|
|
|
native cs_set_user_team(index, any:team, any:model = CS_DONTCHANGE, bool:send_teaminfo = true);
|
2004-04-06 07:40:51 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns the client's team and optionally the model id.
|
|
|
|
*
|
|
|
|
* @note For a list of valid team ids see the CsTeams enum, and for a list of
|
|
|
|
* valid internal model ids see the CsInternalModel enum.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param model Optional variable to store model id in
|
|
|
|
*
|
|
|
|
* @return Team id
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2006-08-20 00:20:47 +00:00
|
|
|
*/
|
2015-03-11 13:19:27 +00:00
|
|
|
native CsTeams:cs_get_user_team(index, &any:model = CS_DONTCHANGE);
|
2006-08-20 00:20:47 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if the client is a VIP.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return 1 if the client is a VIP, 0 otherwise
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_get_user_vip(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the client's VIP status and displayed model and scoreboard flag.
|
|
|
|
*
|
|
|
|
* @note This is mostly useful for removing VIP status so the client can change
|
|
|
|
* teams and/or buy items properly. It does not alter gameplay, the player
|
|
|
|
* that is selected as VIP at the start of a round will retain the
|
|
|
|
* internal VIP status and remain the primary objective for the game mode.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param vip If nonzero the client will be made a VIP, otherwise the
|
|
|
|
* VIP status will be removed
|
|
|
|
* @param model If nonzero the client's model will be changed to the VIP
|
|
|
|
* model, otherwise a random CT model will be selected
|
|
|
|
* @param scoreboard If nonzero the scoreboard will be updated to reflect the
|
|
|
|
* new VIP status
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error
|
|
|
|
* will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2015-02-18 15:24:04 +00:00
|
|
|
native cs_set_user_vip(index, vip = 1, model = 1, scoreboard = 1);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if the client has committed a team kill in the current round.
|
|
|
|
*
|
|
|
|
* @note If this is set to 1 the client will be punished at the start of the
|
|
|
|
* next round depending on the value of the mp_tkpunish cvar. The team
|
|
|
|
* kill status is then reset.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return 1 if the client has committed a team kill, 0 otherwise
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2004-09-26 13:02:22 +00:00
|
|
|
*/
|
|
|
|
native cs_get_user_tked(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the client's team kill status, indicating whether the client has
|
|
|
|
* committed a team kill in the current round.
|
|
|
|
*
|
|
|
|
* @note If this is set to 1 the client will be punished at the start of the
|
|
|
|
* next round depending on the value of the mp_tkpunish cvar. The team
|
|
|
|
* kill status is then reset.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param tk Team kill status
|
|
|
|
* @param subtract Amount of frags to subtract, negative values add frags
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2004-09-26 13:02:22 +00:00
|
|
|
*/
|
|
|
|
native cs_set_user_tked(index, tk = 1, subtract = 1);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if the client is currently driving a vehicle and if so, indicates
|
|
|
|
* the speed.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return 0 if the client is not driving, 1 if driving a vehicle but
|
|
|
|
* not moving, 2 to 4 if driving positive speeds, 5 if
|
2015-07-09 13:20:23 +00:00
|
|
|
* driving at a negative speed (backing), see TRAIN_* constants
|
2015-07-14 17:36:36 +00:00
|
|
|
* in hlsdk_const.inc
|
2015-02-18 15:24:04 +00:00
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2004-09-26 13:02:22 +00:00
|
|
|
*/
|
|
|
|
native cs_get_user_driving(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if the client has a shield in the inventory.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return 1 if the client has a shield, 0 otherwise
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2005-03-16 21:00:16 +00:00
|
|
|
*/
|
|
|
|
native cs_get_user_shield(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if the client is using a stationary gun.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return 1 if the client uses a stationary gun, 0 otherwise
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2004-09-27 09:53:56 +00:00
|
|
|
*/
|
|
|
|
native cs_get_user_stationary(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns the client's armor value and retrieves the type of armor.
|
|
|
|
*
|
|
|
|
* @note For a list of possible armor types see the CsArmorType enum.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param armortype Variable to store armor type in
|
|
|
|
*
|
|
|
|
* @return Amount of armor, 0 if client has no armor
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error
|
|
|
|
* will be thrown.
|
2005-01-16 16:30:18 +00:00
|
|
|
*/
|
2015-07-04 17:59:30 +00:00
|
|
|
native cs_get_user_armor(index, &CsArmorType:armortype = CS_ARMOR_NONE);
|
2005-01-16 16:30:18 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the client's armor value the type of armor.
|
|
|
|
*
|
|
|
|
* @note For a list of possible armor types see the CsArmorType enum.
|
|
|
|
* @note Sends the appropriate message to update the client's HUD.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param armorvalue Amount of armor to set
|
|
|
|
* @param armortype CS armor type
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error
|
|
|
|
* will be thrown.
|
2005-01-16 16:30:18 +00:00
|
|
|
*/
|
|
|
|
native cs_set_user_armor(index, armorvalue, CsArmorType:armortype);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if the weapon is in burst mode.
|
|
|
|
*
|
|
|
|
* @note Only the Glock and Famas can return 1 as they are the only guns in the
|
|
|
|
* game that have a burst fire mode.
|
2015-04-09 13:37:43 +00:00
|
|
|
* @note This native does not verify that the provided entity is a weapon
|
|
|
|
* entity. It will return incorrect values for non-weapon entities.
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @param index Weapon entity index
|
|
|
|
*
|
|
|
|
* @return 1 if the weapon is in burst mode, 0 otherwise
|
|
|
|
* @error If an invalid entity index or a client index is provided,
|
|
|
|
* an error will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_get_weapon_burst(index);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the weapon's burst mode.
|
|
|
|
*
|
|
|
|
* @note Only the Glock and Famas can be set to burst fire mode as they are the
|
|
|
|
* only guns in the game that provide such a mode.
|
2015-04-09 13:37:43 +00:00
|
|
|
* @note This native does not verify that the provided entity is a weapon
|
|
|
|
* entity. It will result in undefined behavior if used on non-weapon
|
|
|
|
* entities.
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @param index Weapon entity index
|
|
|
|
* @param burstmode If nonzero the weapon will be put into burstmode,
|
|
|
|
* otherwise the burst mode will be removed
|
|
|
|
*
|
|
|
|
* @return 1 if burst mode set successfully, 0 if entity is not
|
|
|
|
* an applicable weapon
|
|
|
|
* @error If an invalid entity index or a client index is
|
|
|
|
* provided, an error will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_set_weapon_burst(index, burstmode = 1);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if the weapon is in silenced mode.
|
|
|
|
*
|
|
|
|
* @note Only the USP and M4A1 can return 1 as they are the only guns in the
|
|
|
|
* game that have a silenced fire mode.
|
2015-04-09 13:37:43 +00:00
|
|
|
* @note This native does not verify that the provided entity is a weapon
|
|
|
|
* entity. It will return incorrect values for non-weapon entities.
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @param index Weapon entity index
|
|
|
|
*
|
|
|
|
* @return 1 if the weapon is in silenced mode, 0 otherwise
|
|
|
|
* @error If an invalid entity index or a client index is provided,
|
|
|
|
* an error will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_get_weapon_silen(index);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the weapon's silenced mode.
|
|
|
|
*
|
|
|
|
* @note Only the USP and M4A1 can be set to silenced fire mode as they are the
|
|
|
|
* only guns in the game that provide such a mode.
|
2015-04-09 13:37:43 +00:00
|
|
|
* @note This native does not verify that the provided entity is a weapon
|
|
|
|
* entity. It will result in undefined behavior if used on non-weapon
|
|
|
|
* entities.
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @param index Weapon entity index
|
|
|
|
* @param silence If nonzero the weapon will be put into silenced
|
|
|
|
* mode, otherwise the silenced mode will be removed
|
2015-07-04 17:50:57 +00:00
|
|
|
* @param draw_animation If 1 and the weapon is currently held by a
|
2015-02-18 15:24:04 +00:00
|
|
|
* client, the appropriate weapon animation will be
|
|
|
|
* played
|
2015-07-04 17:50:57 +00:00
|
|
|
* If 2, same as 1 but follows game behavior by playing
|
|
|
|
* the associated player's model sequence and disallowing
|
|
|
|
* firing while animation is playing.
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @return 1 if silenced mode set successfully, 0 if entity is
|
|
|
|
* not an applicable weapon
|
|
|
|
* @error If an invalid entity index or a client index is
|
|
|
|
* provided, an error will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2006-08-18 20:12:20 +00:00
|
|
|
native cs_set_weapon_silen(index, silence = 1, draw_animation = 1);
|
2004-03-22 09:10:11 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns the amount of ammo in weapon's magazine.
|
|
|
|
*
|
2015-04-09 13:37:43 +00:00
|
|
|
* @note This native does not verify that the provided entity is a weapon
|
|
|
|
* entity. It will return incorrect values for non-weapon entities.
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @param index Weapon entity index
|
|
|
|
*
|
|
|
|
* @return Amount of ammo in magazine
|
|
|
|
* @error If an invalid entity index or a client index is provided,
|
|
|
|
* an error will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-03-22 09:10:11 +00:00
|
|
|
native cs_get_weapon_ammo(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the amount of ammo in weapon's clip.
|
|
|
|
*
|
2015-04-09 13:37:43 +00:00
|
|
|
* @note This native does not verify that the provided entity is a weapon
|
|
|
|
* entity. It will result in undefined behavior if used on non-weapon
|
|
|
|
* entities.
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @param index Weapon entity index
|
|
|
|
* @param newammo New ammo amount
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If an invalid entity index or a client index is provided,
|
|
|
|
* an error will be thrown.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2004-06-17 15:42:43 +00:00
|
|
|
native cs_set_weapon_ammo(index, newammo);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns the weapon id of an entity.
|
|
|
|
*
|
|
|
|
* @note For a list of possible weapon ids see the CSW_* constants in
|
|
|
|
* amxconst.inc
|
2015-04-09 13:37:43 +00:00
|
|
|
* @note This native does not verify that the provided entity is a weapon
|
|
|
|
* entity. It will return incorrect values for non-weapon entities.
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @param index Weapon entity index
|
|
|
|
*
|
|
|
|
* @return Weapon id
|
|
|
|
* @error If an invalid entity index or a client index is provided,
|
|
|
|
* an error will be thrown.
|
2004-09-25 23:24:34 +00:00
|
|
|
*/
|
2004-10-14 06:09:01 +00:00
|
|
|
native cs_get_weapon_id(index);
|
2004-09-25 23:24:34 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if "no knives" mode is enabled.
|
|
|
|
*
|
|
|
|
* @note "No knives" mode means that the CStrike module will prevent the game
|
|
|
|
* from creating (and thus attaching) "weapon_knife" entities. This means
|
|
|
|
* that clients will spawn without knives, but knives can still be put
|
|
|
|
* into the client inventories directly.
|
|
|
|
*
|
|
|
|
* @return 1 if "no knives" mode is enabled, 0 otherwise
|
2004-06-17 15:42:43 +00:00
|
|
|
*/
|
|
|
|
native cs_get_no_knives();
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Enables or disables the "no knives" mode.
|
|
|
|
*
|
|
|
|
* @note "No knives" mode means that the CStrike module will prevent the game
|
|
|
|
* from creating (and thus attaching) "weapon_knife" entities. This means
|
|
|
|
* that clients will spawn without knives, but knives can still be put
|
|
|
|
* into the client inventories directly.
|
|
|
|
*
|
|
|
|
* @param noknives If nonzero enable "no knives" mode, disable otherwise
|
|
|
|
*
|
|
|
|
* @noreturn
|
2004-06-17 15:42:43 +00:00
|
|
|
*/
|
|
|
|
native cs_set_no_knives(noknives = 0);
|
2005-03-16 21:00:16 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets a dead client up for spawning.
|
|
|
|
*
|
|
|
|
* @note This sets the client deadflag and triggers a client think, effectively
|
|
|
|
* making the game respawn the client. Should only be used on dead
|
|
|
|
* clients.
|
|
|
|
*
|
|
|
|
* @param player Client index
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2005-08-07 20:43:29 +00:00
|
|
|
*/
|
|
|
|
native cs_user_spawn(player);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns the armoury entity's weapon id.
|
|
|
|
*
|
|
|
|
* @note Not all weapon ids are supported by Counter-Strike, an armoury entity
|
|
|
|
* can not be a pistol, a knife or a bomb for exmaple. The full list is:
|
|
|
|
* CSW_SCOUT, CSW_HEGRENADE, CSW_XM1014, CSW_MAC10, CSW_AUG,
|
|
|
|
* CSW_SMOKEGRENADE, CSW_AWP, CSW_MP5NAVY, CSW_M249, CSW_M3, CSW_M4A1,
|
|
|
|
* CSW_TMP, CSW_G3SG1, CSW_VEST, CSW_VESTHELM, CSW_FLASHBANG,
|
|
|
|
* CSW_SG552, CSW_AK47, CSW_P90
|
|
|
|
*
|
|
|
|
* @param index Armoury entity index
|
2015-07-04 21:54:10 +00:00
|
|
|
* @param count Optional variable to store in the number of times that an item can be retrieved
|
|
|
|
* from the same entity before being hidden
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @return Weapon id
|
|
|
|
* @error If a non-armoury entity is provided, an error will be
|
|
|
|
* thrown.
|
2005-08-07 20:43:29 +00:00
|
|
|
*/
|
2015-07-04 21:54:10 +00:00
|
|
|
native cs_get_armoury_type(index, &count = 1);
|
2005-08-07 20:43:29 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the amoury entity type.
|
|
|
|
*
|
|
|
|
* @note Not all weapon ids are supported by Counter-Strike, an armoury entity
|
|
|
|
* can not be a pistol, a knife or a bomb for exmaple. The full list is:
|
|
|
|
* CSW_SCOUT, CSW_HEGRENADE, CSW_XM1014, CSW_MAC10, CSW_AUG,
|
|
|
|
* CSW_SMOKEGRENADE, CSW_AWP, CSW_MP5NAVY, CSW_M249, CSW_M3, CSW_M4A1,
|
|
|
|
* CSW_TMP, CSW_G3SG1, CSW_VEST, CSW_VESTHELM, CSW_FLASHBANG,
|
|
|
|
* CSW_SG552, CSW_AK47, CSW_P90
|
|
|
|
* @note This does not update the entity model.
|
2015-07-04 21:54:10 +00:00
|
|
|
* @note On restart, entity is always unhidden and the count is restored (this can not be below 1).
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @param index Armoury entity index
|
|
|
|
* @param type Weapon id
|
2015-07-04 21:54:10 +00:00
|
|
|
* @param count Number of times that an item can be retrieved from
|
|
|
|
* the same entity before being hidden
|
|
|
|
* If zero, the entity is hidden
|
|
|
|
* If below zero, nothing is set
|
2015-02-18 15:24:04 +00:00
|
|
|
* @noreturn
|
|
|
|
* @error If a non-armoury entity is provided, an error will be
|
|
|
|
* thrown.
|
2005-08-07 20:43:29 +00:00
|
|
|
*/
|
2015-07-04 21:54:10 +00:00
|
|
|
native cs_set_armoury_type(index, type, count = -1);
|
2006-05-26 18:26:59 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns the map zones the client is inside of as a bitflag value.
|
|
|
|
*
|
|
|
|
* @note If the user does not have the ability to plant (cs_get_user_plant()
|
|
|
|
* returns 0) then the bitflag will not contain CS_MAPZONE_BOMBTARGET.
|
|
|
|
* @nore For a list of possible zone flags see the CS_MAPZONE_* constants.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return Bitflag value of map zones
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2006-05-26 18:26:59 +00:00
|
|
|
*/
|
|
|
|
native cs_get_user_mapzones(index);
|
2006-06-10 20:46:12 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets a zoom type on the client.
|
|
|
|
*
|
|
|
|
* @note Zoom types are not tied to their intended weapons, so any zoom type can
|
|
|
|
* be combined with any weapon.
|
|
|
|
* @note For a list of possible zoom types see the zoom type enum above
|
|
|
|
* (CS_*_ZOOM constants).
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param type Zoom type
|
|
|
|
* @param mode If zero (blocking) the client will be forced to use the zoom
|
|
|
|
* type set and won't be able to change it until it is reset
|
|
|
|
* with CS_RESET_ZOOM, otherwise the user can restore back to
|
|
|
|
* normal as usual
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, the client is not connected, or an invalid zoom
|
|
|
|
* type is provided, an error will be thrown.
|
2006-06-10 20:46:12 +00:00
|
|
|
*/
|
|
|
|
native cs_set_user_zoom(index, type, mode);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if the client is zooming.
|
|
|
|
*
|
|
|
|
* @note For a list of possible zoom types see the zoom type enum above
|
|
|
|
* (CS_*_ZOOM constants).
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return Zoom type if the user is zoomed in, 0 otherwise
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2006-06-10 20:46:12 +00:00
|
|
|
*/
|
|
|
|
native cs_get_user_zoom(index);
|
2007-04-25 15:40:15 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if a submodel is set on the client.
|
|
|
|
*
|
|
|
|
* @note In Counter-Strike the submodel setting determines whether the user has
|
|
|
|
* a bomb backpack (if a Terrorist) or a defuse kit (if a CT) on their
|
|
|
|
* model.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return 1 if submodel is set, 0 otherwise
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
2007-04-25 15:40:15 +00:00
|
|
|
*/
|
|
|
|
native cs_get_user_submodel(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the submodel on a client.
|
|
|
|
*
|
|
|
|
* @note In Counter-Strike the submodel setting determines whether the user has
|
|
|
|
* a bomb backpack (if a Terrorist) or a defuse kit (if a CT) on their
|
|
|
|
* model.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param value If nonzero the submodel is set, otherwise it is removed
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
2007-04-25 15:40:15 +00:00
|
|
|
*/
|
|
|
|
native cs_set_user_submodel(index, value);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns the client's last activity time.
|
|
|
|
*
|
|
|
|
* @note This is the time that the internal Counter-Strike afk kicker uses to
|
|
|
|
* see who has been inactive too long.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return Last activity time
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
2007-04-25 15:40:15 +00:00
|
|
|
*/
|
|
|
|
native Float:cs_get_user_lastactivity(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the client's last activity time.
|
|
|
|
*
|
|
|
|
* @note This is the time that the internal Counter-Strike afk kicker uses to
|
|
|
|
* see who has been inactive too long.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param value New last activity time
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
*/
|
2007-04-25 15:40:15 +00:00
|
|
|
native cs_set_user_lastactivity(index, Float:value);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns the amount of hostages that the client has killed.
|
|
|
|
*
|
|
|
|
* @note This is the value that the internal Counter-Strike hostage punisher
|
|
|
|
* uses to determine if a client should be kicked, depending on the
|
|
|
|
* value of the mp_hostagepenalty value.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
*
|
|
|
|
* @return Amount of hostages killed
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
2007-05-01 21:38:39 +00:00
|
|
|
*/
|
|
|
|
native cs_get_user_hostagekills(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the amount of hostages that the client has killed.
|
|
|
|
*
|
|
|
|
* @note This is the value that the internal Counter-Strike hostage punisher
|
|
|
|
* uses to determine if a client should be kicked, depending on the
|
|
|
|
* value of the mp_hostagepenalty value. The punisher only checks this
|
2015-04-09 13:37:43 +00:00
|
|
|
* value when a hostage is killed, so setting this will not cause the
|
|
|
|
* client to be kicked until they actually kill a hostage.
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param value New amount of hostages killed
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* MaxClients, or the client is not connected, an error will be
|
|
|
|
*/
|
2007-05-01 21:38:39 +00:00
|
|
|
native cs_set_user_hostagekills(index, value);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns the last time a hostage was used.
|
|
|
|
*
|
|
|
|
* @param index Hostage entity
|
|
|
|
*
|
|
|
|
* @return Last use time
|
|
|
|
* @error If the provided entity index is not a hostage, an error will
|
|
|
|
* be thrown.
|
2007-04-25 15:40:15 +00:00
|
|
|
*/
|
|
|
|
native Float:cs_get_hostage_lastuse(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the last time a hostage was used.
|
|
|
|
*
|
|
|
|
* @param index Hostage entity
|
|
|
|
* @param value New last use time
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the provided entity index is not a hostage, an error will
|
|
|
|
* be thrown.
|
|
|
|
*/
|
2007-04-25 15:40:15 +00:00
|
|
|
native cs_set_hostage_lastuse(index, Float:value);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns the next time a hostage can be used.
|
|
|
|
*
|
|
|
|
* @param index Hostage entity
|
|
|
|
*
|
|
|
|
* @return Next use time
|
|
|
|
* @error If the provided entity index is not a hostage, an error will
|
|
|
|
* be thrown.
|
2007-04-25 15:40:15 +00:00
|
|
|
*/
|
|
|
|
native Float:cs_get_hostage_nextuse(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets the next time a hostage can be used.
|
|
|
|
*
|
|
|
|
* @param index Hostage entity
|
|
|
|
* @param value New next use time
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the provided entity index is not a hostage, an error will
|
|
|
|
* be thrown.
|
|
|
|
*/
|
2007-04-25 15:40:15 +00:00
|
|
|
native cs_set_hostage_nextuse(index, Float:value);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
2015-07-14 17:36:36 +00:00
|
|
|
* Returns the game time at which the bomb will explode.
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @param index C4 entity
|
|
|
|
*
|
|
|
|
* @return Explosion time
|
|
|
|
* @error If the provided entity index is not a bomb, an error will be
|
|
|
|
* thrown.
|
2007-04-25 15:40:15 +00:00
|
|
|
*/
|
|
|
|
native Float:cs_get_c4_explode_time(index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
2015-07-14 17:36:36 +00:00
|
|
|
* Sets the game time at which the bomb will explode.
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @param index C4 entity
|
|
|
|
* @param value New explosion time
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the provided entity index is not a bomb, an error will be
|
|
|
|
* thrown.
|
|
|
|
*/
|
2007-04-25 15:40:15 +00:00
|
|
|
native cs_set_c4_explode_time(index, Float:value);
|
2007-04-26 19:21:11 +00:00
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Returns if the bomb is being defused.
|
|
|
|
*
|
2015-02-24 21:51:36 +00:00
|
|
|
* @param c4index C4 entity
|
2015-02-18 15:24:04 +00:00
|
|
|
*
|
|
|
|
* @return 1 if the bomb is being defused, 0 otherwise
|
|
|
|
* @error If the provided entity index is not a bomb, an error will be
|
|
|
|
* thrown.
|
2007-08-03 19:11:47 +00:00
|
|
|
*/
|
|
|
|
native bool:cs_get_c4_defusing(c4index);
|
|
|
|
|
2015-02-18 15:24:04 +00:00
|
|
|
/**
|
|
|
|
* Sets if the bomb is being defused.
|
|
|
|
*
|
2015-02-24 21:51:36 +00:00
|
|
|
* @param c4index C4 entity
|
2015-02-18 15:24:04 +00:00
|
|
|
* @param defusing True if the bomb should be defused, false otherwise
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the provided entity index is not a bomb, an error will be
|
|
|
|
* thrown.
|
|
|
|
*/
|
2007-08-03 19:11:47 +00:00
|
|
|
native cs_set_c4_defusing(c4index, bool:defusing);
|
2014-05-29 22:13:03 +00:00
|
|
|
|
2015-01-14 08:28:40 +00:00
|
|
|
/**
|
2015-01-30 14:53:25 +00:00
|
|
|
* Creates an entity using Counter-Strike's custom CreateNamedEntity wrapper.
|
2015-01-14 08:28:40 +00:00
|
|
|
*
|
2015-01-30 14:53:25 +00:00
|
|
|
* @note Unlike other mods CS keeps track of entities using a custom hashtable.
|
2015-01-31 13:45:37 +00:00
|
|
|
* This function adds entities to this hashtable, providing benefits over
|
|
|
|
* the default CreateNamedEntity (used by create_entity() for example):
|
2015-01-30 14:53:25 +00:00
|
|
|
* - Storing entities in a hashtable allows CS to improve classname lookup
|
2015-01-31 13:45:37 +00:00
|
|
|
* performance compared to functions like FindEntityByString (used by
|
|
|
|
* find_ent_by_class() for example) that usually have to loop
|
|
|
|
* through all entities incrementally.
|
2015-01-30 14:53:25 +00:00
|
|
|
* - As CS exclusively uses the hashtable for classname lookup, entities
|
|
|
|
* created using the default engine functions will not be found by the
|
|
|
|
* game. For example "weaponbox" entities are supposed to be
|
|
|
|
* automatically cleaned up on round restart but are not considered if
|
|
|
|
* they have not been added to the hashtable.
|
2015-01-31 13:45:37 +00:00
|
|
|
* @note The faster hashtable lookup can be utilized with cs_find_ent_by_class()
|
2015-04-09 13:37:43 +00:00
|
|
|
* @note When creating an entity the classname has to be valid in the mod, as
|
|
|
|
* the engine needs to link the entity to an existing class internally.
|
|
|
|
* The classname string that is stored in the entvar struct
|
|
|
|
* (EV_SZ_classname) is separate from this association and can later be
|
|
|
|
* freely changed to serve other purposes.
|
2015-01-14 08:28:40 +00:00
|
|
|
*
|
|
|
|
* @param classname Entity class name
|
|
|
|
*
|
2015-02-18 15:24:04 +00:00
|
|
|
* @return Index of the created entity (> 0), 0 otherwise
|
2015-01-14 08:28:40 +00:00
|
|
|
*/
|
|
|
|
native cs_create_entity(const classname[]);
|
|
|
|
|
2015-01-31 13:45:37 +00:00
|
|
|
/**
|
2015-01-30 14:53:25 +00:00
|
|
|
* Finds an entity in the world using Counter-Strike's custom FindEntityByString
|
|
|
|
* wrapper.
|
|
|
|
*
|
|
|
|
* @note Unlike other mods CS keeps track of entities using a custom hashtable.
|
2015-01-31 13:45:37 +00:00
|
|
|
* This function utilizes the hasthable and allows for considerably faster
|
|
|
|
* classname lookup compared to the default FindEntityByString (used by
|
|
|
|
* find_ent_by_class() for example).
|
2015-01-30 14:53:25 +00:00
|
|
|
* @note This exclusively considers entities in the hashtable, created by the
|
2015-11-23 13:06:02 +00:00
|
|
|
* game itself, using cs_create_entity(), or added via cs_set_ent_class().
|
2015-01-30 14:53:25 +00:00
|
|
|
*
|
|
|
|
* @param start_index Entity index to start searching from. -1 to start from
|
|
|
|
* the first entity
|
|
|
|
* @param classname Classname to search for
|
|
|
|
*
|
|
|
|
* @return Entity index > 0 if found, 0 otherwise
|
|
|
|
*/
|
|
|
|
native cs_find_ent_by_class(start_index, const classname[]);
|
|
|
|
|
2015-07-26 17:55:10 +00:00
|
|
|
/**
|
|
|
|
* Finds an entity in the world using Counter-Strike's custom FindEntityByString
|
|
|
|
* wrapper, matching by owner.
|
|
|
|
*
|
|
|
|
* @note Unlike other mods CS keeps track of entities using a custom hashtable.
|
|
|
|
* This function utilizes the hasthable and allows for considerably faster
|
|
|
|
* classname lookup compared to the default FindEntityByString (used by
|
|
|
|
* find_ent_by_owner() for example).
|
|
|
|
* @note This exclusively considers entities in the hashtable, created by the
|
2015-11-23 13:06:02 +00:00
|
|
|
* game itself, using cs_create_entity(), or added via cs_set_ent_class().
|
2015-07-26 17:55:10 +00:00
|
|
|
*
|
|
|
|
* @param start_index Entity index to start searching from. -1 to start from
|
|
|
|
* the first entity
|
|
|
|
* @param classname Classname to search for
|
|
|
|
* @param owner Entity index to search for entity's owner
|
|
|
|
*
|
|
|
|
* @return Entity index > 0 if found, 0 otherwise
|
|
|
|
*/
|
|
|
|
native cs_find_ent_by_owner(start_index, const classname[], owner);
|
|
|
|
|
2015-11-23 13:06:02 +00:00
|
|
|
/**
|
|
|
|
* Sets a custom classname of an entity.
|
|
|
|
*
|
|
|
|
* @note Unlike other mods CS keeps track of entities using a custom hashtable.
|
|
|
|
* This function adds or updates the classname in the hasthable as well.
|
|
|
|
* This is useful for use with cs_find_ent_by_class() and cs_find_ent_by_owner().
|
|
|
|
*
|
|
|
|
* @param index Entity index
|
|
|
|
* @param classname Classname to update for
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
*/
|
|
|
|
native cs_set_ent_class(index, const classname[]);
|
|
|
|
|
2015-07-24 07:57:10 +00:00
|
|
|
/**
|
|
|
|
* Returns the item id associated with an item name and its aliases.
|
|
|
|
*
|
|
|
|
* @note The item name is case sensitive an can be with or without
|
|
|
|
* weapon_ and item_ prefixes. This can be a command alias as well.
|
|
|
|
* Values examples: ak47, weapon_ak47, kevlar, item_kevlar, vest, bullpup, ...
|
|
|
|
*
|
|
|
|
* @param name Alias or classname
|
|
|
|
* @param classid If item is a weapon, variable to store the associated
|
|
|
|
* weapon class id in (CS_WEAPONCLASS_* constants)
|
|
|
|
*
|
|
|
|
* @return Item id (CSI_* constants)
|
|
|
|
*/
|
|
|
|
native any:cs_get_item_id(const name[], &CsWeaponClassType:classid = CS_WEAPONCLASS_NONE);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an item name associated with a command alias.
|
|
|
|
*
|
|
|
|
* @note The alias is case sensitive.
|
|
|
|
* @note If not an alias to a weapon, buffer will be set with the original alias.
|
|
|
|
*
|
|
|
|
* @param alias Alias name
|
|
|
|
* @param itemname Buffer to store item name to
|
|
|
|
* @param maxlength Maximum buffer size
|
|
|
|
*
|
|
|
|
* @return True if alias is translated, false otherwise
|
|
|
|
*/
|
|
|
|
native bool:cs_get_translated_item_alias(const alias[], itemname[], maxlength);
|
|
|
|
|
2015-07-25 14:17:50 +00:00
|
|
|
/**
|
|
|
|
* Returns some information about a weapon.
|
|
|
|
*
|
|
|
|
* @param weapon_id Weapon id, see CSW_* constants
|
|
|
|
* @param type Info type, see CS_WEAPONINFO_* constants
|
|
|
|
*
|
|
|
|
* @return Weapon information value
|
|
|
|
* @error If weapon_id and type are out of bound, an error will be thrown.
|
|
|
|
*/
|
|
|
|
native any:cs_get_weapon_info(weapon_id, CsWeaponInfo:type);
|
|
|
|
|
2016-01-06 20:10:31 +00:00
|
|
|
/**
|
|
|
|
* Returns active weapon entity.
|
|
|
|
*
|
|
|
|
* @param playerIndex Player index
|
|
|
|
*
|
|
|
|
* @return Weapon entity index on success or 0 if there is no active weapon
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* maxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
|
|
|
*/
|
|
|
|
native cs_get_user_weapon_entity(playerIndex);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns weapon index of the active weapon.
|
|
|
|
*
|
|
|
|
* @note More reliable than get_user_weapon.
|
|
|
|
*
|
|
|
|
* @param playerIndex Player index
|
2016-02-17 19:46:42 +00:00
|
|
|
* @param clip Optional variable to store clip ammo to
|
|
|
|
* @param ammo Optional variable to store backpack ammo to
|
2016-01-06 20:10:31 +00:00
|
|
|
*
|
|
|
|
* @return Weapon index on success or 0 if there is no active weapon
|
|
|
|
* @error If the client index is not within the range of 1 to
|
|
|
|
* maxClients, or the client is not connected, an error will be
|
|
|
|
* thrown.
|
|
|
|
*/
|
2016-02-17 19:46:42 +00:00
|
|
|
native cs_get_user_weapon(playerIndex, &clip = 0, &ammo = 0);
|
2016-01-06 20:10:31 +00:00
|
|
|
|
2015-07-26 16:26:12 +00:00
|
|
|
/**
|
|
|
|
* Returns a weapon class id associated with a weapon id.
|
|
|
|
*
|
|
|
|
* @param weapon_id Weapon id (CSI_* constants)
|
|
|
|
*
|
|
|
|
* @return Weapon class id (CS_WEAPONCLASS_* constants)
|
|
|
|
*/
|
|
|
|
stock CsWeaponClassType:cs_get_weapon_class(weapon_id)
|
|
|
|
{
|
|
|
|
new CsWeaponClassType:type = CS_WEAPONCLASS_NONE;
|
|
|
|
|
2015-07-27 09:26:32 +00:00
|
|
|
if (cs_is_valid_itemid(weapon_id, .weapon_only = true) || weapon_id == CSI_SHIELD)
|
2015-07-26 16:26:12 +00:00
|
|
|
{
|
2015-07-27 09:26:32 +00:00
|
|
|
switch (weapon_id)
|
2015-07-26 16:26:12 +00:00
|
|
|
{
|
2015-07-27 09:26:32 +00:00
|
|
|
case CSI_SHIELDGUN, CSI_SHIELD:
|
|
|
|
{
|
|
|
|
type = CS_WEAPONCLASS_PISTOL;
|
|
|
|
}
|
|
|
|
case CSI_KNIFE:
|
|
|
|
{
|
|
|
|
type = CS_WEAPONCLASS_KNIFE;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
new const bits = (1 << weapon_id);
|
|
|
|
|
|
|
|
if(bits & CSI_ALL_PISTOLS)
|
|
|
|
{
|
|
|
|
type = CS_WEAPONCLASS_PISTOL;
|
|
|
|
}
|
|
|
|
else if(bits & CSI_ALL_GRENADES)
|
|
|
|
{
|
|
|
|
type = CS_WEAPONCLASS_GRENADE;
|
|
|
|
}
|
|
|
|
else if(bits & CSI_ALL_SMGS)
|
|
|
|
{
|
|
|
|
type = CS_WEAPONCLASS_SUBMACHINEGUN;
|
|
|
|
}
|
|
|
|
else if(bits & CSI_ALL_SHOTGUNS)
|
|
|
|
{
|
|
|
|
type = CS_WEAPONCLASS_SHOTGUN;
|
|
|
|
}
|
|
|
|
else if(bits & CSI_ALL_MACHINEGUNS)
|
|
|
|
{
|
|
|
|
type = CS_WEAPONCLASS_MACHINEGUN;
|
|
|
|
}
|
|
|
|
else if(bits & CSI_ALL_RIFLES)
|
|
|
|
{
|
|
|
|
type = CS_WEAPONCLASS_RIFLE;
|
|
|
|
}
|
|
|
|
else if(bits & CSI_ALL_SNIPERRIFLES)
|
|
|
|
{
|
|
|
|
type = CS_WEAPONCLASS_SNIPERRIFLE;
|
|
|
|
}
|
|
|
|
}
|
2015-07-26 16:26:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2015-07-27 09:26:32 +00:00
|
|
|
/**
|
|
|
|
* Checks whether an item id is not out of bounds.
|
|
|
|
*
|
|
|
|
* @param id Item id (CSI_* constants)
|
|
|
|
* @param weapon_only If true, only the real weapon ids will be checked,
|
|
|
|
* including shield as well
|
|
|
|
*
|
|
|
|
* @return True if item id is valid, false otherwise
|
|
|
|
*/
|
|
|
|
stock bool:cs_is_valid_itemid(id, bool:weapon_only = false)
|
|
|
|
{
|
|
|
|
if (id <= CSI_NONE)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (id > CSI_LAST_WEAPON && id != CSI_SHIELDGUN && weapon_only)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (id >= CSI_MAX_COUNT)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-04-26 19:21:11 +00:00
|
|
|
/**
|
2015-02-18 15:24:04 +00:00
|
|
|
* Called when CS internally fires a command to a player.
|
|
|
|
*
|
|
|
|
* @note This is most notably used by the rebuy/autobuy functionality,
|
|
|
|
* Condition Zero also uses this to pass commands to bots internally.
|
2007-04-26 19:21:11 +00:00
|
|
|
*
|
2015-02-18 15:24:04 +00:00
|
|
|
* @param id Client index
|
|
|
|
* @param cmd Command string
|
|
|
|
*
|
|
|
|
* @return PLUGIN_CONTINUE to let the command continue
|
|
|
|
* PLUGIN_HANDLED to block the command
|
2007-04-26 19:21:11 +00:00
|
|
|
*/
|
|
|
|
forward CS_InternalCommand(id, const cmd[]);
|
2014-05-29 22:13:03 +00:00
|
|
|
|
|
|
|
/**
|
2015-02-18 15:24:04 +00:00
|
|
|
* Called when a client attempts to purchase an item.
|
|
|
|
*
|
|
|
|
* @note This is called immediately when the client issues a buy command. The
|
2015-04-09 13:37:43 +00:00
|
|
|
* game has not yet checked if the client can actually buy the weapon.
|
2015-02-18 15:24:04 +00:00
|
|
|
* @note For a list of possible item ids see the CSI_* constants.
|
|
|
|
*
|
|
|
|
* @param index Client index
|
|
|
|
* @param item Item id
|
|
|
|
*
|
|
|
|
* @return PLUGIN_CONTINUE to let the buy attempt continue
|
|
|
|
* PLUGIN_HANDLED to block the buy attempt
|
2014-05-29 22:13:03 +00:00
|
|
|
*/
|
2014-07-04 08:33:55 +00:00
|
|
|
forward CS_OnBuyAttempt(index, item);
|
|
|
|
|
|
|
|
/**
|
2015-02-18 15:24:04 +00:00
|
|
|
* Called when a client purchases an item.
|
|
|
|
*
|
|
|
|
* @note This is called right before the user receives the item and before the
|
|
|
|
* money is deducted from their cash reserves.
|
|
|
|
* @note For a list of possible item ids see the CSI_* constants.
|
2014-07-04 08:33:55 +00:00
|
|
|
*
|
2015-02-18 15:24:04 +00:00
|
|
|
* @param index Client index
|
|
|
|
* @param item Item id
|
2014-07-04 08:33:55 +00:00
|
|
|
*
|
2015-02-18 15:24:04 +00:00
|
|
|
* @return PLUGIN_CONTINUE to let the buy continue
|
|
|
|
* PLUGIN_HANDLED to block the buy
|
2014-07-04 08:33:55 +00:00
|
|
|
*/
|
Cstrike: Remove CS_OnGetItemPrice forward (reverted from commit 33a7d74b6da2ca4dcb621e9b306c386ba040571e)
This is actually not possible to have a proper system to allow this.
This is two majors problems:
- The item price text can't be changed, whatever old and VGUI menu (it's either harcoded in config file or in client binary)
- Once you open VGUI menu, to know if user has enough money to select an item, client relies on the current HUD money value, this means, since we can't directly changed price, before opening the menu, money needs to be somehow faked and restored once closed. It's awful.
Overall it can't work properly, and at the end current forward doesn't make sense.
If an author wanted to have its own prices, the only only way would to force players to use old menu, then overwriting the whole buy menu, so you would be able to display what you want exactly.
2015-09-05 08:33:28 +00:00
|
|
|
forward CS_OnBuy(index, item);
|