add zr_weapons_zmarket_freespawn to adjust free rebuys before first zombie spawns

This commit is contained in:
BotoX 2021-05-24 11:55:34 +02:00
parent e73d61fbf3
commit 69fc706152
2 changed files with 4 additions and 1 deletions

View File

@ -78,6 +78,7 @@ enum CvarsList
Handle:CVAR_WEAPONS_ZMARKET, Handle:CVAR_WEAPONS_ZMARKET,
Handle:CVAR_WEAPONS_ZMARKET_BUYZONE, Handle:CVAR_WEAPONS_ZMARKET_BUYZONE,
Handle:CVAR_WEAPONS_ZMARKET_NOREFILL, Handle:CVAR_WEAPONS_ZMARKET_NOREFILL,
Handle:CVAR_WEAPONS_ZMARKET_FREESPAWN,
Handle:CVAR_WEAPONS_ZMARKET_REBUY, Handle:CVAR_WEAPONS_ZMARKET_REBUY,
Handle:CVAR_WEAPONS_ZMARKET_REBUY_AUTO, Handle:CVAR_WEAPONS_ZMARKET_REBUY_AUTO,
Handle:CVAR_WEAPONS_ZMARKET_REBUY_PRIMARY, 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] = 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_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_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] = 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_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]"); 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

@ -941,7 +941,8 @@ public ZMarketMenuTypeWeaponsHandle(Handle:menu_zmarket_typeweapons, MenuAction:
stock bool:ZMarketEquip(client, const String:weapon[], bool:rebuy = false) stock bool:ZMarketEquip(client, const String:weapon[], bool:rebuy = false)
{ {
// if zombie hasn't spawned yet we're always rebuying: // 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; rebuy = true;
// Get weapon index. // Get weapon index.