faluco@1441: /** faluco@1441: * vim: set ts=4 : faluco@1441: * ============================================================================= ds@1947: * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved. faluco@1441: * ============================================================================= faluco@1441: * faluco@1441: * This file is part of the SourceMod/SourcePawn SDK. faluco@1441: * faluco@1441: * This program is free software; you can redistribute it and/or modify it under faluco@1441: * the terms of the GNU General Public License, version 3.0, as published by the faluco@1441: * Free Software Foundation. faluco@1441: * faluco@1441: * This program is distributed in the hope that it will be useful, but WITHOUT faluco@1441: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS faluco@1441: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more faluco@1441: * details. faluco@1441: * faluco@1441: * You should have received a copy of the GNU General Public License along with faluco@1441: * this program. If not, see . faluco@1441: * faluco@1441: * As a special exception, AlliedModders LLC gives you permission to link the faluco@1441: * code of this program (as well as its derivative works) to "Half-Life 2," the faluco@1441: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software faluco@1441: * by the Valve Corporation. You must obey the GNU General Public License in faluco@1441: * all respects for all other code used. Additionally, AlliedModders LLC grants faluco@1441: * this exception to all derivative works. AlliedModders LLC defines further faluco@1441: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), faluco@1441: * or . faluco@1441: * faluco@1441: * Version: $Id$ faluco@1441: */ faluco@1441: faluco@1441: #if defined _cstrike_included faluco@1441: #endinput faluco@1441: #endif faluco@1441: #define _cstrike_included faluco@1441: faluco@1441: #define CS_TEAM_NONE 0 /**< No team yet. */ faluco@1441: #define CS_TEAM_SPECTATOR 1 /**< Spectators. */ dvander@1459: #define CS_TEAM_T 2 /**< Terrorists. */ dvander@1459: #define CS_TEAM_CT 3 /**< Counter-Terrorists. */ dvander@1459: dvander@1459: #define CS_SLOT_PRIMARY 0 /**< Primary weapon slot. */ dvander@1459: #define CS_SLOT_SECONDARY 1 /**< Secondary weapon slot. */ dvander@1459: #define CS_SLOT_GRENADE 3 /**< Grenade slot (will only return one grenade). */ dvander@1459: #define CS_SLOT_C4 4 /**< C4 slot. */ faluco@1441: rgr_02@3313: enum CSRoundEndReason rgr_02@3313: { rgr_02@3313: CSRoundEnd_TargetBombed = 0, // Target Successfully Bombed! rgr_02@3313: CSRoundEnd_VIPEscaped, // The VIP has escaped! rgr_02@3313: CSRoundEnd_VIPKilled, // VIP has been assassinated! rgr_02@3313: CSRoundEnd_TerroristsEscaped, // The terrorists have escaped! rgr_02@3313: CSRoundEnd_CTStoppedEscape, // The CTs have prevented most of the terrorists from escaping! rgr_02@3313: CSRoundEnd_TerroristsStopped, // Escaping terrorists have all been neutralized! rgr_02@3313: CSRoundEnd_BombDefused, // The bomb has been defused! rgr_02@3313: CSRoundEnd_CTWin, // Counter-Terrorists Win! rgr_02@3313: CSRoundEnd_TerroristWin, // Terrorists Win! rgr_02@3313: CSRoundEnd_Draw, // Round Draw! rgr_02@3313: CSRoundEnd_HostagesRescued, // All Hostages have been rescued! rgr_02@3313: CSRoundEnd_TargetSaved, // Target has been saved! rgr_02@3313: CSRoundEnd_HostagesNotRescued, // Hostages have not been rescued! rgr_02@3313: CSRoundEnd_TerroristsNotEscaped, // Terrorists have not escaped! rgr_02@3313: CSRoundEnd_VIPNotEscaped, // VIP has not escaped! rgr_02@3535: CSRoundEnd_GameStart, // Game Commencing! rgr_02@3528: rgr_02@3528: // The below only exist on CS:GO rgr_02@3528: CSRoundEnd_TerroristsSurrender, // Terrorists Surrender rgr_02@3528: CSRoundEnd_CTSurrender, // CTs Surrender rgr_02@3313: }; rgr_02@3313: rgr_02@3324: enum CSWeaponID rgr_02@3324: { rgr_02@3519: CSWeapon_NONE = 0, rgr_02@3519: CSWeapon_P228, rgr_02@3519: CSWeapon_GLOCK, rgr_02@3519: CSWeapon_SCOUT, rgr_02@3519: CSWeapon_HEGRENADE, rgr_02@3519: CSWeapon_XM1014, rgr_02@3519: CSWeapon_C4, rgr_02@3519: CSWeapon_MAC10, rgr_02@3519: CSWeapon_AUG, rgr_02@3519: CSWeapon_SMOKEGRENADE, rgr_02@3519: CSWeapon_ELITE, rgr_02@3519: CSWeapon_FIVESEVEN, rgr_02@3519: CSWeapon_UMP45, rgr_02@3519: CSWeapon_SG550, rgr_02@3519: CSWeapon_GALIL, rgr_02@3519: CSWeapon_FAMAS, rgr_02@3519: CSWeapon_USP, rgr_02@3519: CSWeapon_AWP, rgr_02@3519: CSWeapon_MP5NAVY, rgr_02@3519: CSWeapon_M249, rgr_02@3519: CSWeapon_M3, rgr_02@3519: CSWeapon_M4A1, rgr_02@3519: CSWeapon_TMP, rgr_02@3519: CSWeapon_G3SG1, rgr_02@3519: CSWeapon_FLASHBANG, rgr_02@3519: CSWeapon_DEAGLE, rgr_02@3519: CSWeapon_SG552, rgr_02@3519: CSWeapon_AK47, rgr_02@3519: CSWeapon_KNIFE, rgr_02@3519: CSWeapon_P90, rgr_02@3519: CSWeapon_SHIELD, rgr_02@3519: CSWeapon_KEVLAR, rgr_02@3519: CSWeapon_ASSAULTSUIT, rgr_02@3519: CSWeapon_NIGHTVISION, rgr_02@3519: CSWeapon_GALILAR, rgr_02@3519: CSWeapon_BIZON, rgr_02@3519: CSWeapon_MAG7, rgr_02@3519: CSWeapon_NEGEV, rgr_02@3519: CSWeapon_SAWEDOFF, rgr_02@3519: CSWeapon_TEC9, rgr_02@3519: CSWeapon_TASER, rgr_02@3519: CSWeapon_HKP2000, rgr_02@3519: CSWeapon_MP7, rgr_02@3519: CSWeapon_MP9, rgr_02@3519: CSWeapon_NOVA, rgr_02@3519: CSWeapon_P250, rgr_02@3519: CSWeapon_SCAR17, rgr_02@3519: CSWeapon_SCAR20, rgr_02@3519: CSWeapon_SG556, rgr_02@3519: CSWeapon_SSG08, rgr_02@3519: CSWeapon_KNIFE_GG, rgr_02@3519: CSWeapon_MOLOTOV, rgr_02@3519: CSWeapon_DECOY, rgr_02@3519: CSWeapon_INCGRENADE, rgr_02@3519: CSWeapon_DEFUSER rgr_02@3324: }; rgr_02@3519: rgr_02@3313: /** rgr_02@3313: * Called when a player attempts to purchase an item. rgr_02@3313: * Return Plugin_Continue to allow the purchase or return a rgr_02@3313: * higher action to deny. rgr_02@3313: * rgr_02@3313: * @param client Client index rgr_02@3313: * @param weapon User input for weapon name rgr_02@3313: */ rgr_02@3313: forward Action:CS_OnBuyCommand(client, const String:weapon[]); rgr_02@3313: rgr_02@3313: /** rgr_02@3313: * Called when CSWeaponDrop is called rgr_02@3313: * Return Plugin_Continue to allow the call or return a rgr_02@3313: * higher action to deny. rgr_02@3313: * rgr_02@3313: * @param client Client index rgr_02@3313: * @param weapon Weapon index rgr_02@3313: */ rgr_02@3313: forward Action:CS_OnCSWeaponDrop(client, weaponIndex); rgr_02@3313: rgr_02@3313: /** rgr_02@3313: * Called when game retrieves a weapon's price for a player. rgr_02@3313: * Return Plugin_Continue to use default value or return a higher rgr_02@3313: * action to use a newly-set price. rgr_02@3313: * rgr_02@3313: * @note This can be called multiple times per weapon purchase rgr_02@3313: * rgr_02@3313: * @param client Client index rgr_02@3313: * @param weapon Weapon classname rgr_02@3313: * @param price Buffer param for the price of the weapon rgr_02@3322: * rgr_02@3322: * @note Not all "weapons" call GetWeaponPrice. Example: c4, knife, vest, vest helmet, night vision. rgr_02@3313: */ rgr_02@3313: forward Action:CS_OnGetWeaponPrice(client, const String:weapon[], &price); rgr_02@3313: rgr_02@3313: /** rgr_02@3313: * Called when TerminateRound is called. rgr_02@3313: * Return Plugin_Continue to ignore, return Plugin_Changed to continue, rgr_02@3313: * using the given delay and reason, or return Plugin_Handled or a higher rgr_02@3313: * action to block TerminateRound from firing. rgr_02@3313: * rgr_02@3313: * @param delay Time (in seconds) until new round starts rgr_02@3313: * @param reason Reason for round end rgr_02@3313: */ rgr_02@3313: forward Action:CS_OnTerminateRound(&Float:delay, &CSRoundEndReason:reason); rgr_02@3313: faluco@1441: /** faluco@1441: * Respawns a player. faluco@1441: * faluco@1441: * @param client Player's index. faluco@1441: * @noreturn faluco@1441: * @error Invalid client index, client not in game. faluco@1441: */ faluco@1441: native CS_RespawnPlayer(client); faluco@1441: faluco@1441: /** faluco@1441: * Switches the player's team. faluco@1441: * faluco@1441: * @param client Player's index. faluco@1441: * @param team Team index. faluco@1441: * @noreturn faluco@1441: * @error Invalid client index, client not in game. faluco@1441: */ faluco@1441: native CS_SwitchTeam(client, team); faluco@1441: faluco@1441: /** rgr_02@3313: * Forces a player to drop or toss their weapon rgr_02@3313: * rgr_02@3313: * @param client Player's index. rgr_02@3313: * @param weaponIndex Index of weapon to drop. rgr_02@3313: * @param toss True to toss weapon (with velocity) or false to just drop weapon rgr_02@3313: * @param blockhook Set to true to stop the corresponding CS_OnCSWeaponDrop rgr_02@3313: * rgr_02@3313: * @noreturn rgr_02@3313: * @error Invalid client index, client not in game, or invalid weapon index. rgr_02@3313: */ rgr_02@3313: native CS_DropWeapon(client, weaponIndex, bool:toss, bool:blockhook = false); rgr_02@3313: rgr_02@3313: /** rgr_02@3313: * Forces round to end with a reason rgr_02@3313: * rgr_02@3313: * @param delay Time (in seconds) to delay before new round starts rgr_02@3313: * @param reason Reason for the round ending rgr_02@3313: * @param blockhook Set to true to stop the corresponding CS_OnTerminateRound rgr_02@3313: * forward from being called. rgr_02@3313: * @noreturn rgr_02@3313: */ skamonkey@3437: native CS_TerminateRound(Float:delay, CSRoundEndReason:reason, bool:blockhook = false); rgr_02@3313: skamonkey@3405: /** rgr_02@3313: * Gets a weapon name from a weapon alias rgr_02@3313: * rgr_02@3313: * @param alias Weapons alias to get weapon name for. rgr_02@3313: * @param weapon Buffer to store weapons name rgr_02@3313: * @param size Size of buffer to store the weapons name. rgr_02@3313: * @noreturn rgr_02@3313: * rgr_02@3313: * @note Will set the buffer to the original alias if it is not an alias to a weapon. rgr_02@3313: */ skamonkey@3437: native CS_GetTranslatedWeaponAlias(const String:alias[], String:weapon[], size); rgr_02@3313: skamonkey@3405: /** rgr_02@3324: * Gets a weapon's price rgr_02@3324: * rgr_02@3324: * @param client Client to check weapon price for. rgr_02@3324: * @param id Weapon id for the weapon to check rgr_02@3324: * @param defaultprice Set to true to get defaultprice. rgr_02@3324: * @return Returns price of the weapon (even if modified) rgr_02@3324: * rgr_02@3324: * @error Invalid client, failing to get weapon info, or failing to get price offset. rgr_02@3359: * @note c4, knife and shield will always return 0. vest, vest helmet and night vision will always return default price. rgr_02@3324: */ skamonkey@3437: native CS_GetWeaponPrice(client, CSWeaponID:id, bool:defaultprice = false); rgr_02@3324: rgr_02@3313: /** skamonkey@3405: * Gets a clients clan tag skamonkey@3405: * @param client Client index to get clan tag for. skamonkey@3405: * @param buffer Buffer to store clients clan tag in. skamonkey@3405: * @param size Size of the buffer. skamonkey@3405: * @return Number of non-null bytes written. skamonkey@3405: * skamonkey@3405: * @error Invalid client. skamonkey@3405: */ skamonkey@3437: native CS_GetClientClanTag(client, String:buffer[], size); skamonkey@3405: skamonkey@3405: /** skamonkey@3405: * Sets a clients clan tag skamonkey@3405: * @param client Client index to set clan tag for. skamonkey@3405: * @param tag Tag to set clients clan tag as. skamonkey@3405: * @noreturn skamonkey@3405: * skamonkey@3405: * @error Invalid client. skamonkey@3405: */ skamonkey@3437: native CS_SetClientClanTag(client, const String:tag[]); rgr_02@3530: rgr_02@3530: /** rgr_02@3530: * Gets a team's score rgr_02@3530: * @param team Team index to get score for. rgr_02@3530: * @return Returns the internal team score. rgr_02@3530: * rgr_02@3530: * @error Invalid team index. rgr_02@3530: */ rgr_02@3530: native CS_GetTeamScore(team); rgr_02@3530: rgr_02@3530: /** rgr_02@3530: * Sets a team's score rgr_02@3530: * @param team Team index to set score for. rgr_02@3530: * @param value Value to set teams score as. rgr_02@3530: * @noreturn rgr_02@3530: * rgr_02@3530: * @error Invalid team index. rgr_02@3530: * @note This will update the scoreboard only after the scoreboard update function is called. Use SetTeamScore plus this to update the scoreboard instantly and save values correctly. rgr_02@3530: */ rgr_02@3530: native CS_SetTeamScore(team, value); rgr_02@3530: rgr_02@3530: /** rgr_02@3530: * Gets a client's mvp count skamonkey@3706: * @param client Client index to get mvp count of. skamonkey@3706: * @return Returns the client's internal MVP count. rgr_02@3530: * rgr_02@3530: * @error Invalid client. rgr_02@3530: */ rgr_02@3530: native CS_GetMVPCount(client); rgr_02@3530: rgr_02@3530: /** rgr_02@3530: * Sets a client's mvp count rgr_02@3530: * @param client Client index to set mvp count for. skamonkey@3706: * @param value Value to set client's mvp count as. rgr_02@3530: * @noreturn rgr_02@3530: * rgr_02@3530: * @error Invalid client. rgr_02@3530: */ rgr_02@3530: native CS_SetMVPCount(client, value); rgr_02@3530: skamonkey@3405: /** skamonkey@3706: * Gets a client's contribution score (CS:GO only) skamonkey@3706: * @param client Client index to get score of. skamonkey@3706: * @return Returns the client's score. skamonkey@3706: * skamonkey@3706: * @error Invalid client. skamonkey@3706: */ skamonkey@3706: native CS_GetClientContributionScore(client); skamonkey@3706: skamonkey@3706: /** skamonkey@3706: * Sets a client's contribution score (CS:GO only) skamonkey@3706: * @param client Client index to set score for. skamonkey@3706: * @param value Value to set client's score as. skamonkey@3706: * @noreturn skamonkey@3706: * skamonkey@3706: * @error Invalid client. skamonkey@3706: */ skamonkey@3706: native CS_SetClientContributionScore(client, value); skamonkey@3706: skamonkey@3706: /** skamonkey@3706: * Gets a client's assists (CS:GO only) skamonkey@3706: * @param client Client index to get assists of. skamonkey@3706: * @return Returns the client's assists. skamonkey@3706: * skamonkey@3706: * @error Invalid client. skamonkey@3706: */ skamonkey@3706: native CS_GetClientAssists(client); skamonkey@3706: skamonkey@3706: /** skamonkey@3706: * Sets a client's assists (CS:GO only) skamonkey@3706: * @param client Client index to set assists for. skamonkey@3706: * @param value Value to set client's assists as. skamonkey@3706: * @noreturn skamonkey@3706: * skamonkey@3706: * @error Invalid client. skamonkey@3706: */ skamonkey@3706: native CS_SetClientAssists(client, value); skamonkey@3706: skamonkey@3706: /** rgr_02@3519: * Gets a weaponID from a alias rgr_02@3519: * @param alias Weapon alias to attempt to get an id for. rgr_02@3519: * @return Returns a weapon id or 0 if failed to find a match. rgr_02@3519: * rgr_02@3519: * @note For best results use CS_GetTranslatedWeaponAlias on the weapon name before passing it. rgr_02@3519: */ rgr_02@3529: native CSWeaponID:CS_AliasToWeaponID(const String:alias[]); rgr_02@3519: rgr_02@3519: /** kyle@3702: * Gets a alias from a weaponID kyle@3702: * @param weaponID WeaponID to get alias for. kyle@3702: * @param destination Destination string to hold the weapon alias. kyle@3702: * @param len Length of the destination array. kyle@3702: * @return Returns number of cells written. kyle@3702: */ drifter01620@3785: native CS_WeaponIDToAlias(CSWeaponID:weaponID, String:destination[], len); kyle@3702: kyle@3702: /** faluco@1441: * Do not edit below this line! faluco@1441: */ faluco@1441: public Extension:__ext_cstrike = faluco@1441: { dvander@1573: name = "cstrike", dvander@1459: file = "games/game.cstrike.ext", faluco@1441: autoload = 0, faluco@1441: #if defined REQUIRE_EXTENSIONS faluco@1441: required = 1, faluco@1441: #else faluco@1441: required = 0, faluco@1441: #endif dvander@1459: }; dvander@1573: dvander@1573: #if !defined REQUIRE_EXTENSIONS dvander@1573: public __ext_cstrike_SetNTVOptional() dvander@1573: { dvander@1573: MarkNativeAsOptional("CS_RespawnPlayer"); dvander@1573: MarkNativeAsOptional("CS_SwitchTeam"); rgr_02@3313: MarkNativeAsOptional("CS_DropWeapon"); rgr_02@3313: MarkNativeAsOptional("CS_TerminateRound"); rgr_02@3313: MarkNativeAsOptional("CS_GetTranslatedWeaponAlias"); rgr_02@3324: MarkNativeAsOptional("CS_GetWeaponPrice"); skamonkey@3405: MarkNativeAsOptional("CS_GetClientClanTag"); skamonkey@3405: MarkNativeAsOptional("CS_SetClientClanTag"); rgr_02@3530: MarkNativeAsOptional("CS_GetTeamScore"); rgr_02@3530: MarkNativeAsOptional("CS_SetTeamScore"); rgr_02@3530: MarkNativeAsOptional("CS_GetMVPCount"); rgr_02@3530: MarkNativeAsOptional("CS_SetMVPCount"); skamonkey@3706: MarkNativeAsOptional("CS_GetClientContributionScore"); skamonkey@3706: MarkNativeAsOptional("CS_SetClientContributionScore"); skamonkey@3706: MarkNativeAsOptional("CS_GetClientAssists"); skamonkey@3706: MarkNativeAsOptional("CS_SetClientAssists"); skamonkey@3539: MarkNativeAsOptional("CS_AliasToWeaponID"); dvander@1573: } dvander@1573: #endif rgr_02@3313: