Reorganized cvars.inc, organized all cvars into module groups (to be updated later), removed unused cvars, made classes and weapons core modules (event forwarding priority), updated spawn protect cvars, added cvars to disable weapons, restrict, and hitgroups
This commit is contained in:
@ -30,7 +30,7 @@ bool:ZMarketSend(client)
|
||||
}
|
||||
|
||||
// Check buyzone cvar to see if client has to be in a buyzone to use.
|
||||
new bool:buyzone = GetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE]);
|
||||
new bool:buyzone = GetConVarBool(g_hCvarsList[CVAR_ZMARKET_BUYZONE]);
|
||||
if (!IsClientInBuyZone(client) && buyzone)
|
||||
{
|
||||
// Tell client they must be in a buyzone.
|
||||
@ -106,7 +106,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
||||
}
|
||||
|
||||
// Check if buyzone cvar is enabled, and if the client is in a buyzone.
|
||||
new bool:buyzone = GetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE]);
|
||||
new bool:buyzone = GetConVarBool(g_hCvarsList[CVAR_ZMARKET_BUYZONE]);
|
||||
if (!IsClientInBuyZone(client) && buyzone)
|
||||
{
|
||||
ZR_PrintCenterText(client, "Market out of buyzone");
|
||||
|
@ -422,7 +422,7 @@ WeaponsMenuMarket(client)
|
||||
decl String:togglebuyzone[64];
|
||||
|
||||
decl String:curSetting[8];
|
||||
ZRBoolToConfigSetting(GetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE]), curSetting, sizeof(curSetting));
|
||||
ZRBoolToConfigSetting(GetConVarBool(g_hCvarsList[CVAR_ZMARKET_BUYZONE]), curSetting, sizeof(curSetting));
|
||||
|
||||
Format(togglebuyzone, sizeof(togglebuyzone), "%t", "Weapons menu market toggle buyzone", curSetting);
|
||||
|
||||
@ -451,13 +451,13 @@ public WeaponsMenuMarketHandle(Handle:menu_weapons_market, MenuAction:action, cl
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if (GetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE]))
|
||||
if (GetConVarBool(g_hCvarsList[CVAR_ZMARKET_BUYZONE]))
|
||||
{
|
||||
SetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE], false);
|
||||
SetConVarBool(g_hCvarsList[CVAR_ZMARKET_BUYZONE], false);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetConVarBool(gCvars[CVAR_ZMARKET_BUYZONE], true);
|
||||
SetConVarBool(g_hCvarsList[CVAR_ZMARKET_BUYZONE], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,16 @@ RestrictClearData()
|
||||
*/
|
||||
RestrictOnMapStart()
|
||||
{
|
||||
// Clear weapon restrict data.
|
||||
RestrictClearData();
|
||||
|
||||
// If module is disabled, then stop.
|
||||
new bool:restrict = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_RESTRICT]);
|
||||
if (!restrict)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Restrict default restrictions. (set in weapons.txt)
|
||||
RestrictDefaultRestrictions();
|
||||
|
||||
@ -78,7 +88,7 @@ RestrictOnMapStart()
|
||||
{
|
||||
if (LogFlagCheck(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
ZR_LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing file weapongroups.txt.", LOG_FORMAT_TYPE_FULL);
|
||||
ZR_LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing file weapongroups.txt.", LOG_FORMAT_TYPE_ERROR);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -208,7 +218,7 @@ RestrictOnClientDisconnect(client)
|
||||
public Action:RestrictBuyHook(client, argc)
|
||||
{
|
||||
// If plugin is disabled then stop.
|
||||
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
|
||||
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
|
||||
if (!enabled)
|
||||
{
|
||||
// Allow command.
|
||||
@ -835,7 +845,7 @@ RestrictGetGroupWeapons(const String:groupname[], String:weaponlist[], maxlen, c
|
||||
public RestrictCanUse(client, weapon, dummy1, dummy2, dummy3, dummy4)
|
||||
{
|
||||
// If plugin is disabled then stop.
|
||||
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
|
||||
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
|
||||
if (!enabled)
|
||||
{
|
||||
return Hacks_Continue;
|
||||
|
@ -1,9 +1,12 @@
|
||||
/**
|
||||
* ====================
|
||||
/*
|
||||
* ============================================================================
|
||||
*
|
||||
* Zombie:Reloaded
|
||||
* File: weapons.inc
|
||||
* Author: Greyscale
|
||||
* ====================
|
||||
*
|
||||
* File: weapons.inc
|
||||
* Description: API for all weapon-related functions.
|
||||
*
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -55,8 +58,12 @@ WeaponsLoad()
|
||||
// Clear weapon data.
|
||||
WeaponsClearData();
|
||||
|
||||
// Clear weapon restrict data.
|
||||
RestrictClearData();
|
||||
// If module is disabled, then stop.
|
||||
new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]);
|
||||
if (!weapons)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
decl String:path[PLATFORM_MAX_PATH];
|
||||
BuildPath(Path_SM, path, sizeof(path), "configs/zr/weapons/weapons.txt");
|
||||
@ -66,7 +73,7 @@ WeaponsLoad()
|
||||
{
|
||||
if (LogFlagCheck(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
ZR_LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing file weapons.txt, disabling weapons-based modules.", LOG_FORMAT_TYPE_FULL);
|
||||
ZR_LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing file weapons.txt, disabling weapons-based modules.", LOG_FORMAT_TYPE_ERROR);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -93,7 +100,7 @@ WeaponsValidateConfig()
|
||||
KvRewind(kvWeapons);
|
||||
if (!KvGotoFirstSubKey(kvWeapons))
|
||||
{
|
||||
ZR_LogMessageFormatted(-1, "Weapons", "Config Validation", "No weapons listed in weapons.txt, disabling weapons-based modules.", LOG_FORMAT_TYPE_FULL);
|
||||
ZR_LogMessageFormatted(-1, "Weapons", "Config Validation", "No weapons listed in weapons.txt, disabling weapons-based modules.", LOG_FORMAT_TYPE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user