Began adding cvar descriptions, recoded logging module, fixed zmenu display bug, removed include line for anticamp until recoded.
This commit is contained in:
@ -15,6 +15,15 @@
|
||||
*/
|
||||
new bool:g_bMarket;
|
||||
|
||||
/**
|
||||
* Set global market flag variable
|
||||
*/
|
||||
MarketInit()
|
||||
{
|
||||
// Set market variable to true if market is installed.
|
||||
g_bMarket = LibraryExists("market");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends market menu to client.
|
||||
*
|
||||
@ -26,7 +35,7 @@ bool:ZMarketMenu(client)
|
||||
if (!g_bMarket)
|
||||
{
|
||||
// Tell client market is disabled.
|
||||
ZR_PrintToChat(client, "Feature is disabled");
|
||||
TranslationPrintToChat(client, "Feature is disabled");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -34,7 +43,7 @@ bool:ZMarketMenu(client)
|
||||
if (!IsPlayerAlive(client))
|
||||
{
|
||||
// Tell player they must be alive.
|
||||
ZR_PrintToChat(client, "Must be alive");
|
||||
TranslationPrintToChat(client, "Must be alive");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -43,7 +52,7 @@ bool:ZMarketMenu(client)
|
||||
if (!ZMarketIsClientInBuyZone(client) && buyzone)
|
||||
{
|
||||
// Tell client they must be in a buyzone.
|
||||
ZR_PrintCenterText(client, "Market out of buyzone");
|
||||
TranslationPrintCenterText(client, "Market out of buyzone");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -93,7 +102,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
||||
// If player is a zombie, then stop.
|
||||
if (InfectIsClientInfected(client))
|
||||
{
|
||||
ZR_PrintToChat(client, "Zombie cant use weapon");
|
||||
TranslationPrintToChat(client, "Zombie cant use weapon");
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -120,7 +129,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
||||
// If the weapon is restricted, then stop.
|
||||
if (RestrictIsWeaponRestricted(weapon))
|
||||
{
|
||||
ZR_PrintToChat(client, "Weapon is restricted", weapon);
|
||||
TranslationPrintToChat(client, "Weapon is restricted", weapon);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -129,7 +138,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
|
||||
new bool:buyzone = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]);
|
||||
if (!ZMarketIsClientInBuyZone(client) && buyzone)
|
||||
{
|
||||
ZR_PrintCenterText(client, "Market out of buyzone");
|
||||
TranslationPrintCenterText(client, "Market out of buyzone");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -105,10 +105,7 @@ RestrictOnMapStart()
|
||||
if (!exists)
|
||||
{
|
||||
// Log failure.
|
||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing weapon groups config file: %s", LOG_FORMAT_TYPE_ERROR, pathweapongroups);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapon Restrict", "Config Validation", "Missing weapon groups config file: %s", pathweapongroups);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -159,12 +156,6 @@ RestrictDefaultRestrictions()
|
||||
*/
|
||||
RestrictValidateWeaponGroups()
|
||||
{
|
||||
// If log flag check fails, then don't log.
|
||||
if (!LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset keygroup's traversal stack.
|
||||
KvRewind(kvWeaponGroups);
|
||||
|
||||
@ -188,7 +179,7 @@ RestrictValidateWeaponGroups()
|
||||
// If weapon is invalid, then log it.
|
||||
if (!WeaponsIsValidWeapon(groupweapon))
|
||||
{
|
||||
LogMessageFormatted(-1, "Weapon Restrict", "Config Validation", "Invalid weapon \"%s\" in group \"%s\" configured in weapongroups.txt.", LOG_FORMAT_TYPE_ERROR, groupweapon, weapongroup);
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapon Restrict", "Config Validation", "Invalid weapon \"%s\" in group \"%s\" configured in weapongroups.txt.", groupweapon, weapongroup);
|
||||
}
|
||||
} while (KvGotoNextKey(kvWeaponGroups));
|
||||
|
||||
@ -197,7 +188,7 @@ RestrictValidateWeaponGroups()
|
||||
// If it couldn't traverse to the weapons, then log no weapons within group.
|
||||
else
|
||||
{
|
||||
LogMessageFormatted(-1, "Weapon Restrict", "Config Validation", "No weapons listed in weapon group \"%s\" in weapongroups.txt.", LOG_FORMAT_TYPE_ERROR, weapongroup);
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapon Restrict", "Config Validation", "No weapons listed in weapon group \"%s\" in weapongroups.txt.", weapongroup);
|
||||
}
|
||||
} while (KvGotoNextKey(kvWeaponGroups));
|
||||
}
|
||||
@ -259,19 +250,10 @@ RestrictOnClientSpawn(client)
|
||||
*/
|
||||
public Action:RestrictBuyCommand(client, argc)
|
||||
{
|
||||
// If plugin is disabled then stop.
|
||||
/*new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
|
||||
if (!enabled)
|
||||
{
|
||||
// Allow command.
|
||||
return Plugin_Continue;
|
||||
}*/
|
||||
// Disabled
|
||||
|
||||
// If player is a zombie, then block command.
|
||||
if (InfectIsClientInfected(client))
|
||||
{
|
||||
ZR_PrintToChat(client, "Zombie cant use weapon");
|
||||
TranslationPrintToChat(client, "Zombie cant use weapon");
|
||||
|
||||
// Block command
|
||||
return Plugin_Handled;
|
||||
@ -285,7 +267,7 @@ public Action:RestrictBuyCommand(client, argc)
|
||||
// Check if the weapon is restricted, if so then block command.
|
||||
if (RestrictIsWeaponRestricted(weapon))
|
||||
{
|
||||
ZR_PrintToChat(client, "Weapon is restricted", weapon);
|
||||
TranslationPrintToChat(client, "Weapon is restricted", weapon);
|
||||
|
||||
// Block command.
|
||||
return Plugin_Handled;
|
||||
@ -480,12 +462,8 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
||||
// Weapon was successfully restricted.
|
||||
case Successful_Weapon:
|
||||
{
|
||||
ZR_PrintToChat(0, "Restrict weapon", weapon);
|
||||
|
||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
LogMessageFormatted(client, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
||||
}
|
||||
TranslationPrintToChatAll(true, false, "Restrict weapon", weapon);
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon: \"%s\".", client, weapon);
|
||||
}
|
||||
// Weapon group was successfully restricted.
|
||||
case Successful_Group:
|
||||
@ -493,23 +471,19 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
||||
decl String:weaponlist[128];
|
||||
RestrictGetGroupWeapons(weapon, weaponlist, sizeof(weaponlist), ", ");
|
||||
|
||||
ZR_PrintToChat(0, "Restrict custom weapon group", weapon, weaponlist);
|
||||
|
||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
LogMessageFormatted(client, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon group: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
||||
}
|
||||
TranslationPrintToChatAll(true, false, "Restrict custom weapon group", weapon, weaponlist);
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Restrict", "\"%L\" restricted weapon group: \"%s\".", client, weapon);
|
||||
}
|
||||
// Weapon was already restricted.
|
||||
case Failed_Weapon:
|
||||
{
|
||||
if (reply)
|
||||
{
|
||||
ZR_ReplyToCommand(client, "Restrict weapon failed", weapon);
|
||||
TranslationReplyToCommand(client, "Restrict weapon failed", weapon);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZR_PrintToChat(client, "Restrict weapon failed", weapon);
|
||||
TranslationPrintToChat(client, "Restrict weapon failed", weapon);
|
||||
}
|
||||
}
|
||||
// Weapon group was already restricted.
|
||||
@ -520,11 +494,11 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
||||
|
||||
if (reply)
|
||||
{
|
||||
ZR_ReplyToCommand(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
||||
TranslationReplyToCommand(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZR_PrintToChat(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
||||
TranslationPrintToChat(client, "Restrict custom weapon group failed", weapon, weaponlist);
|
||||
}
|
||||
}
|
||||
// Weapon name was invalid.
|
||||
@ -532,11 +506,11 @@ RestrictPrintRestrictOutput(client, WpnRestrictQuery:output, const String:weapon
|
||||
{
|
||||
if (reply)
|
||||
{
|
||||
ZR_ReplyToCommand(client, "Weapon invalid", weapon);
|
||||
TranslationReplyToCommand(client, "Weapon invalid", weapon);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZR_PrintToChat(client, "Weapon invalid", weapon);
|
||||
TranslationPrintToChat(client, "Weapon invalid", weapon);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -556,12 +530,9 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
||||
// Weapon was successfully unrestricted.
|
||||
case Successful_Weapon:
|
||||
{
|
||||
ZR_PrintToChat(0, "Unrestrict weapon", weapon);
|
||||
TranslationPrintToChatAll(true, false, "Unrestrict weapon", weapon);
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Unrestrict", "\"%L\" unrestricted weapon: \"%s\".", client, weapon);
|
||||
|
||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
LogMessageFormatted(client, "Weapon Restrict", "Unrestrict", "\"%L\" unrestricted weapon: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
||||
}
|
||||
}
|
||||
// Weapon group was successfully unrestricted.
|
||||
case Successful_Group:
|
||||
@ -569,23 +540,19 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
||||
decl String:weaponlist[128];
|
||||
RestrictGetGroupWeapons(weapon, weaponlist, sizeof(weaponlist), ", ");
|
||||
|
||||
ZR_PrintToChat(0, "Unrestrict custom weapon group", weapon, weaponlist);
|
||||
|
||||
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
LogMessageFormatted(client, "Weapon Restrict", "Unrestrict", "\"%L\" unrestricted weapon group: \"%s\".", LOG_FORMAT_TYPE_FULL, client, weapon);
|
||||
}
|
||||
TranslationPrintToChatAll(true, false, "Unrestrict custom weapon group", weapon, weaponlist);
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_NORMAL, "Weapon Restrict", "Unrestrict", "\"%L\" unrestricted weapon group: \"%s\".", client, weapon);
|
||||
}
|
||||
// Weapon wasn't restricted.
|
||||
case Failed_Weapon:
|
||||
{
|
||||
if (reply)
|
||||
{
|
||||
ZR_ReplyToCommand(client, "Unrestrict weapon failed", weapon);
|
||||
TranslationReplyToCommand(client, "Unrestrict weapon failed", weapon);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZR_PrintToChat(client, "Unrestrict weapon failed", weapon);
|
||||
TranslationPrintToChat(client, "Unrestrict weapon failed", weapon);
|
||||
}
|
||||
}
|
||||
// Weapon group wasn't restricted.
|
||||
@ -596,11 +563,11 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
||||
|
||||
if (reply)
|
||||
{
|
||||
ZR_ReplyToCommand(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
||||
TranslationReplyToCommand(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZR_PrintToChat(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
||||
TranslationPrintToChat(client, "Unrestrict custom weapon group failed", weapon, weaponlist);
|
||||
}
|
||||
}
|
||||
// Weapon name was invalid.
|
||||
@ -608,11 +575,11 @@ RestrictPrintUnrestrictOutput(client, WpnRestrictQuery:output, const String:weap
|
||||
{
|
||||
if (reply)
|
||||
{
|
||||
ZR_ReplyToCommand(client, "Weapon invalid", weapon);
|
||||
TranslationReplyToCommand(client, "Weapon invalid", weapon);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZR_PrintToChat(client, "Weapon invalid", weapon);
|
||||
TranslationPrintToChat(client, "Weapon invalid", weapon);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -933,7 +900,7 @@ public Action:RestrictRestrictCommand(client, argc)
|
||||
if (!weapons)
|
||||
{
|
||||
// Tell client command is disabled.
|
||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
||||
TranslationReplyToCommand(client, "Feature is disabled");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -942,7 +909,7 @@ public Action:RestrictRestrictCommand(client, argc)
|
||||
if (!restrict)
|
||||
{
|
||||
// Tell client command is disabled.
|
||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
||||
TranslationReplyToCommand(client, "Feature is disabled");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -975,7 +942,7 @@ public Action:RestrictUnrestrictCommand(client, argc)
|
||||
if (!weapons)
|
||||
{
|
||||
// Tell client command is disabled.
|
||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
||||
TranslationReplyToCommand(client, "Feature is disabled");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -984,7 +951,7 @@ public Action:RestrictUnrestrictCommand(client, argc)
|
||||
if (!restrict)
|
||||
{
|
||||
// Tell client command is disabled.
|
||||
ZR_ReplyToCommand(client, "Feature is disabled");
|
||||
TranslationReplyToCommand(client, "Feature is disabled");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
@ -93,10 +93,7 @@ WeaponsLoad()
|
||||
if (!exists)
|
||||
{
|
||||
// Log failure.
|
||||
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
LogMessageFormatted(-1, "Weapons", "Config Validation", "Missing weapons config file: %s", LOG_FORMAT_TYPE_ERROR, pathweapons);
|
||||
}
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapons", "Config Validation", "Missing weapons config file: %s", pathweapons);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -116,16 +113,10 @@ WeaponsLoad()
|
||||
*/
|
||||
WeaponsValidateConfig()
|
||||
{
|
||||
// If log flag check fails, then don't log.
|
||||
if (!LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
KvRewind(kvWeapons);
|
||||
if (!KvGotoFirstSubKey(kvWeapons))
|
||||
{
|
||||
LogMessageFormatted(-1, "Weapons", "Config Validation", "No weapons listed in weapons.txt.", LOG_FORMAT_TYPE_ERROR);
|
||||
LogPrintToLog(LOG_FORMAT_TYPE_ERROR, "Weapons", "Config Validation", "No weapons listed in weapons.txt.");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user