From 69fc706152cb95e5fb76342b7a24720146d1c375 Mon Sep 17 00:00:00 2001 From: BotoX Date: Mon, 24 May 2021 11:55:34 +0200 Subject: [PATCH] add zr_weapons_zmarket_freespawn to adjust free rebuys before first zombie spawns --- src/zr/cvars.inc | 2 ++ src/zr/weapons/zmarket.inc | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index 3fe260c..e15f5b5 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -78,6 +78,7 @@ enum CvarsList Handle:CVAR_WEAPONS_ZMARKET, Handle:CVAR_WEAPONS_ZMARKET_BUYZONE, Handle:CVAR_WEAPONS_ZMARKET_NOREFILL, + Handle:CVAR_WEAPONS_ZMARKET_FREESPAWN, Handle:CVAR_WEAPONS_ZMARKET_REBUY, Handle:CVAR_WEAPONS_ZMARKET_REBUY_AUTO, Handle:CVAR_WEAPONS_ZMARKET_REBUY_PRIMARY, @@ -312,6 +313,7 @@ CvarsCreate() 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_FREESPAWN] = CreateConVar("zr_weapons_zmarket_freespawn", "1", "Purchases are free before the first zombie spawns. [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]"); diff --git a/src/zr/weapons/zmarket.inc b/src/zr/weapons/zmarket.inc index 2601449..c79bba4 100644 --- a/src/zr/weapons/zmarket.inc +++ b/src/zr/weapons/zmarket.inc @@ -941,7 +941,8 @@ public ZMarketMenuTypeWeaponsHandle(Handle:menu_zmarket_typeweapons, MenuAction: stock bool:ZMarketEquip(client, const String:weapon[], bool:rebuy = false) { // if zombie hasn't spawned yet we're always rebuying: - if(!InfectHasZombieSpawned()) + new bool:zmarketfreespawn = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_FREESPAWN]); + if(zmarketfreespawn && !InfectHasZombieSpawned()) rebuy = true; // Get weapon index.