Fixed incorrect return for some weapons in CS_GetWeaponPrice (bug 5562, r=psychonic).
Fixed incorrect return for some weapons in CS_GetWeaponPrice (
bug 5562, r=psychonic).
1.1 --- a/extensions/cstrike/natives.cpp Wed Jul 31 22:03:59 2013 -0400
1.2 +++ b/extensions/cstrike/natives.cpp Wed Jul 31 22:08:23 2013 -0400
1.3 @@ -326,26 +326,29 @@
1.4
1.5 static cell_t CS_GetWeaponPrice(IPluginContext *pContext, const cell_t *params)
1.6 {
1.7 + if (params[2] == (int)SMCSWeapon_NONE)
1.8 + return pContext->ThrowNativeError("Invalid Weapon ID passed");
1.9 +
1.10 + int id = GetRealWeaponID(params[2]);
1.11 +
1.12 //Hard code return values for weapons that dont call GetWeaponPrice and always use default value.
1.13 - int id = GetRealWeaponID(params[2]);
1.14 #if SOURCE_ENGINE == SE_CSGO
1.15 if (id == WEAPON_C4 || id == WEAPON_KNIFE || id == WEAPON_KNIFE_GG)
1.16 + return 0;
1.17 #else
1.18 if (id == WEAPON_C4 || id == WEAPON_KNIFE || id == WEAPON_SHIELD)
1.19 -#endif
1.20 return 0;
1.21 - if (id == WEAPON_KEVLAR)
1.22 + else if (id == WEAPON_KEVLAR)
1.23 return 650;
1.24 - if (id == WEAPON_ASSAULTSUIT)
1.25 + else if (id == WEAPON_ASSAULTSUIT)
1.26 return 1000;
1.27 - if (id == WEAPON_NIGHTVISION)
1.28 +#endif
1.29 + else if (id == WEAPON_NIGHTVISION)
1.30 return 1250;
1.31 #if SOURCE_ENGINE == SE_CSGO
1.32 - if (id == WEAPON_DEFUSER)
1.33 - return 200;
1.34 + else if (id == WEAPON_DEFUSER)
1.35 + return 400;
1.36 #endif
1.37 - if (id == 0)
1.38 - return 0;
1.39
1.40 if (g_iPriceOffset == -1)
1.41 {