Fixed CS_GetWeaponPrice for some weapon (bug 4994, r=psychonic).
This commit is contained in:
parent
a65239a8af
commit
6046b8fb79
@ -44,6 +44,13 @@
|
||||
|
||||
int CallPriceForward(int client, const char *weapon_name, int price);
|
||||
|
||||
#define WEAPON_C4 6
|
||||
#define WEAPON_KNIFE 28
|
||||
#define WEAPON_SHIELD 30
|
||||
#define WEAPON_KEVLAR 31
|
||||
#define WEAPON_ASSAULTSUIT 32
|
||||
#define WEAPON_NIGHTVISION 33
|
||||
|
||||
/**
|
||||
* @brief Sample implementation of the SDK Extension.
|
||||
* Note: Uncomment one of the pre-defined virtual functions in order to use it.
|
||||
|
@ -327,6 +327,16 @@ static cell_t CS_GetTranslatedWeaponAlias(IPluginContext *pContext, const cell_t
|
||||
}
|
||||
static cell_t CS_GetWeaponPrice(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
//Hard code return values for weapons that dont call GetWeaponPrice and always use default value.
|
||||
if (params[2] == WEAPON_C4 || params[2] == WEAPON_KNIFE || params[2] == WEAPON_SHIELD)
|
||||
return 0;
|
||||
if (params[2] == WEAPON_KEVLAR)
|
||||
return 650;
|
||||
if (params[2] == WEAPON_ASSAULTSUIT)
|
||||
return 1000;
|
||||
if (params[2] == WEAPON_NIGHTVISION)
|
||||
return 1250;
|
||||
|
||||
static ICallWrapper *pWrapper = NULL;
|
||||
static int priceOffset = -1;
|
||||
if (!pWrapper)
|
||||
|
@ -212,9 +212,9 @@ native CS_DropWeapon(client, weaponIndex, bool:toss, bool:blockhook = false);
|
||||
* @return Returns price of the weapon (even if modified)
|
||||
*
|
||||
* @error Invalid client, failing to get weapon info, or failing to get price offset.
|
||||
* @note Not all "weapons" will return their default price. Example: c4, knife, vest, vest helmet, night vision.
|
||||
* @note c4, knife and shield will always return 0. vest, vest helmet and night vision will always return default price.
|
||||
*/
|
||||
native CS_GetWeaponPrice(client, CSWeaponID:id, bool:defaultprice=false);
|
||||
native CS_GetWeaponPrice(client, CSWeaponID:id, bool:defaultprice = false);
|
||||
|
||||
/**
|
||||
* Do not edit below this line!
|
||||
|
Loading…
Reference in New Issue
Block a user