CSGO Support & No refill cvar.

This commit is contained in:
zaCade 2017-08-03 21:15:54 +02:00
parent 6478d995b9
commit 7d2a16e2f6
4 changed files with 76 additions and 14 deletions

View File

@ -77,6 +77,7 @@ enum CvarsList
Handle:CVAR_WEAPONS_RESTRICT_ENDEQUIP,
Handle:CVAR_WEAPONS_ZMARKET,
Handle:CVAR_WEAPONS_ZMARKET_BUYZONE,
Handle:CVAR_WEAPONS_ZMARKET_NOREFILL,
Handle:CVAR_WEAPONS_ZMARKET_REBUY,
Handle:CVAR_WEAPONS_ZMARKET_REBUY_AUTO,
Handle:CVAR_WEAPONS_ZMARKET_REBUY_PRIMARY,
@ -302,6 +303,7 @@ CvarsCreate()
// ZMarket
g_hCvarsList[CVAR_WEAPONS_ZMARKET] = CreateConVar("zr_weapons_zmarket", "1", "Allow player to buy from a list of weapons in the weapons config.");
g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE] = CreateConVar("zr_weapons_zmarket_buyzone", "1", "Requires player to be inside a buyzone to use ZMarket. [Dependency: zr_weapons_zmarket]");
g_hCvarsList[CVAR_WEAPONS_ZMARKET_NOREFILL] = CreateConVar("zr_weapons_zmarket_norefill", "1", "Dont allow users to rebuy weapons to refill their clip. [Dependency: zr_weapons_zmarket]");
g_hCvarsList[CVAR_WEAPONS_ZMARKET_REBUY] = CreateConVar("zr_weapons_zmarket_rebuy", "1", "Allow players to rebuy their previous weapons. [Dependency: zr_weapons_zmarket]");
g_hCvarsList[CVAR_WEAPONS_ZMARKET_REBUY_AUTO] = CreateConVar("zr_weapons_zmarket_rebuy_auto", "1", "Automatically equip default or loadout weapons. [Dependency: zr_weapons_zmarket&zr_weapons_zmarket_rebuy]");
g_hCvarsList[CVAR_WEAPONS_ZMARKET_REBUY_PRIMARY] = CreateConVar("zr_weapons_zmarket_rebuy_primary","P90", "Default primary weapon. [Dependency: zr_weapons_zmarket&zr_weapons_zmarket_rebuy]");

View File

