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
|
|
|
|
#endinput
|
|
|
|
#endif
|
|
|
|
#define _cstrike_included
|
|
|
|
|
2006-05-10 10:42:49 +00:00
|
|
|
#if AMXX_VERSION_NUM >= 175
|
|
|
|
#pragma reqlib cstrike
|
|
|
|
#if !defined AMXMODX_NOAUTOLOAD
|
|
|
|
#pragma loadlib cstrike
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#pragma library cstrike
|
|
|
|
#endif
|
2005-07-15 19:05:31 +00:00
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Returns player deaths.
|
|
|
|
*/
|
2004-03-07 20:06:04 +00:00
|
|
|
native cs_get_user_deaths(index);
|
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Sets player deaths.
|
|
|
|
*/
|
2004-03-07 20:06:04 +00:00
|
|
|
native cs_set_user_deaths(index, newdeaths);
|
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Returns index of entity (does not have to be a player) which hostage is following. 0 is hostage doesn't follow anything.
|
2006-09-10 04:36:44 +00:00
|
|
|
* Note: this native does not work on Condition Zero, which has a different hostage AI than CS.
|
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
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Set hostage to follow entity specified in followedindex. Does not have to be a player. If followedindex is 0 the hostage will stop following.
|
2006-09-10 04:36:44 +00:00
|
|
|
* Note: this native does not work on Condition Zero, which has a different hostage AI than CS.
|
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
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Get unique hostage id.
|
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_get_hostage_id(index);
|
|
|
|
|
|
|
|
/* Get amount of ammo in backpack on a user for a specific weapon.
|
2004-04-06 07:40:51 +00:00
|
|
|
* Look in amxconst.inc for weapon types: CSW_*.
|
|
|
|
* Weapons on the same line uses the same ammo type:
|
|
|
|
* awm
|
|
|
|
* scout, ak, g3
|
|
|
|
* para
|
|
|
|
* famas, m4a1, aug, sg550, galil, sg552
|
|
|
|
* m3, xm
|
|
|
|
* usp, ump, mac
|
|
|
|
* fiveseven, p90
|
|
|
|
* deagle
|
|
|
|
* p228
|
|
|
|
* glock, mp5, tmp, elites
|
|
|
|
* flash
|
|
|
|
* he
|
|
|
|
* smoke
|
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_get_user_bpammo(index, weapon);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Restock/remove ammo in a user's backpack.
|
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_set_user_bpammo(index, weapon, amount);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Returns 1 if user has a defuse kit.
|
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_get_user_defuse(index);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
|
|
|
/* If defusekit is 1, the user will have a defuse kit.
|
2004-04-06 07:40:51 +00:00
|
|
|
* You can specify a different colour for the defuse kit icon showing on hud. Default is the normal green.
|
|
|
|
* You can specify an icon. Default is "defuser". Set flash to 1 if you want the icon to flash red.
|
|
|
|
*/
|
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
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Is user in buyzone? Returns 1 when true, 0 when false.
|
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_get_user_buyzone(index);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2004-06-07 15:33:45 +00:00
|
|
|
/* Returns 1 when user has a primary weapon OR a shield in inventory, else 0.
|
|
|
|
*/
|
|
|
|
native cs_get_user_hasprim(index);
|
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Get user model.
|
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_get_user_model(index, model[], len);
|
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Set user model.
|
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_set_user_model(index, const model[]);
|
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Use to reset model to standard selected model.
|
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_reset_user_model(index);
|
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Returns users money.
|
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_get_user_money(index);
|
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Gives money to user. If flash is 1, the difference between new and old amount will flash red or green.
|
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_set_user_money(index, money, flash = 1);
|
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Does user have night vision goggles?
|
|
|
|
*/
|
2004-03-20 23:58:26 +00:00
|
|
|
native cs_get_user_nvg(index);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Set nvgoggles to 1 to give night vision goggles to index. Set it to 0 to remove them.
|
|
|
|
*/
|
2004-03-20 23:58:26 +00:00
|
|
|
native cs_set_user_nvg(index, nvgoggles = 1);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Returns 1 if user has the "skill" to plant bomb, else 0. Normally this would only be true for a terrorist carrying a bomb.
|
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_get_user_plant(index);
|
|
|
|
|
|
|
|
/* If plant is 1, a user will be set to be able to plant bomb within the usual bomb target areas if having one.
|
2004-04-06 07:40:51 +00:00
|
|
|
* You should use this if you give a player a weapon_c4, or he won't be able to plant it
|
|
|
|
* without dropping it and picking it up again (only possible for terrorists).
|
|
|
|
* If showbombicon is 1, the green C4 icon will be shown on user hud (if plant "skill" was enabled).
|
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_set_user_plant(index, plant = 1, showbombicon = 1);
|
|
|
|
|
2004-04-22 09:38:30 +00:00
|
|
|
/* Set user team without killing player.
|
|
|
|
* If model is anything other than CS_DONTCHANGE, that will be set as player's model.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
|
|
|
enum CsInternalModel {
|
|
|
|
CS_DONTCHANGE = 0,
|
|
|
|
CS_CT_URBAN = 1,
|
|
|
|
CS_T_TERROR = 2,
|
|
|
|
CS_T_LEET = 3,
|
|
|
|
CS_T_ARCTIC = 4,
|
|
|
|
CS_CT_GSG9 = 5,
|
|
|
|
CS_CT_GIGN = 6,
|
|
|
|
CS_CT_SAS = 7,
|
|
|
|
CS_T_GUERILLA = 8,
|
2006-07-13 03:07:24 +00:00
|
|
|
CS_CT_VIP = 9,
|
|
|
|
CZ_T_MILITIA = 10,
|
|
|
|
CZ_CT_SPETSNAZ = 11
|
2004-04-06 07:40:51 +00:00
|
|
|
};
|
2005-07-08 05:42:10 +00:00
|
|
|
native cs_set_user_team(index, {CsTeams,_}:team, {CsInternalModel,_}:model = CS_DONTCHANGE);
|
2004-04-06 07:40:51 +00:00
|
|
|
|
2006-08-20 00:20:47 +00:00
|
|
|
/* Get team directly from player's entity.
|
|
|
|
* 1 = terrorist
|
|
|
|
* 2 = counter-terrorist
|
|
|
|
* 3 = spectator
|
|
|
|
*/
|
|
|
|
enum CsTeams {
|
|
|
|
CS_TEAM_UNASSIGNED = 0,
|
|
|
|
CS_TEAM_T = 1,
|
|
|
|
CS_TEAM_CT = 2,
|
|
|
|
CS_TEAM_SPECTATOR = 3
|
|
|
|
};
|
|
|
|
native CsTeams:cs_get_user_team(index, &{CsInternalModel,_}:model = CS_DONTCHANGE);
|
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Is user vip? Returns 1 if true, 0 if false.
|
|
|
|
*/
|
2004-03-04 16:08:31 +00:00
|
|
|
native cs_get_user_vip(index);
|
|
|
|
|
2004-04-22 12:38:57 +00:00
|
|
|
/* If vip = 1, user is set to vip.
|
2006-05-02 21:48:26 +00:00
|
|
|
* If model = 1, then user's model will be changed to VIP model or random CT model if vip = 0.
|
|
|
|
* If scoreboard = 1, then scoreboard will be updated to show that user is VIP.
|
2004-04-22 12:38:57 +00:00
|
|
|
* This shouldn't be used for players on teams other than CT.
|
|
|
|
* NOTE: this is mostly useful for unsetting vips, so they can change teams and/or buy items properly.
|
|
|
|
* It does not alter game play; the one being VIP at start of round will retain internal status as VIP; terrorists
|
|
|
|
* can terminate him and accomplish their objective, etc.
|
2004-04-06 07:40:51 +00:00
|
|
|
*/
|
2006-05-02 21:48:26 +00:00
|
|
|
native cs_set_user_vip(index, vip = 1, model = 1, scoreboard = 1);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2004-09-26 13:02:22 +00:00
|
|
|
/* Returns 1 of specified user has tk:ed (team killed).
|
|
|
|
*/
|
|
|
|
native cs_get_user_tked(index);
|
|
|
|
|
|
|
|
/* Returns 1 of specified user has TKed (team killed).
|
|
|
|
* tk = 1: player has TKed
|
|
|
|
* tk = 0: player hasn't TKed
|
|
|
|
* Set subtract to how many frags to subtract. Set subtract to negative value to add frags.
|
|
|
|
*/
|
|
|
|
native cs_set_user_tked(index, tk = 1, subtract = 1);
|
|
|
|
|
2004-09-27 06:09:59 +00:00
|
|
|
/* Returns different values depending on if user is driving a vehicle - and if so at what speed.
|
2004-09-26 13:02:22 +00:00
|
|
|
* 0: no driving
|
|
|
|
* 1: driving, but standing still
|
|
|
|
* 2-4: driving, different positive speeds
|
|
|
|
* 5: driving, negative speed (backing)
|
|
|
|
* Note: these values were tested quickly, they may differ.
|
|
|
|
*/
|
|
|
|
native cs_get_user_driving(index);
|
|
|
|
|
2005-03-16 21:00:16 +00:00
|
|
|
/* Returns 1 if user has a shield, else 0.
|
|
|
|
*/
|
|
|
|
native cs_get_user_shield(index);
|
|
|
|
|
2004-09-27 09:53:56 +00:00
|
|
|
/* Returns 1 if user is using a stationary gun, else 0.
|
|
|
|
*/
|
|
|
|
native cs_get_user_stationary(index);
|
|
|
|
|
2005-10-29 18:19:23 +00:00
|
|
|
/* Returns armor value and sets by reference the armor type in second parameter.
|
2005-01-16 16:30:18 +00:00
|
|
|
*/
|
|
|
|
enum CsArmorType {
|
|
|
|
CS_ARMOR_NONE = 0, // no armor
|
|
|
|
CS_ARMOR_KEVLAR = 1, // armor
|
|
|
|
CS_ARMOR_VESTHELM = 2 // armor and helmet
|
|
|
|
};
|
2005-10-29 18:19:23 +00:00
|
|
|
native cs_get_user_armor(index, &CsArmorType:armortype);
|
2005-01-16 16:30:18 +00:00
|
|
|
|
|
|
|
/* Use this instead of fun's set_user_armor.
|
|
|
|
* Appropriate message to update client's HUD will be sent if armortype is kevlar or vesthelm.
|
|
|
|
*/
|
|
|
|
native cs_set_user_armor(index, armorvalue, CsArmorType:armortype);
|
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Returns 1 if specified weapon is in burst mode.
|
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_get_weapon_burst(index);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
|
|
|
/* If burstmode = 1, weapon will be changed to burst mode, 0 and non-burst mode (semiautomatic/automatic) will be activated.
|
2004-04-06 07:40:51 +00:00
|
|
|
* Only GLOCK and FAMAS can enter/leave burst mode.
|
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_set_weapon_burst(index, burstmode = 1);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Returns 1 if weapon is silenced, else 0.
|
|
|
|
*/
|
2004-03-22 07:23:47 +00:00
|
|
|
native cs_get_weapon_silen(index);
|
2004-03-04 16:08:31 +00:00
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* If silence = 1, weapon will be silenced, 0 and silencer will be removed. Only USP and M4A1 can be silenced.
|
|
|
|
*/
|
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
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Returns amount of ammo in weapon's clip.
|
|
|
|
*/
|
2004-03-22 09:10:11 +00:00
|
|
|
native cs_get_weapon_ammo(index);
|
|
|
|
|
2004-04-06 07:40:51 +00:00
|
|
|
/* Set amount of ammo in weapon's clip.
|
|
|
|
*/
|
2004-06-17 15:42:43 +00:00
|
|
|
native cs_set_weapon_ammo(index, newammo);
|
|
|
|
|
2004-09-25 23:24:34 +00:00
|
|
|
/* Get weapon type. Corresponds to CSW_* in amxconst.inc: 1 is CSW_P228, 2 is CSW_SCOUT and so on...
|
|
|
|
*/
|
2004-10-14 06:09:01 +00:00
|
|
|
native cs_get_weapon_id(index);
|
2004-09-25 23:24:34 +00:00
|
|
|
|
2004-06-17 15:42:43 +00:00
|
|
|
/* Returns 1 if no knives mode is enabled, else 0.
|
|
|
|
*/
|
|
|
|
native cs_get_no_knives();
|
|
|
|
|
|
|
|
/* Enabled no knives mode by calling this with value 1. Disabled with 0.
|
|
|
|
* No knives mode means that player will not be given a knife when spawning.
|
|
|
|
* You can still give knives (ie through fun's give_item).
|
|
|
|
*/
|
|
|
|
native cs_set_no_knives(noknives = 0);
|
2005-03-16 21:00:16 +00:00
|
|
|
|
2005-08-07 20:43:29 +00:00
|
|
|
/* Spawns a Counter-Strike player
|
|
|
|
*/
|
|
|
|
native cs_user_spawn(player);
|
|
|
|
|
|
|
|
/* Get what weapon type (CSW_*) an armoury_entity is.
|
|
|
|
*/
|
|
|
|
native cs_get_armoury_type(index);
|
|
|
|
|
|
|
|
/* Set an armoury_entity to be of specified type. You will have to set the appropriate model.
|
|
|
|
* The second argument, type, should be a CSW_* constant. Not all weapons are supported by Counter-strike.
|
|
|
|
* Supported weapons/items: CSW_MP5NAVY, CSW_TMP, CSW_P90, CSW_MAC10, CSW_AK47, CSW_SG552, CSW_M4A1, CSW_AUG, CSW_SCOUT
|
|
|
|
* CSW_G3SG1, CSW_AWP, CSW_M3, CSW_XM1014, CSW_M249, CSW_FLASHBANG, CSW_HEGRENADE, CSW_VEST, CSW_VESTHELM, CSW_SMOKEGRENADE
|
|
|
|
*/
|
2006-05-26 18:26:59 +00:00
|
|
|
native cs_set_armoury_type(index, type);
|
|
|
|
|
|
|
|
#define CS_MAPZONE_BUY (1<<0)
|
|
|
|
#define CS_MAPZONE_BOMBTARGET (1<<1)
|
|
|
|
#define CS_MAPZONE_HOSTAGE_RESCUE (1<<2)
|
|
|
|
#define CS_MAPZONE_ESCAPE (1<<3)
|
|
|
|
#define CS_MAPZONE_VIP_SAFETY (1<<4)
|
|
|
|
|
|
|
|
/* Returns in bitwise form if the user is in a specific map zone.
|
|
|
|
* NOTE: If user can't plant (cs_get_user_plant(index) is 0) then cs_get_user_mapzones(index) & CS_MAPZONE_BOMBTARGET will return 0 too.
|
|
|
|
*/
|
|
|
|
native cs_get_user_mapzones(index);
|
2006-06-10 20:46:12 +00:00
|
|
|
|
|
|
|
/* Zoom type enum. Used for get/set_user_zoom() natives.
|
2006-06-12 10:08:54 +00:00
|
|
|
*/
|
2006-06-10 20:46:12 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
CS_RESET_ZOOM = 0, // Reset any zoom blocking (when using this type, mode has no effect)
|
|
|
|
CS_SET_NO_ZOOM, // Disable any sort of zoom (ie: to disable zoom in all weapons use this with mode=0)
|
|
|
|
CS_SET_FIRST_ZOOM, // Set first zoom (awp style)
|
|
|
|
CS_SET_SECOND_ZOOM, // Set second zoom (awp style)
|
|
|
|
CS_SET_AUGSG552_ZOOM, // Set aug/sg552 zoom style
|
|
|
|
};
|
|
|
|
/* Sets a weapon zoom type on a player, any zoom type will work for all weapons, so you can even set an awp zoom to pistols :D
|
|
|
|
* The 2nd param has to be one of the above zoom types in the enum. Mode can only be 0 or 1.
|
|
|
|
* If mode=0 (blocking mode), the user will be forced to use the zoom type set by the native, and wont be able to change it (even by changing weapon)
|
|
|
|
* until the native resets the zoom with CS_RESET_ZOOM.
|
|
|
|
* If mode=1 the user will be able to restore back to a normal view by changing weapon.
|
|
|
|
*/
|
|
|
|
native cs_set_user_zoom(index, type, mode);
|
|
|
|
|
|
|
|
/* Returns how a user is zooming during the native call. Values correspond to the above enum, but will return 0 if an error occurred.
|
|
|
|
*/
|
|
|
|
native cs_get_user_zoom(index);
|
2007-04-25 15:40:15 +00:00
|
|
|
|
|
|
|
/* Returns the submodel setting of the player.
|
|
|
|
* If this is 1, then the user has a backpack or defuser on their model (depending on team)
|
|
|
|
*/
|
|
|
|
native cs_get_user_submodel(index);
|
|
|
|
|
|
|
|
/* Sets the submodel setting of the player.
|
|
|
|
* If this is 1, then the user has a backpack or defuser on their model (depending on team)
|
|
|
|
* 0 removes it.
|
|
|
|
*/
|
|
|
|
native cs_set_user_submodel(index, value);
|
|
|
|
|
|
|
|
/* Gets or sets the user's last activity time. This is the time that CS's internal afk kicker
|
|
|
|
* checks to see who has been afk too long.
|
|
|
|
*/
|
|
|
|
native Float:cs_get_user_lastactivity(index);
|
|
|
|
|
|
|
|
native cs_set_user_lastactivity(index, Float:value);
|
|
|
|
|
2007-05-01 21:38:39 +00:00
|
|
|
/* Gets or sets the number of hostages that a user has killed.
|
|
|
|
*/
|
|
|
|
native cs_get_user_hostagekills(index);
|
|
|
|
|
|
|
|
native cs_set_user_hostagekills(index, value);
|
|
|
|
|
2007-04-25 15:40:15 +00:00
|
|
|
/* Gets or sets the time that the hostage was last used.
|
|
|
|
*/
|
|
|
|
native Float:cs_get_hostage_lastuse(index);
|
|
|
|
|
|
|
|
native cs_set_hostage_lastuse(index, Float:value);
|
|
|
|
|
|
|
|
/* Gets or sets the time which the hostage can next be used.
|
|
|
|
*/
|
|
|
|
native Float:cs_get_hostage_nextuse(index);
|
|
|
|
|
|
|
|
native cs_set_hostage_nextuse(index, Float:value);
|
|
|
|
|
|
|
|
/* Gets or sets the time in which the C4 will explode.
|
|
|
|
*/
|
|
|
|
native Float:cs_get_c4_explode_time(index);
|
|
|
|
|
|
|
|
native cs_set_c4_explode_time(index, Float:value);
|
2007-04-26 19:21:11 +00:00
|
|
|
|
2007-08-03 19:11:47 +00:00
|
|
|
/* Gets or sets whether the C4 is being defused.
|
|
|
|
*/
|
|
|
|
native bool:cs_get_c4_defusing(c4index);
|
|
|
|
|
|
|
|
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-01-14 08:28:40 +00:00
|
|
|
*
|
|
|
|
* @param classname Entity class name
|
|
|
|
*
|
|
|
|
* @return Index of the created entity, 0 otherwise.
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
* game itself or using cs_create_entity().
|
|
|
|
*
|
|
|
|
* @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[]);
|
|
|
|
|
2007-04-26 19:21:11 +00:00
|
|
|
/**
|
|
|
|
* Called when CS internally fires a command to a player. It does this for a few
|
|
|
|
* functions, most notably rebuy/autobuy functionality. This is also used to pass
|
|
|
|
* commands to CZ bots internally.
|
|
|
|
*
|
|
|
|
* @param id Client index.
|
|
|
|
* @param cmd Command string.
|
|
|
|
* @return PLUGIN_HANDLED to block, PLUGIN_CONTINUE for normal operation.
|
|
|
|
*/
|
|
|
|
forward CS_InternalCommand(id, const cmd[]);
|
2014-05-29 22:13:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2014-07-04 08:33:55 +00:00
|
|
|
* The following constants are used with CS_OnBuy[Attempt] forwards.
|
2014-05-29 22:13:03 +00:00
|
|
|
*/
|
|
|
|
#define CSI_P228 CSW_P228
|
|
|
|
#define CSI_SCOUT CSW_SCOUT
|
|
|
|
#define CSI_HEGRENADE CSW_HEGRENADE
|
|
|
|
#define CSI_XM1014 CSW_XM1014
|
|
|
|
#define CSI_C4 CSW_C4
|
|
|
|
#define CSI_MAC10 CSW_MAC10
|
|
|
|
#define CSI_AUG CSW_AUG
|
|
|
|
#define CSI_SMOKEGRENADE CSW_SMOKEGRENADE
|
|
|
|
#define CSI_ELITE CSW_ELITE
|
|
|
|
#define CSI_FIVESEVEN CSW_FIVESEVEN
|
|
|
|
#define CSI_UMP45 CSW_UMP45
|
|
|
|
#define CSI_SG550 CSW_SG550
|
2014-06-08 17:58:18 +00:00
|
|
|
#define CSI_GALIL CSW_GALIL
|
2014-05-29 22:13:03 +00:00
|
|
|
#define CSI_FAMAS CSW_FAMAS
|
|
|
|
#define CSI_USP CSW_USP
|
|
|
|
#define CSI_GLOCK18 CSW_GLOCK18
|
|
|
|
#define CSI_AWP CSW_AWP
|
|
|
|
#define CSI_MP5NAVY CSW_MP5NAVY
|
|
|
|
#define CSI_M249 CSW_M249
|
|
|
|
#define CSI_M3 CSW_M3
|
|
|
|
#define CSI_M4A1 CSW_M4A1
|
|
|
|
#define CSI_TMP CSW_TMP
|
|
|
|
#define CSI_G3SG1 CSW_G3SG1
|
|
|
|
#define CSI_FLASHBANG CSW_FLASHBANG
|
|
|
|
#define CSI_DEAGLE CSW_DEAGLE
|
|
|
|
#define CSI_SG552 CSW_SG552
|
|
|
|
#define CSI_AK47 CSW_AK47
|
|
|
|
#define CSI_P90 CSW_P90
|
|
|
|
#define CSI_SHIELDGUN CSW_SHIELDGUN
|
|
|
|
#define CSI_VEST CSW_VEST // Custom
|
|
|
|
#define CSI_VESTHELM CSW_VESTHELM // Custom
|
|
|
|
#define CSI_DEFUSER 33 // Custom
|
|
|
|
#define CSI_NVGS 34 // Custom
|
2014-06-08 17:58:18 +00:00
|
|
|
#define CSI_PRIAMMO 36 // Custom
|
2014-05-29 22:13:03 +00:00
|
|
|
#define CSI_SECAMMO 37 // Custom
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a player attempts to purchase an item.
|
2014-07-04 08:33:55 +00:00
|
|
|
* This is ususally called right away on buy commands issued by a player.
|
|
|
|
*
|
|
|
|
* @note Return PLUGIN_CONTINUE to allow the purchase or return a higher action to deny.
|
2014-05-29 22:13:03 +00:00
|
|
|
*
|
2014-06-03 08:05:56 +00:00
|
|
|
* @param index Player index.
|
2014-05-29 22:13:03 +00:00
|
|
|
* @param item Item index, see CSI_* constants.
|
|
|
|
*/
|
2014-07-04 08:33:55 +00:00
|
|
|
forward CS_OnBuyAttempt(index, item);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a player purchases an item.
|
|
|
|
* This usually called right before a player gets the purchased item.
|
|
|
|
*
|
|
|
|
* @note Return PLUGIN_CONTINUE to allow the purchase or return a higher action to deny.
|
|
|
|
*
|
|
|
|
* @param index Player index.
|
|
|
|
* @param item Item index, see CSI_* constants.
|
|
|
|
*/
|
2014-08-04 12:12:15 +00:00
|
|
|
forward CS_OnBuy(index, item);
|