diff --git a/plugins/include/csstats.inc b/plugins/include/csstats.inc index eb8dd300..9bb7c099 100755 --- a/plugins/include/csstats.inc +++ b/plugins/include/csstats.inc @@ -12,58 +12,263 @@ #endif #define _csstats_included -/* Gets stats from given weapon index. If wpnindex is 0 -* then the stats are from all weapons. If weapon has not been used function -* returns 0 in other case 1. Fields in stats are: -* 0 - kills -* 1 - deaths -* 2 - headshots -* 3 - teamkilling -* 4 - shots -* 5 - hits -* 6 - damage +/** + * Retrieves the client's current weapon statistics. + * + * @note For a list of default CS weapon ids see the CSW_* constants in + * amxconst.inc, this function also works on custom weapons. + * @note For a list of possible body hitplaces see the HIT_* constants in + * amxconst.inc + * @note The fields in the statistics are: + * 0 - Kills + * 1 - Deaths + * 2 - Headshots + * 3 - Teamkills + * 4 - Shots + * 5 - Hits + * 6 - Damage + * + * @param index Client index + * @param wpnindex Weapon id, or 0 to retrieve total statistics across all + * weapons + * @param stats Buffer to copy statistics to + * @param bodyhits Buffer to copy body hits to + * + * @return 1 on success, 0 if no statistics are available for the weapon + * id + * @error If an invalid client index or weapon id is provided, an + * error will be thrown. + */ +native get_user_wstats(index, wpnindex, stats[8], bodyhits[8]); -* For body hits fields see amxconst.inc. */ -native get_user_wstats(index,wpnindex,stats[8],bodyhits[8]); +/** + * Retrieves the client's weapon statistics from the current round. + * + * @note For a list of default CS weapon ids see the CSW_* constants in + * amxconst.inc, this function also works on custom weapons. + * @note For a list of possible body hitplaces see the HIT_* constants in + * amxconst.inc + * @note The fields in the statistics are: + * 0 - Kills + * 1 - Deaths + * 2 - Headshots + * 3 - Teamkills + * 4 - Shots + * 5 - Hits + * 6 - Damage + * + * @param index Client index + * @param wpnindex Weapon id, or 0 to retrieve total statistics across all + * weapons + * @param stats Buffer to copy statistics to + * @param bodyhits Buffer to copy body hits to + * + * @return 1 on success, 0 if no statistics are available for the + * weapon id + * @error If an invalid client index or weapon id is provided, an + * error will be thrown. + */ +native get_user_wrstats(index, wpnindex, stats[8], bodyhits[8]); -/* Gets round stats from given weapon index.*/ -native get_user_wrstats(index,wpnindex,stats[8],bodyhits[8]); +/** + * Retrieves the client's weapon statistics from the permanent storage on the + * server. + * + * @note The permanent storage is updated on every respawn or client disconnect. + * @note Player rank is determined by the difference of kills to deaths. + * @note For a list of possible body hitplaces see the HIT_* constants in + * amxconst.inc + * @note The fields in the statistics are: + * 0 - Kills + * 1 - Deaths + * 2 - Headshots + * 3 - Teamkills + * 4 - Shots + * 5 - Hits + * 6 - Damage + * 7 - Rank + * + * @param index Client index + * @param stats Buffer to copy statistics to + * @param bodyhits Buffer to copy body hits to + * + * @return Players rank > 0 on success, or 0 if player is not ranked + * and no statistics are available + * @error If an invalid client index is provided, an error will be + * thrown. + */ +native get_user_stats(index, stats[8], bodyhits[8]); -/* Gets overall stats which are stored in file on server -* and updated on every respawn or user disconnect. -* Function returns the position in stats by diff. kills to deaths. */ -native get_user_stats(index,stats[8],bodyhits[8]); +/** + * Retrieves the client's statistics from the current round. + * + * @note For a list of possible body hitplaces see the HIT_* constants in + * amxconst.inc + * @note The fields in the statistics are: + * 0 - Kills + * 1 - Deaths + * 2 - Headshots + * 3 - Teamkills + * 4 - Shots + * 5 - Hits + * 6 - Damage + * + * @param index Client index + * @param stats Buffer to copy statistics to + * @param bodyhits Buffer to copy body hits to + * + * @return 1 on success, 0 if no statistics are available + * @error If an invalid client index is provided, an error will be + * thrown. + */ +native get_user_rstats(index, stats[8], bodyhits[8]); -/* Gets round stats of player. */ -native get_user_rstats(index,stats[8],bodyhits[8]); +/** + * Retrieves the client's statistics inflicted upon another client from the + * current round. + * + * @note For a list of possible body hitplaces see the HIT_* constants in + * amxconst.inc + * @note The fields in the statistics are: + * 0 - Kills + * 1 - Deaths + * 2 - Headshots + * 3 - Teamkills + * 4 - Shots + * 5 - Hits + * 6 - Damage + * + * @param index Client index + * @param victim Victim client index, or 0 to retrieve the statistics against + * all victims + * @param stats Buffer to copy statistics to + * @param bodyhits Buffer to copy body hits to + * @param wpnname Optional buffer to copy last used weapon name to + * @param len Maximum buffer size + * + * @return 1 on success, 0 if no statistics are available against the + * specified victim + * @error If an invalid client index is provided, an error will be + * thrown. + */ +native get_user_vstats(index, victim, stats[8], bodyhits[8], wpnname[] = "", len = 0); -/* Gets stats with which user have killed/hurt his victim. If victim is 0 -* then stats are from all victims. If victim has not been hurt, function -* returns 0 in other case 1. User stats are reset on his respawn. */ -native get_user_vstats(index,victim,stats[8],bodyhits[8],wpnname[]="",len=0); +/** + * Retrieves the client's statistics received from another client from the + * current round. + * + * @note For a list of possible body hitplaces see the HIT_* constants in + * amxconst.inc + * @note The fields in the statistics are: + * 0 - Kills + * 1 - Deaths + * 2 - Headshots + * 3 - Teamkills + * 4 - Shots + * 5 - Hits + * 6 - Damage + * + * @param index Client index + * @param wpnindex Attacker client index, or 0 to retrieve the statistics from + * all attackers + * @param stats Buffer to copy statistics to + * @param bodyhits Buffer to copy body hits to + * @param wpnname Optional buffer to copy last used weapon name to + * @param len Maximum buffer size + * + * @return 1 on success, 0 if no statistics are available against the + * specified attacker + * @error If an invalid client index is provided, an error will be + * thrown. + */ +native get_user_astats(index, wpnindex, stats[8], bodyhits[8], wpnname[] = "", len = 0); -/* Gets stats with which user have been killed/hurt. If killer is 0 -* then stats are from all attacks. If killer has not hurt user, function -* returns 0 in other case 1. User stats are reset on his respawn. */ -native get_user_astats(index,wpnindex,stats[8],bodyhits[8],wpnname[]="",len=0); - -/* Resets life, weapon, victims and attackers user stats. */ +/** + * Resets the current round weapon, attacker and victim statistics. + * + * @param index Client index + * + * @noreturn + * @error If an invalid client index is provided, an error will be + * thrown. + */ native reset_user_wstats(index); -/* Gets overall stats which stored in stats.dat file in amx folder -* and updated on every mapchange or user disconnect. -* Function returns next index of stats entry or 0 if no more exists. */ -native get_stats(index,stats[8],bodyhits[8],name[],len,authid[] = "",authidlen = 0); +/** + * Retrieves statistics from the permanent storage on the server via iterative, + * incremental access. + * + * @note The permanent storage is updated on every respawn or client disconnect. + * @note Player rank is determined by the difference of kills to deaths. + * @note For a list of possible body hitplaces see the HIT_* constants in + * amxconst.inc + * @note The fields in the statistics are: + * 0 - Kills + * 1 - Deaths + * 2 - Headshots + * 3 - Teamkills + * 4 - Shots + * 5 - Hits + * 6 - Damage + * 7 - Rank + * + * @param index Rank index + * @param stats Buffer to copy statistics to + * @param bodyhits Buffer to copy body hits to + * @param name Buffer to copy client name to + * @param len Maximum name buffer size + * @param authid Buffer to copy client auth id to + * @param authidlen Maximum authid buffer size + * + * @return Next rank index (> 0 and > index), or 0 if no more + * statistics exist + */ +native get_stats(index, stats[8], bodyhits[8], name[], len, authid[] = "", authidlen = 0); -/* Returns number of all entries in stats. */ +/** + * Returns the number of all entries in the permanent statistics storage. + * + * @return Number of entries in statistics storage + */ native get_statsnum(); -/* -* new stats: -* 0 - total defusions -* 1 - bomb defused -* 2 - bomb plants -* 3 - bomb explosions -*/ -native get_user_stats2(index,stats[4]); -native get_stats2(index,stats[4],authid[] = "",authidlen = 0); +/** + * Retrieves the client's objective statistics from the permanent storage. + * + * @note The permanent storage is updated on every respawn or client disconnect. + * @note The fields in the statistics are: + * 0 - total defusions + * 1 - bomb defused + * 2 - bomb plants + * 3 - bomb explosions + * + * @param index Client index + * @param stats Buffer to copy statistics to + * + * @return Players rank > 0 on success, or 0 if player is not ranked + * and no statistics are available + * @error If an invalid client index is provided, an error will be + * thrown. + */ +native get_user_stats2(index, stats[4]); + +/** + * Retrieves objective statistics from the permanent storage on the server via + * iterative, incremental access. + * + * @note The permanent storage is updated on every respawn or client disconnect. + * @note The fields in the statistics are: + * 0 - total defusions + * 1 - bomb defused + * 2 - bomb plants + * 3 - bomb explosions + * + * @param index Client index + * @param stats Buffer to copy statistics to + * @param authid Buffer to copy client auth id to + * @param authidlen Maximum authid buffer size + * + * @return Next rank index (> 0 and > index), or 0 if no more + * statistics exist + */ +native get_stats2(index, stats[4], authid[] = "", authidlen = 0); diff --git a/plugins/include/cstrike.inc b/plugins/include/cstrike.inc index 6bd2846d..2ee0752d 100755 --- a/plugins/include/cstrike.inc +++ b/plugins/include/cstrike.inc @@ -12,7 +12,7 @@ // #if defined _cstrike_included - #endinput + #endinput #endif #define _cstrike_included @@ -25,329 +25,1060 @@ #pragma library cstrike #endif -/* Returns player deaths. +/** + * @section Team and team model constants, used by cs_[get|set]_user_team(). */ -native cs_get_user_deaths(index); -/* Sets player deaths. +/** + * Internal Counter-Strike model id constants. + * + * @note Model ids starting with CZ_ are only valid in Condition Zero. */ -native cs_set_user_deaths(index, newdeaths); - -/* Returns index of entity (does not have to be a player) which hostage is following. 0 is hostage doesn't follow anything. - * Note: this native does not work on Condition Zero, which has a different hostage AI than CS. - */ -native cs_get_hostage_foll(index); - -/* Set hostage to follow entity specified in followedindex. Does not have to be a player. If followedindex is 0 the hostage will stop following. - * Note: this native does not work on Condition Zero, which has a different hostage AI than CS. - */ -native cs_set_hostage_foll(index, followedindex = 0); - -/* Get unique hostage id. - */ -native cs_get_hostage_id(index); - -/* Get amount of ammo in backpack on a user for a specific weapon. - * 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 - */ -native cs_get_user_bpammo(index, weapon); - -/* Restock/remove ammo in a user's backpack. - */ -native cs_set_user_bpammo(index, weapon, amount); - -/* Returns 1 if user has a defuse kit. - */ -native cs_get_user_defuse(index); - -/* If defusekit is 1, the user will have a defuse kit. - * 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. - */ -native cs_set_user_defuse(index, defusekit = 1, r = 0, g = 160, b = 0, icon[] = "defuser", flash = 0); - -/* Is user in buyzone? Returns 1 when true, 0 when false. - */ -native cs_get_user_buyzone(index); - -/* Returns 1 when user has a primary weapon OR a shield in inventory, else 0. - */ -native cs_get_user_hasprim(index); - -/* Get user model. - */ -native cs_get_user_model(index, model[], len); - -/* Set user model. - */ -native cs_set_user_model(index, const model[]); - -/* Use to reset model to standard selected model. - */ -native cs_reset_user_model(index); - -/* Returns users money. - */ -native cs_get_user_money(index); - -/* Gives money to user. If flash is 1, the difference between new and old amount will flash red or green. - */ -native cs_set_user_money(index, money, flash = 1); - -/* Does user have night vision goggles? - */ -native cs_get_user_nvg(index); - -/* Set nvgoggles to 1 to give night vision goggles to index. Set it to 0 to remove them. - */ -native cs_set_user_nvg(index, nvgoggles = 1); - -/* Returns 1 if user has the "skill" to plant bomb, else 0. Normally this would only be true for a terrorist carrying a bomb. - */ -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. - * 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). - */ -native cs_set_user_plant(index, plant = 1, showbombicon = 1); - -/* Set user team without killing player. - * If model is anything other than CS_DONTCHANGE, that will be set as player's model. - */ -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, - CS_CT_VIP = 9, - CZ_T_MILITIA = 10, - CZ_CT_SPETSNAZ = 11 +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, + CS_CT_VIP = 9, + CZ_T_MILITIA = 10, + CZ_CT_SPETSNAZ = 11, }; -native cs_set_user_team(index, {CsTeams,_}:team, {CsInternalModel,_}:model = CS_DONTCHANGE); -/* Get team directly from player's entity. - * 1 = terrorist - * 2 = counter-terrorist - * 3 = spectator +/** + * Counter-Strike team id constants. */ -enum CsTeams { - CS_TEAM_UNASSIGNED = 0, - CS_TEAM_T = 1, - CS_TEAM_CT = 2, - CS_TEAM_SPECTATOR = 3 +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); -/* Is user vip? Returns 1 if true, 0 if false. +/** + * @endsection */ -native cs_get_user_vip(index); -/* If vip = 1, user is set to vip. - * 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. - * 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. +/** + * Counter-Strike armor types for use with cs_[get|set]_user_armor(). */ - native cs_set_user_vip(index, vip = 1, model = 1, scoreboard = 1); - -/* 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); - -/* Returns different values depending on if user is driving a vehicle - and if so at what speed. - * 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); - -/* Returns 1 if user has a shield, else 0. - */ -native cs_get_user_shield(index); - -/* Returns 1 if user is using a stationary gun, else 0. - */ -native cs_get_user_stationary(index); - -/* Returns armor value and sets by reference the armor type in second parameter. - */ -enum CsArmorType { - CS_ARMOR_NONE = 0, // no armor - CS_ARMOR_KEVLAR = 1, // armor - CS_ARMOR_VESTHELM = 2 // armor and helmet +enum CsArmorType +{ + CS_ARMOR_NONE = 0, // no armor + CS_ARMOR_KEVLAR = 1, // body vest only + CS_ARMOR_VESTHELM = 2, // vest and helmet }; -native cs_get_user_armor(index, &CsArmorType:armortype); -/* 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. +/** + * Map zone flags returned by cs_get_user_mapzones(). */ -native cs_set_user_armor(index, armorvalue, CsArmorType:armortype); +#define CS_MAPZONE_BUY (1<<0) // Buyzone +#define CS_MAPZONE_BOMBTARGET (1<<1) // Bomb target zone +#define CS_MAPZONE_HOSTAGE_RESCUE (1<<2) // Hostage rescue zone +#define CS_MAPZONE_ESCAPE (1<<3) // Terrorist escape zone +#define CS_MAPZONE_VIP_SAFETY (1<<4) // VIP escape zone -/* Returns 1 if specified weapon is in burst mode. - */ -native cs_get_weapon_burst(index); - -/* If burstmode = 1, weapon will be changed to burst mode, 0 and non-burst mode (semiautomatic/automatic) will be activated. - * Only GLOCK and FAMAS can enter/leave burst mode. - */ -native cs_set_weapon_burst(index, burstmode = 1); - -/* Returns 1 if weapon is silenced, else 0. - */ -native cs_get_weapon_silen(index); - -/* If silence = 1, weapon will be silenced, 0 and silencer will be removed. Only USP and M4A1 can be silenced. - */ -native cs_set_weapon_silen(index, silence = 1, draw_animation = 1); - -/* Returns amount of ammo in weapon's clip. - */ -native cs_get_weapon_ammo(index); - -/* Set amount of ammo in weapon's clip. - */ -native cs_set_weapon_ammo(index, newammo); - -/* Get weapon type. Corresponds to CSW_* in amxconst.inc: 1 is CSW_P228, 2 is CSW_SCOUT and so on... - */ -native cs_get_weapon_id(index); - -/* 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); - -/* 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 - */ -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); - -/* Zoom type enum. Used for get/set_user_zoom() natives. +/** + * Constants used for cs_[get|set]_user_zoom(). */ 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 + CS_RESET_ZOOM = 0, // Reset any zoom blocking (mode has no effect) + CS_SET_NO_ZOOM, // Disable any sort of zoom + CS_SET_FIRST_ZOOM, // Set first zoom level (AWP style) + CS_SET_SECOND_ZOOM, // Set second zoom level (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. + +/** + * Constants used for the CS_OnBuy() and CS_OnBuyAttempt() forwards. + * + * @note While these mostly overlap with the CSW_* constants the CSI_* constants + * contain custom AMXX values that do not correspond to any real value in + * the game. The CSI_* constants should therefore be used for consistency. + */ +#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 +#define CSI_GALIL CSW_GALIL +#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 +#define CSI_PRIAMMO 36 // Custom +#define CSI_SECAMMO 37 // Custom + +/** + * 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. + */ +native cs_get_user_deaths(index); + +/** + * Sets client's deaths. + * + * @param index Client index + * @param newdeaths New value to set + * + * @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. + */ +native cs_set_user_deaths(index, newdeaths); + +/** + * 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. + * @note This native does not work on Condition Zero, which has a different + * hostage AI than other versions of Counter-Strike. + * + * @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. + */ +native cs_get_hostage_foll(index); + +/** + * 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. + * @note This native does not work on Condition Zero, which has a different + * hostage AI than other versions of Counter-Strike. + * + * @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. + */ +native cs_set_hostage_foll(index, followedindex = 0); + +/** + * 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. + */ +native cs_get_hostage_id(index); + +/** + * 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. + */ +native cs_get_user_bpammo(index, weapon); + +/** + * 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: + * awp - ammo_338magnum + * scout, ak47, g3sg1 - ammo_762nato + * m249 - ammo_556natobox + * famas, m4a1, aug, sg550, galil, sg552 - ammo_556nato + * m3, xm1014 - ammo_buckshot + * usp, ump45, mac10 - ammo_45acp + * fiveseven, p90 - ammo_57mm + * deagle - ammo_50ae + * p228 - ammo_357sig + * glock, mp5, tmp, elites - ammo_9mm + * hegrenade - / + * flashbang - / + * smokegrenade - / + * + * @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. + */ +native cs_set_user_bpammo(index, weapon, amount); + +/** + * 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. + */ +native cs_get_user_defuse(index); + +/** + * 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. + */ +native cs_set_user_defuse(index, defusekit = 1, r = 0, g = 160, b = 0, icon[] = "defuser", flash = 0); + +/** + * 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. + */ +native cs_get_user_buyzone(index); + +/** + * 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. + */ +native cs_get_user_hasprim(index); + +/** + * 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. + */ +native cs_get_user_model(index, model[], len); + +/** + * 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. + * + * @param index Client index + * @param model Model name + * + * @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. + */ +native cs_set_user_model(index, const model[]); + +/** + * 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. + */ +native cs_reset_user_model(index); + +/** + * 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. + */ +native cs_get_user_money(index); + +/** + * 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. + */ +native cs_set_user_money(index, money, flash = 1); + +/** + * 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. + */ +native cs_get_user_nvg(index); + +/** + * 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. + */ +native cs_set_user_nvg(index, nvgoggles = 1); + +/** + * 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. + */ +native cs_get_user_plant(index); + +/** + * 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. + */ +native cs_set_user_plant(index, plant = 1, showbombicon = 1); + +/** + * 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. + * + * @param index Client index + * @param team Team id + * @param model Internal model id, if CS_DONTCHANGE the game will choose the + * model + * + * @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. + */ +native cs_set_user_team(index, {CsTeams,_}:team, {CsInternalModel,_}:model = CS_DONTCHANGE); + +/** + * 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. + */ +native CsTeams:cs_get_user_team(index, &{CsInternalModel,_}:model = CS_DONTCHANGE); + +/** + * 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. + */ +native cs_get_user_vip(index); + +/** + * 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. + */ +native cs_set_user_vip(index, vip = 1, model = 1, scoreboard = 1); + +/** + * 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. + */ +native cs_get_user_tked(index); + +/** + * 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. + */ +native cs_set_user_tked(index, tk = 1, subtract = 1); + +/** + * 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 + * driving at a negative speed (backing) + * @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_driving(index); + +/** + * 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. + */ +native cs_get_user_shield(index); + +/** + * 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. + */ +native cs_get_user_stationary(index); + +/** + * 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. + */ +native cs_get_user_armor(index, &CsArmorType:armortype); + +/** + * 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. + */ +native cs_set_user_armor(index, armorvalue, CsArmorType:armortype); + +/** + * 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. + * @note This native does not check that the provided entity is actually a + * weapon entity. It will return incorrect values for non-weapon entities. + * + * @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. + */ +native cs_get_weapon_burst(index); + +/** + * 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. + * @note This native does not check that the provided entity is actually a + * weapon entity. It will result in undefined behavior if used on + * non-weapon entities. + * + * @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. + */ +native cs_set_weapon_burst(index, burstmode = 1); + +/** + * 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. + * @note This native does not check that the provided entity is actually a + * weapon entity. It will return incorrect values for non-weapon entities. + * + * @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. + */ +native cs_get_weapon_silen(index); + +/** + * 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. + * @note This native does not check that the provided entity is actually a + * weapon entity. It will result in undefined behavior if used on + * non-weapon entities. + * + * @param index Weapon entity index + * @param silence If nonzero the weapon will be put into silenced + * mode, otherwise the silenced mode will be removed + * @param draw_animation If nonzero and the weapon is currently held by a + * client, the appropriate weapon animation will be + * played + * + * @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. + */ +native cs_set_weapon_silen(index, silence = 1, draw_animation = 1); + +/** + * Returns the amount of ammo in weapon's magazine. + * + * @note This native does not check that the provided entity is actually a + * weapon entity. It will return incorrect values for non-weapon entities. + * + * @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. + */ +native cs_get_weapon_ammo(index); + +/** + * Sets the amount of ammo in weapon's clip. + * + * @note This native does not check that the provided entity is actually a + * weapon entity. It will result in undefined behavior if used on + * non-weapon entities. + * + * @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. + */ +native cs_set_weapon_ammo(index, newammo); + +/** + * Returns the weapon id of an entity. + * + * @note For a list of possible weapon ids see the CSW_* constants in + * amxconst.inc + * @note This native does not check that the provided entity is actually a + * weapon entity. It will return incorrect values for non-weapon entities. + * + * @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. + */ +native cs_get_weapon_id(index); + +/** + * 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 + */ +native cs_get_no_knives(); + +/** + * 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 + */ +native cs_set_no_knives(noknives = 0); + +/** + * 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. + */ +native cs_user_spawn(player); + +/** + * 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 + * + * @return Weapon id + * @error If a non-armoury entity is provided, an error will be + * thrown. + */ +native cs_get_armoury_type(index); + +/** + * 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. + * + * @param index Armoury entity index + * @param type Weapon id + * + * @noreturn + * @error If a non-armoury entity is provided, an error will be + * thrown. + */ +native cs_set_armoury_type(index, type); + +/** + * 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. + */ +native cs_get_user_mapzones(index); + +/** + * 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. */ 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. +/** + * 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. */ native cs_get_user_zoom(index); -/* 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) +/** + * 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. */ 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. +/** + * 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 */ 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. +/** + * 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 */ native Float:cs_get_user_lastactivity(index); +/** + * 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 + */ native cs_set_user_lastactivity(index, Float:value); -/* Gets or sets the number of hostages that a user has killed. +/** + * 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 */ native cs_get_user_hostagekills(index); +/** + * 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 + * value when a hostage is actually killed, so setting this will not cause + * a client to be kicked until they actually kill a hostage. + * + * @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 + */ native cs_set_user_hostagekills(index, value); -/* Gets or sets the time that the hostage was last used. +/** + * 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. */ native Float:cs_get_hostage_lastuse(index); +/** + * 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. + */ native cs_set_hostage_lastuse(index, Float:value); -/* Gets or sets the time which the hostage can next be used. +/** + * 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. */ native Float:cs_get_hostage_nextuse(index); +/** + * 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. + */ native cs_set_hostage_nextuse(index, Float:value); -/* Gets or sets the time in which the C4 will explode. +/** + * Returns the time the bomb will explode. + * + * @param index C4 entity + * + * @return Explosion time + * @error If the provided entity index is not a bomb, an error will be + * thrown. */ native Float:cs_get_c4_explode_time(index); +/** + * Sets the time the bomb will explode. + * + * @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. + */ native cs_set_c4_explode_time(index, Float:value); -/* Gets or sets whether the C4 is being defused. +/** + * Returns if the bomb is being defused. + * + * @param index C4 entity + * + * @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. */ native bool:cs_get_c4_defusing(c4index); +/** + * Sets if the bomb is being defused. + * + * @param index C4 entity + * @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. + */ native cs_set_c4_defusing(c4index, bool:defusing); /** @@ -369,7 +1100,7 @@ native cs_set_c4_defusing(c4index, bool:defusing); * * @param classname Entity class name * - * @return Index of the created entity, 0 otherwise. + * @return Index of the created entity (> 0), 0 otherwise */ native cs_create_entity(const classname[]); @@ -393,74 +1124,46 @@ native cs_create_entity(const classname[]); native cs_find_ent_by_class(start_index, const classname[]); /** - * 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. + * Called when CS internally fires a command to a player. * - * @param id Client index. - * @param cmd Command string. - * @return PLUGIN_HANDLED to block, PLUGIN_CONTINUE for normal operation. + * @note This is most notably used by the rebuy/autobuy functionality, + * Condition Zero also uses this to pass commands to bots internally. + * + * @param id Client index + * @param cmd Command string + * + * @return PLUGIN_CONTINUE to let the command continue + * PLUGIN_HANDLED to block the command */ forward CS_InternalCommand(id, const cmd[]); - /** - * The following constants are used with CS_OnBuy[Attempt] forwards. - */ -#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 -#define CSI_GALIL CSW_GALIL -#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 -#define CSI_PRIAMMO 36 // Custom -#define CSI_SECAMMO 37 // Custom - -/** - * Called when a player attempts to purchase an item. - * 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. + * Called when a client attempts to purchase an item. * - * @param index Player index. - * @param item Item index, see CSI_* constants. + * @note This is called immediately when the client issues a buy command. The + * game has not actually checked if the client can actually buy the + * weapon. + * @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 */ forward CS_OnBuyAttempt(index, item); /** - * Called when a player purchases an item. - * This usually called right before a player gets the purchased item. + * Called when a client purchases an item. * - * @note Return PLUGIN_CONTINUE to allow the purchase or return a higher action to deny. + * @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. * - * @param index Player index. - * @param item Item index, see CSI_* constants. + * @param index Client index + * @param item Item id + * + * @return PLUGIN_CONTINUE to let the buy continue + * PLUGIN_HANDLED to block the buy */ forward CS_OnBuy(index, item); diff --git a/plugins/include/csx.inc b/plugins/include/csx.inc index 3616d178..70d90883 100755 --- a/plugins/include/csx.inc +++ b/plugins/include/csx.inc @@ -27,65 +27,237 @@ #pragma library csx #endif -/* - * Forwards +/** + * Map objective flags returned by get_map_objectives(). */ - -/* Function is called after player to player attacks , -* if players were damaged by teammate TA is set to 1 */ -forward client_damage(attacker,victim,damage,wpnindex,hitplace,TA); - -/* Function is called after player death , -* if player was killed by teammate TK is set to 1 */ -forward client_death(killer,victim,wpnindex,hitplace,TK); - -forward grenade_throw( index,greindex,wId ); - -forward bomb_planting(planter); -forward bomb_planted(planter); -forward bomb_explode(planter,defuser); -forward bomb_defusing(defuser); -forward bomb_defused(defuser); - -/************* Shared Natives Start ********************************/ - -/* Custom Weapon Support */ -/* function will return index of new weapon */ -native custom_weapon_add( const wpnname[],melee = 0,const logname[]="" ); -/* Function will pass damage done by this custom weapon to stats module and other plugins */ -native custom_weapon_dmg( weapon, att, vic, damage, hitplace=0 ); -/* Function will pass info about custom weapon shot to stats module */ -native custom_weapon_shot( weapon,index ); // weapon id , player id - -/* function will return 1 if true */ -native xmod_is_melee_wpn(wpnindex); - -/* Returns weapon name. */ -native xmod_get_wpnname(wpnindex,name[],len); - -/* Returns weapon logname. */ -native xmod_get_wpnlogname(wpnindex,name[],len); - -/* Returns weapons array size */ -native xmod_get_maxweapons(); - -/* Returns stats array size */ -native xmod_get_stats_size(); - -/************* Shared Natives End ********************************/ - enum MapObjective { - MapObjective_Bomb = (1<<0), - MapObjective_Hostage = (1<<1), - MapObjective_Vip = (1<<2), - MapObjective_Escape = (1<<3), + MapObjective_Bomb = (1<<0), + MapObjective_Hostage = (1<<1), + MapObjective_Vip = (1<<2), + MapObjective_Escape = (1<<3), }; /** - * Gets current map objectives. + * Called after a client attacks another client. * - * @return Returns a bits sum if objectives are found, otherwise 0. - * See MapObjective_* constants. + * @note For a list of possible weapon ids see the CSW_* constants in + * amxconst.inc + * @note For a list of possible body hitplaces see the HIT_* constants in + * amxconst.inc + * + * @param attacker Attacker client index + * @param victim Victim client index + * @param damage Damage dealt to victim + * @param wpnindex Weapon id + * @param hitplace Body hitplace + * @param ta If nonzero the attack was a team attack + * + * @noreturn + */ +forward client_damage(attacker, victim, damage, wpnindex, hitplace, TA); + +/** + * Called after a client death. + * + * @note For a list of possible weapon ids see the CSW_* constants in + * amxconst.inc + * @note For a list of possible body hitplaces see the HIT_* constants in + * amxconst.inc + * + * @param attacker Attacker client index + * @param victim Victim client index + * @param wpnindex Weapon id + * @param hitplace Body hitplace + * @param tk If nonzero the death was a teamkill + * + * @noreturn + */ +forward client_death(killer, victim, wpnindex, hitplace, TK); + +/** + * Called after a grenade was thrown. + * + * @note Weapon id is one of CSW_HEGRENADE, CSW_SMOKEGRENADE or CSW_FLASHBANG. + * + * @param index Client index + * @param greindex Grenade entity index + * @param wId Weapon id + * + * @noreturn + */ +forward grenade_throw(index, greindex, wId); + +/** + * Called after a bomb plant attempt has started. + * + * @param planter Planter client index + * + * @noreturn + */ +forward bomb_planting(planter); + +/** + * Called after a bomb plant has finished. + * + * @param planter Planter client index + * + * @noreturn + */ +forward bomb_planted(planter); + +/** + * Called when the bomb exploded. + * + * @param planter Planter client index + * @param defuser Defuser client index, if applicable + * + * @noreturn + */ +forward bomb_explode(planter, defuser); + +/** + * Called after a bomb defuse attempt has started. + * + * @param defuser Defuser client index + * + * @noreturn + */ +forward bomb_defusing(defuser); + +/** + * Called after a bomb defuse has finished. + * + * @param defuser Defuser client index + * + * @noreturn + */ +forward bomb_defused(defuser); + +/** + * @section Shared natives + */ + +/** + * Adds a custom weapon to the stats system. + * + * @note The weapon name should be the full display name of the gun such as + * "Desert Eagle" while the logname should be "weapon_deagle". + * + * @param wpnname Full weapon name + * @param melee If nonzero the weapon will be considered a melee weapon + * @param logname Weapon short name + * + * @return Cusom weapon id (>0) on success, 0 if no more custom weapons + * can be added + */ +native custom_weapon_add(const wpnname[], melee = 0, const logname[] = ""); + +/** + * Trigger a damage event on a custom weapon, adding it to the internal stats. + * + * @note This will also call the client_damage() and client_kill() forwards if + * applicable. + * @note For a list of possible body hitplaces see the HIT_* constants in + * amxconst.inc + * + * @param weapon Custom weapon id + * @param att Attacker client index + * @param vic Victim client index + * @param damage Damage dealt + * @param hitplace Optional body hitplace + * + * @noreturn + * @error If the weapon id is not a custom weapon, an invalid client + * index, damage value or hitplace is provided, an error will + * be thrown. + */ +native custom_weapon_dmg(weapon, att, vic, damage, hitplace = 0); + +/** + * Add a shot event on a custom weapon to the internal stats. + * + * @param weapon Custom weapon id + * @param index Client index + * + * @noreturn + * @error If the weapon id is not a custom weapon or an invalid client + * index is provided, an error will be thrown. + */ +native custom_weapon_shot(weapon, index); // weapon id , player id + +/** + * Returns if the weapon is considered a melee weapon. + * + * @note For a list of default CS weapon ids see the CSW_* constants in + * amxconst.inc, this function also works on custom weapons. + * @note For the default CS weapons this obviously returns true only for + * CSW_KNIFE. + * + * @param wpnindex Weapon id + * + * @return 1 if weapon is a melee weapon, 0 + * @error If an invalid weapon id is provided an error will be thrown. + */ +native xmod_is_melee_wpn(wpnindex); + +/** + * Retrieves the full weapon name of a weapon id. + * + * @note For a list of default CS weapon ids see the CSW_* constants in + * amxconst.inc, this function also works on custom weapons. + * @note For the default CS weapons this obviously returns true only for + * CSW_KNIFE. + * + * @param wpnindex Weapon id + * @param name Buffer to copy weapon name to + * @param len Maximmum buffer size + * + * @return Number of cells written to buffer + * @error If an invalid weapon id is provided an error will be thrown. + */ +native xmod_get_wpnname(wpnindex, name[], len); + +/** + * Retrieves the weapon log name of a weapon id. + * + * @note For a list of default CS weapon ids see the CSW_* constants in + * amxconst.inc, this function also works on custom weapons. + * @note For the default CS weapons this obviously returns true only for + * CSW_KNIFE. + * + * @param wpnindex Weapon id + * @param name Buffer to copy weapon log name to + * @param len Maximmum buffer size + * + * @return Number of cells written to buffer + * @error If an invalid weapon id is provided an error will be thrown. + */ +native xmod_get_wpnlogname(wpnindex, name[], len); + +/** + * Returns the maximum amount of weapons that the stats system supports. + * + * @return Maximum number of weapons supported + */ +native xmod_get_maxweapons(); + +/** + * Returns the number of stats tracked by the stats system. + * + * @return Number of stats tracked + */ +native xmod_get_stats_size(); + +/** + * @endsection Shared natives + */ + +/** + * Returns the current map's objectives as a bitflag value. + * + * @note For a list of possible map objective flags see the MapObjective enum. + * + * @return Bitflag value of map objectives */ native MapObjective:get_map_objectives();