@ -29,6 +29,7 @@
* @section Defines for min/max moaning sound file index.
*/
#define SOUND_MOAN_PATH "npc/zombie/zombie_voice_idle%d.wav" // %d is sound file index
#define SOUND_MOAN_CSGO "music/zr/zombie_voice_idle%d.wav"
#define SOUND_MOAN_MIN 1
#define SOUND_MOAN_MAX 14
/**
@ -39,6 +40,7 @@
* @section Defines for min/max groan sound file index.
*/
#define SOUND_GROAN_PATH "npc/zombie/zombie_pain%d.wav" // %d is sound file index
#define SOUND_GROAN_CSGO "music/zr/zombie_pain%d.wav"
#define SOUND_GROAN_MIN 1
#define SOUND_GROAN_MAX 6
/**
@ -49,6 +51,7 @@
* @section Defines for min/max death sound file index.
*/
#define SOUND_DEATH_PATH "npc/zombie/zombie_die%d.wav" // %d is sound file index
#define SOUND_DEATH_CSGO "music/zr/zombie_die%d.wav"
#define SOUND_DEATH_MIN 1
#define SOUND_DEATH_MAX 3
/**
@ -254,7 +257,10 @@ bool:ZombieSoundsGetRandomSound(String:sound[], ZombieSounds:soundtype)
soundmax = SOUND_MOAN_MAX;
// Copy path
strcopy(soundpath, sizeof(soundpath), SOUND_MOAN_PATH);
if (g_Game == Game_CSGO)
strcopy(soundpath, sizeof(soundpath), SOUND_MOAN_CSGO);
else
strcopy(soundpath, sizeof(soundpath), SOUND_MOAN_PATH);
}
// Find groan sound. (zombie shot)
case Groan:
@ -264,7 +270,10 @@ bool:ZombieSoundsGetRandomSound(String:sound[], ZombieSounds:soundtype)
soundmax = SOUND_GROAN_MAX;
// Copy path
strcopy(soundpath, sizeof(soundpath), SOUND_GROAN_PATH);
if (g_Game == Game_CSGO)
strcopy(soundpath, sizeof(soundpath), SOUND_GROAN_CSGO);
else
strcopy(soundpath, sizeof(soundpath), SOUND_GROAN_PATH);
}
// Find death sound.
case Death:
@ -274,7 +283,10 @@ bool:ZombieSoundsGetRandomSound(String:sound[], ZombieSounds:soundtype)
soundmax = SOUND_DEATH_MAX;
// Copy path
strcopy(soundpath, sizeof(soundpath), SOUND_DEATH_PATH);
if (g_Game == Game_CSGO)
strcopy(soundpath, sizeof(soundpath), SOUND_DEATH_CSGO);
else
strcopy(soundpath, sizeof(soundpath), SOUND_DEATH_PATH);
}
// Invalid case given.
default:

View File

@ -40,6 +40,10 @@
#define WEAPONAMMO_HEGRENADE_LIMIT 1
#define WEAPONAMMO_FLASHBANG_LIMIT 2
#define WEAPONAMMO_SMOKEGRENADE_LIMIT 1
#define WEAPONAMMO_INCENDIARY_LIMIT 1
#define WEAPONAMMO_MOLOTOV_LIMIT 1
#define WEAPONAMMO_DECOY_LIMIT 1
#define WEAPONAMMO_TACTICAL_LIMIT 1
/**
* @endsection
*/
@ -64,10 +68,16 @@ new g_iToolsAmmo;
*/
enum WeaponAmmoGrenadeType
{
GrenadeType_Invalid = -1, /** Invalid grenade slot. */
GrenadeType_HEGrenade = 11, /** HEGrenade slot */
GrenadeType_Flashbang = 12, /** Flashbang slot. */
GrenadeType_Smokegrenade = 13, /** Smokegrenade slot. */
GrenadeType_Invalid = -1, /** Invalid grenade slot. */
GrenadeType_HEGrenade = 11, /** CSS - HEGrenade slot */
GrenadeType_Flashbang = 12, /** CSS - Flashbang slot. */
GrenadeType_Smokegrenade = 13, /** CSS - Smokegrenade slot. */
GrenadeType_HEGrenadeCSGO = 14, /** CSGO - HEGrenade slot. */
GrenadeType_FlashbangCSGO = 15, /** CSGO - Flashbang slot. */
GrenadeType_SmokegrenadeCSGO = 16, /** CSGO - Smokegrenade slot. */
GrenadeType_Incendiary = 17, /** CSGO - Incendiary and Molotov slot. */
GrenadeType_Decoy = 18, /** CSGO - Decoy slot. */
GrenadeType_Tactical = 22, /** CSGO - Tactical slot. */
}
/**
@ -190,15 +200,40 @@ stock WeaponAmmoGrenadeType:WeaponAmmoEntityToGrenadeType(const String:weaponent
{
if (StrEqual(weaponentity, "weapon_hegrenade"))
{
return GrenadeType_HEGrenade;
if (g_Game == Game_CSGO)
return GrenadeType_HEGrenadeCSGO;
else
return GrenadeType_HEGrenade;
}
else if (StrEqual(weaponentity, "weapon_flashbang"))
{
return GrenadeType_Flashbang;
if (g_Game == Game_CSGO)
return GrenadeType_FlashbangCSGO;
else
return GrenadeType_Flashbang;
}
else if (StrEqual(weaponentity, "weapon_smokegrenade"))
{
return GrenadeType_Smokegrenade;
if (g_Game == Game_CSGO)
return GrenadeType_SmokegrenadeCSGO;
else
return GrenadeType_Smokegrenade;
}
else if (StrEqual(weaponentity, "weapon_molotov"))
{
return GrenadeType_Incendiary;
}
else if (StrEqual(weaponentity, "weapon_incgrenade"))
{
return GrenadeType_Incendiary;
}
else if (StrEqual(weaponentity, "weapon_decoy"))
{
return GrenadeType_Decoy;
}
else if (StrEqual(weaponentity, "weapon_tagrenade"))
{
return GrenadeType_Tactical;
}
return GrenadeType_Invalid;
@ -214,7 +249,7 @@ stock WeaponAmmoGrenadeType:WeaponAmmoEntityToGrenadeType(const String:weaponent
{
switch(grenadetype)
{
case GrenadeType_HEGrenade:
case GrenadeType_HEGrenade, GrenadeType_HEGrenadeCSGO:
{
// Attempt to find a cvar provided by an outside plugin.
new Handle:gplimit = FindConVar(GRENADE_PACK_CVAR_LIMIT);
@ -222,14 +257,26 @@ stock WeaponAmmoGrenadeType:WeaponAmmoEntityToGrenadeType(const String:weaponent
// If Grenade Pack is loaded and the cvar was found, then get the value of the outside cvar, if not return CS:S default.
return (g_bGrenadePack && gplimit != INVALID_HANDLE) ? GetConVarInt(gplimit) : WEAPONAMMO_HEGRENADE_LIMIT;
}
case GrenadeType_Flashbang:
case GrenadeType_Flashbang, GrenadeType_FlashbangCSGO:
{
return WEAPONAMMO_FLASHBANG_LIMIT;
}
case GrenadeType_Smokegrenade:
case GrenadeType_Smokegrenade, GrenadeType_SmokegrenadeCSGO:
{
return WEAPONAMMO_SMOKEGRENADE_LIMIT;
}
case GrenadeType_Incendiary:
{
return WEAPONAMMO_INCENDIARY_LIMIT;
}
case GrenadeType_Decoy:
{
return WEAPONAMMO_DECOY_LIMIT;
}
case GrenadeType_Tactical:
{
return WEAPONAMMO_TACTICAL_LIMIT;
}
}
return -1;

View File

@ -1059,7 +1059,8 @@ stock bool:ZMarketEquip(client, const String:weapon[], bool:rebuy = false)
// If client isn't rebuying the weapon, then tell them the weapon has been purchased.
TranslationPrintToChat(client, "Weapons zmarket purchase", weapondisplay);
if (IsValidEntity(entity) && !WeaponsIsClientInBuyZone(client))
new bool:zmarketnorefill = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_NOREFILL]);
if (IsValidEntity(entity) && !WeaponsIsClientInBuyZone(client) && zmarketnorefill)
{
int newclip = 0;
if (oldclip != -1)