Fixed incorrect return for some weapons in CS_GetWeaponPrice (bug 5562, r=psychonic).

This commit is contained in:
Drifter 2013-07-31 22:08:23 -04:00
parent fff8455903
commit 1a8be6344a

View File

@ -326,26 +326,29 @@ static cell_t CS_GetTranslatedWeaponAlias(IPluginContext *pContext, const cell_t
static cell_t CS_GetWeaponPrice(IPluginContext *pContext, const cell_t *params) 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] == (int)SMCSWeapon_NONE)
return pContext->ThrowNativeError("Invalid Weapon ID passed");
int id = GetRealWeaponID(params[2]); int id = GetRealWeaponID(params[2]);
//Hard code return values for weapons that dont call GetWeaponPrice and always use default value.
#if SOURCE_ENGINE == SE_CSGO #if SOURCE_ENGINE == SE_CSGO
if (id == WEAPON_C4 || id == WEAPON_KNIFE || id == WEAPON_KNIFE_GG) if (id == WEAPON_C4 || id == WEAPON_KNIFE || id == WEAPON_KNIFE_GG)
return 0;
#else #else
if (id == WEAPON_C4 || id == WEAPON_KNIFE || id == WEAPON_SHIELD) if (id == WEAPON_C4 || id == WEAPON_KNIFE || id == WEAPON_SHIELD)
#endif
return 0; return 0;
if (id == WEAPON_KEVLAR) else if (id == WEAPON_KEVLAR)
return 650; return 650;
if (id == WEAPON_ASSAULTSUIT) else if (id == WEAPON_ASSAULTSUIT)
return 1000; return 1000;
if (id == WEAPON_NIGHTVISION) #endif
else if (id == WEAPON_NIGHTVISION)
return 1250; return 1250;
#if SOURCE_ENGINE == SE_CSGO #if SOURCE_ENGINE == SE_CSGO
if (id == WEAPON_DEFUSER) else if (id == WEAPON_DEFUSER)
return 200; return 400;
#endif #endif
if (id == 0)
return 0;
if (g_iPriceOffset == -1) if (g_iPriceOffset == -1)
{ {