Fixed incorrect weapon name used in group restictions. Improved logging system (bit flags instead of on/off). CVAR zr_debug changed to zr_log. Added flag configuration to zombie admin menu. Fixed index out of bounds error in anticamp module.

This commit is contained in:
richard 2009-01-31 20:48:56 +01:00
parent 972136b859
commit 58949a7fe8
11 changed files with 246 additions and 49 deletions

View File

@ -1,3 +1,8 @@
2009.01.31 - 2.5.1.25
* Fixed incorrect weapon name used in group weapon restrictions (bullpup => aug).
* Improved logging system. CVAR zr_debug renamed to zr_log. Using bit flags instead of on/off CVAR. Added flag configurations to zombie admin menu.
* Fixed index out of bounds error in anticamp module.
2009.01.18 - 2.5.1.24 2009.01.18 - 2.5.1.24
* Created a anticamp feature that give players damage at a specified interval in custom defined volumes. Only affects humans. * Created a anticamp feature that give players damage at a specified interval in custom defined volumes. Only affects humans.
* Re-formatted changes.txt. * Re-formatted changes.txt.

View File

@ -15,7 +15,7 @@
#undef REQUIRE_PLUGIN #undef REQUIRE_PLUGIN
#include <market> #include <market>
#define VERSION "2.5.1.24" #define VERSION "2.5.1.25"
#include "zr/zombiereloaded" #include "zr/zombiereloaded"
#include "zr/global" #include "zr/global"
@ -151,6 +151,7 @@ public OnConfigsExecuted()
if (FileExists(path)) if (FileExists(path))
{ {
ServerCommand("exec %s", mapconfig); ServerCommand("exec %s", mapconfig);
LogMessage("Executed map config file: %s", mapconfig);
} }
} }
@ -184,18 +185,17 @@ public OnClientDisconnect(client)
PlayerLeft(client); PlayerLeft(client);
ZTeleResetClient(client); ZTeleResetClient(client);
new debug_val = GetConVarInt(gCvars[CVAR_DEBUG]); decl String:debug_msg[64];
new String:debug_msg[64];
for (new x = 0; x < MAXTIMERS; x++) for (new x = 0; x < MAXTIMERS; x++)
{ {
if (tHandles[client][x] != INVALID_HANDLE) if (tHandles[client][x] != INVALID_HANDLE)
{ {
if (debug_val > 1) if (LogHasFlag(LOG_DEBUG_MAX_DETAIL))
{ {
Format(debug_msg, sizeof(debug_msg), "OnClientDisconnect - Killing timer %i with handle %x.", x, tHandles[client][x]); Format(debug_msg, sizeof(debug_msg), "Killing timer %i with handle %x.", x, tHandles[client][x]);
ZR_DebugPrintToConsole(0, debug_msg); ZR_LogMessageFormatted(client, "OnClientDisconnect", "Killing timers", debug_msg, true);
} }
KillTimer(tHandles[client][x]); KillTimer(tHandles[client][x]);
tHandles[client][x] = INVALID_HANDLE; tHandles[client][x] = INVALID_HANDLE;

View File

@ -25,7 +25,7 @@ enum volume
new volumes[MAX_VOLUMES][volume]; new volumes[MAX_VOLUMES][volume];
new volume_count; new volume_count;
new Float:player_loc[MAXPLAYERS][3]; new Float:player_loc[MAXPLAYERS + 1][3];
new Handle:hUpdateTimer; new Handle:hUpdateTimer;
@ -251,6 +251,7 @@ public Action:Command_AnticampRemoveVolume(client, argc)
{ {
new vol_index; new vol_index;
decl String:arg_buffer[32]; decl String:arg_buffer[32];
//decl String:client_name[192];
new Handle:vol_timer; new Handle:vol_timer;
if (argc < 1) if (argc < 1)
@ -272,6 +273,12 @@ public Action:Command_AnticampRemoveVolume(client, argc)
} }
volumes[vol_index][volume_in_use] = false; volumes[vol_index][volume_in_use] = false;
ReplyToCommand(client, "Removed volume %d.", vol_index); ReplyToCommand(client, "Removed volume %d.", vol_index);
if (LogHasFlag(LOG_CORE_EVENTS))
{
//GetClientName(client, client_name, sizeof(client_name));
ZR_LogMessageFormatted(client, "Anticamp", "Remove volume", "Admin %L removed volume %d.", true, client, vol_index);
}
} }
else else
{ {
@ -353,8 +360,8 @@ HurtPlayersInVolume(volume_index)
GetClientName(client, client_name, sizeof(client_name)); GetClientName(client, client_name, sizeof(client_name));
SetGlobalTransTarget(client); SetGlobalTransTarget(client);
Format(buffer, sizeof(buffer), "%T", "Unfair camper slayed", LANG_SERVER, client_name, volume_index); Format(buffer, sizeof(buffer), "%T", "Unfair camper slayed", LANG_SERVER, client_name, volume_index);
LogAction(client, client, buffer); if (LogHasFlag(LOG_CORE_EVENTS)) ZR_LogMessageFormatted(client, "Anticamp", "Kill player", "%s", true, buffer);
if (anticamp_echo) if (anticamp_echo)
{ {
FormatTextString(buffer, sizeof(buffer)); FormatTextString(buffer, sizeof(buffer));
@ -371,17 +378,18 @@ bool:IsPlayerInVolume(client, volume_index)
new Float:player_loc_x = player_loc[client][0]; new Float:player_loc_x = player_loc[client][0];
new Float:player_loc_y = player_loc[client][1]; new Float:player_loc_y = player_loc[client][1];
new Float:player_loc_z = player_loc[client][2]; new Float:player_loc_z = player_loc[client][2];
new debug_flags = GetConVarInt(gCvars[CVAR_DEBUG]); new log;
log = LogHasFlag(LOG_DEBUG_MAX_DETAIL);
if ((player_loc_x >= volumes[volume_index][x_min]) && (player_loc_x <= volumes[volume_index][x_max])) if ((player_loc_x >= volumes[volume_index][x_min]) && (player_loc_x <= volumes[volume_index][x_max]))
{ {
if (debug_flags & 4) PrintToChatAll("[ZR] Debug, Anticamp -- IsPlayerInVolume: Client %d matches X values.", client); if (log) ZR_LogMessageFormatted(client, "Anticamp", "IsPlayerInVolume", "Client %d matches X values.", true, client);
if ((player_loc_y >= volumes[volume_index][y_min]) && (player_loc_y <= volumes[volume_index][y_max])) if ((player_loc_y >= volumes[volume_index][y_min]) && (player_loc_y <= volumes[volume_index][y_max]))
{ {
if (debug_flags & 4) PrintToChatAll("[ZR] Debug, Anticamp -- IsPlayerInVolume: Client %d matches Y values.", client); if (log) ZR_LogMessageFormatted(client, "Anticamp", "IsPlayerInVolume", "Client %d matches Y values.", true, client);
if ((player_loc_z >= volumes[volume_index][z_min]) && (player_loc_z <= volumes[volume_index][z_max])) if ((player_loc_z >= volumes[volume_index][z_min]) && (player_loc_z <= volumes[volume_index][z_max]))
{ {
if (debug_flags & 4) PrintToChatAll("[ZR] Debug, Anticamp -- IsPlayerInVolume: Client %d matches Z values.", client); if (log) ZR_LogMessageFormatted(client, "Anticamp", "IsPlayerInVolume", "Client %d matches X values.", true, client);
return true; return true;
} }
} }

View File

@ -29,6 +29,8 @@ CreateCommands()
RegAdminCmd("zr_anticamp_create_volume", Command_AnticampCreateVolume, ADMFLAG_GENERIC, "Creates a rectangular hurt volume between two points. Usage: ht_create_volume <damage> <interval> <x1> <y1> <z1> <x2> <y2> <z2>"); RegAdminCmd("zr_anticamp_create_volume", Command_AnticampCreateVolume, ADMFLAG_GENERIC, "Creates a rectangular hurt volume between two points. Usage: ht_create_volume <damage> <interval> <x1> <y1> <z1> <x2> <y2> <z2>");
RegAdminCmd("zr_anticamp_remove_volume", Command_AnticampRemoveVolume, ADMFLAG_GENERIC, "Removes a volume. Use zr_anticamp_list to list volumes. Usage: zr_anticamp_remove_volume <volume index>"); RegAdminCmd("zr_anticamp_remove_volume", Command_AnticampRemoveVolume, ADMFLAG_GENERIC, "Removes a volume. Use zr_anticamp_list to list volumes. Usage: zr_anticamp_remove_volume <volume index>");
RegAdminCmd("zr_anticamp_list", Command_AnticampList, ADMFLAG_GENERIC, "List current volumes."); RegAdminCmd("zr_anticamp_list", Command_AnticampList, ADMFLAG_GENERIC, "List current volumes.");
RegConsoleCmd("zr_log_flags", Command_LogFlags, "List available logging flags.");
} }
public Action:Command_Infect(client, argc) public Action:Command_Infect(client, argc)
@ -89,7 +91,7 @@ public Action:Command_Respawn(client, argc)
team = GetClientTeam(targets[x]); team = GetClientTeam(targets[x]);
if (team == CS_TEAM_T || team == CS_TEAM_CT) if (team == CS_TEAM_T || team == CS_TEAM_CT)
{ {
if (GetConVarBool(gCvars[CVAR_DEBUG])) ZR_DebugPrintToConsole(targets[x], "ZSpawn: Spawned player"); if (LogHasFlag(LOG_GAME_EVENTS)) ZR_LogMessageFormatted(targets[x], "Commands", "Command_Respawn", "ZSpawn spawned player %d.", true, targets[x]);
RespawnPlayer(targets[x]); RespawnPlayer(targets[x]);
} }
} }
@ -275,3 +277,19 @@ public Action:Command_TeleMenu(client, argc)
} }
return Plugin_Handled; return Plugin_Handled;
} }
public Action:Command_LogFlags(client, argc)
{
decl String:message[2048];
StrCat(message, sizeof(message), "LOG_FLAG_CORE_EVENTS (1) - Log core events like executing files, restricting weapons, etc.\n");
StrCat(message, sizeof(message), "LOG_FLAG_GAME_EVENTS (2) - Log infections.\n");
StrCat(message, sizeof(message), "LOG_FLAG_PLAYER_COMMANDS (4) - Log zspawn, teleports, class change, etc.\n");
StrCat(message, sizeof(message), "LOG_FLAG_DEBUG (8) - Enable debug messages (if they exist).\n");
StrCat(message, sizeof(message), "LOG_FLAG_DEBUG (16) - Detailed debug messages. May cause spam.\n");
StrCat(message, sizeof(message), "LOG_FLAG_DEBUG_MAX_DETAIL (32) - Low level detailed debug messages. Causes spam! Only enable right before and after testing.\n");
StrCat(message, sizeof(message), "LOG_FLAG_LOG_TO_ADMINS (64) - Display log messages to admin chat.\n");
StrCat(message, sizeof(message), "LOG_FLAG_LOG_TO_CLIENT (128) - Display log messages to the client that executed the event/command.\n");
ReplyToCommand(client, message);
}

View File

@ -9,7 +9,7 @@
enum ZRSettings enum ZRSettings
{ {
Handle:CVAR_ENABLE, Handle:CVAR_ENABLE,
Handle:CVAR_DEBUG, Handle:CVAR_LOG,
Handle:CVAR_ALLOW_PLAYER_TEAM, Handle:CVAR_ALLOW_PLAYER_TEAM,
Handle:CVAR_AMBIENCE, Handle:CVAR_AMBIENCE,
Handle:CVAR_AMBIENCE_FILE, Handle:CVAR_AMBIENCE_FILE,
@ -92,7 +92,7 @@ new gCvars[ZRSettings];
CreateCvars() CreateCvars()
{ {
gCvars[CVAR_ENABLE] = CreateConVar("zr_enable", "1", "Enable zombie gameplay (0: Disable)"); gCvars[CVAR_ENABLE] = CreateConVar("zr_enable", "1", "Enable zombie gameplay (0: Disable)");
gCvars[CVAR_DEBUG] = CreateConVar("zr_debug", "0", "Debug switch, for developers. Usually enables logging of messages and events to a console. (0: Disable)"); gCvars[CVAR_LOG] = CreateConVar("zr_log", "65", "Logging flags. Log messages to sourcemod logs, server console or client console. Use zr_log_flags to see a list of flags. (0: Disable)");
gCvars[CVAR_ALLOW_PLAYER_TEAM] = CreateConVar("zr_allow_player_team", "0", "This will allow the player_team event to be fired on first team join, enable when using mani model menu (0: Disable)"); gCvars[CVAR_ALLOW_PLAYER_TEAM] = CreateConVar("zr_allow_player_team", "0", "This will allow the player_team event to be fired on first team join, enable when using mani model menu (0: Disable)");
gCvars[CVAR_AMBIENCE] = CreateConVar("zr_ambience", "1", "Enable creepy ambience to be played throughout the game (0: Disable)"); gCvars[CVAR_AMBIENCE] = CreateConVar("zr_ambience", "1", "Enable creepy ambience to be played throughout the game (0: Disable)");
gCvars[CVAR_AMBIENCE_FILE] = CreateConVar("zr_ambience_file", "ambient/zr/zr_ambience.mp3", "Path to ambient sound file that will be played throughout the game, when zr_ambience is 1"); gCvars[CVAR_AMBIENCE_FILE] = CreateConVar("zr_ambience_file", "ambient/zr/zr_ambience.mp3", "Path to ambient sound file that will be played throughout the game, when zr_ambience is 1");
@ -221,3 +221,15 @@ public LimitTeamsHook(Handle:convar, const String:oldValue[], const String:newVa
{ {
SetConVarInt(FindConVar("mp_limitteams"), 0); SetConVarInt(FindConVar("mp_limitteams"), 0);
} }
LogHasFlag(flag)
{
if (GetConVarInt(gCvars[CVAR_LOG]) & flag)
{
return 1;
}
else
{
return 0;
}
}

View File

@ -181,9 +181,13 @@ public Action:Attempt_Suicide(client, argc)
decl String:clientname[64]; decl String:clientname[64];
decl String:buffer[192]; decl String:buffer[192];
GetClientName(client, clientname, sizeof(clientname));
if (LogHasFlag(LOG_CORE_EVENTS))
{
ZR_LogMessageFormatted(client, "Damage control", "Suicide", "Player \"%s\" attempted suicide.", true, clientname);
}
if (GetConVarBool(gCvars[CVAR_SUICIDE_ECHO])) if (GetConVarBool(gCvars[CVAR_SUICIDE_ECHO]))
{ {
GetClientName(client, clientname, sizeof(clientname));
Format(buffer, sizeof(buffer), "Player '%s' attempted suicide.", clientname); Format(buffer, sizeof(buffer), "Player '%s' attempted suicide.", clientname);
ZR_PrintToAdminChat(buffer); ZR_PrintToAdminChat(buffer);
} }

View File

@ -132,10 +132,14 @@ public Action:Event_TeleportCooldown(Handle:Timer, any:client)
public Action:Command_Teleport(client, argc) public Action:Command_Teleport(client, argc)
{ {
new String:arg1[MAX_TARGET_LENGTH]; decl String:arg1[MAX_TARGET_LENGTH];
new String:target_name[MAX_TARGET_LENGTH]; decl String:target_name_list[192];
decl String:target_name[192];
decl String:client_name[192];
new bool:tn_is_ml; new bool:tn_is_ml;
GetClientName(client, client_name, sizeof(client_name));
if (argc >= 1) if (argc >= 1)
{ {
GetCmdArg(1, arg1, sizeof(arg1)); GetCmdArg(1, arg1, sizeof(arg1));
@ -148,8 +152,8 @@ public Action:Command_Teleport(client, argc)
target_list, target_list,
MAXPLAYERS, MAXPLAYERS,
COMMAND_FILTER_ALIVE, COMMAND_FILTER_ALIVE,
target_name, target_name_list,
sizeof(target_name), sizeof(target_name_list),
tn_is_ml)) <= 0) tn_is_ml)) <= 0)
{ {
ReplyToTargetError(client, target_count); ReplyToTargetError(client, target_count);
@ -162,7 +166,8 @@ public Action:Command_Teleport(client, argc)
{ {
AbortTeleport(target_list[i]); AbortTeleport(target_list[i]);
TeleportClient(target_list[i], true, true); TeleportClient(target_list[i], true, true);
LogAction(client, target_list[i], "\"%L\" teleported \"%L\" to spawn", client, target_list[i]); GetClientName(target_list[i], target_name, sizeof(target_name));
if (LogHasFlag(LOG_GAME_EVENTS)) ZR_LogMessageFormatted(client, "Teleport", "Manual teleport", "Admin \"%s\" teleported \"%s\" to spawn.", true, client_name, target_name);
} }
} }
} }
@ -172,14 +177,13 @@ public Action:Command_Teleport(client, argc)
{ {
AbortTeleport(client); AbortTeleport(client);
TeleportClient(client, true, true); TeleportClient(client, true, true);
GetClientName(client, target_name, sizeof(target_name)); if (LogHasFlag(LOG_GAME_EVENTS)) ZR_LogMessageFormatted(client, "Teleport", "Manual teleport", "Admin \"%s\" self-teleported to spawn.", true, client_name);
LogAction(client, client, "[ZR] Player %s teleported %s to spawn.", target_name, target_name);
} }
} }
if (tn_is_ml) if (tn_is_ml)
{ {
ShowActivity2(client, "[ZR] ", "%t teleported to spawn.", target_name); ShowActivity2(client, "[ZR] ", "%t teleported to spawn.", target_name_list);
} }
else else
{ {
@ -210,6 +214,7 @@ public Action:Command_TeleSaveLocation(client, argc)
bufferLocSaved[client] = true; bufferLocSaved[client] = true;
GetClientName(target_client, target_name, sizeof(target_name)); GetClientName(target_client, target_name, sizeof(target_name));
ReplyToCommand(client, "Saved location to %s (x:%f, y:%f, z:%f).", target_name, bufferLoc[client][0], bufferLoc[client][1], bufferLoc[client][2]); ReplyToCommand(client, "Saved location to %s (x:%f, y:%f, z:%f).", target_name, bufferLoc[client][0], bufferLoc[client][1], bufferLoc[client][2]);
} }
else else
{ {
@ -221,7 +226,8 @@ public Action:Command_TeleSaveLocation(client, argc)
public Action:Command_TeleportToLocation(client, argc) public Action:Command_TeleportToLocation(client, argc)
{ {
new String:target_name[MAX_TARGET_LENGTH]; decl String:client_name[192];
decl String:target_name[192];
new target_client; new target_client;
new Float:empty_vector[3] = {0.0, 0.0, 0.0}; new Float:empty_vector[3] = {0.0, 0.0, 0.0};
@ -237,6 +243,10 @@ public Action:Command_TeleportToLocation(client, argc)
{ {
target_client = client; target_client = client;
} }
GetClientName(client, client_name, sizeof(client_name));
GetClientName(target_client, target_name, sizeof(target_name));
if (target_client > 0 && target_client <= MAXPLAYERS) if (target_client > 0 && target_client <= MAXPLAYERS)
{ {
if (IsPlayerAlive(target_client)) if (IsPlayerAlive(target_client))
@ -245,15 +255,16 @@ public Action:Command_TeleportToLocation(client, argc)
TeleportEntity(target_client, bufferLoc[client], NULL_VECTOR, empty_vector); TeleportEntity(target_client, bufferLoc[client], NULL_VECTOR, empty_vector);
ZR_PrintToChat(client, "!ztele successful"); ZR_PrintToChat(client, "!ztele successful");
if (target_client != client) ZR_PrintToChat(target_client, "!ztele successful"); if (target_client != client) ZR_PrintToChat(target_client, "!ztele successful");
if (LogHasFlag(LOG_GAME_EVENTS)) ZR_LogMessageFormatted(client, "Teleport", "Custom teleport", "Admin \"%s\" teleported \"%s\".", true, client_name, target_name);
} }
else else
{ {
ReplyToCommand(client, "Player %s is dead. Only alive players can be teleported.", target_name); ReplyToCommand(client, "Player \"%s\" is dead. Only alive players can be teleported.", target_name);
} }
} }
else else
{ {
ReplyToCommand(client, "Unable to target %s", target_name); ReplyToCommand(client, "Unable to target \"%s\"", target_name);
} }
} }
else else
@ -293,7 +304,7 @@ public Action:Command_TeleportAbort(client, argc)
for (new i = 0; i < target_count; i++) for (new i = 0; i < target_count; i++)
{ {
AbortTeleport(target_list[i]); AbortTeleport(target_list[i]);
LogAction(client, target_list[i], "\"%L\" aborted teleport on \"%L\".", client, target_list[i]); LogAction(client, target_list[i], "%L aborted teleport on %L.", client, target_list[i]);
} }
} }
else else

View File

@ -105,6 +105,34 @@ stock ZR_LogMessage(any:...)
LogMessage(phrase); LogMessage(phrase);
} }
stock ZR_LogMessageFormatted(client, const String:function[], const String:block[], const String:message[], bool:full = false, any:...)
{
decl String:buffer[2048];
decl String:text[2048];
if (full)
{
VFormat(buffer, sizeof(buffer), message, 6);
Format(text, sizeof(text), "Log -- Module: %s, Function/Block: %s -- %s", function, block, buffer);
}
else
{
VFormat(buffer, sizeof(buffer), message, 6);
Format(text, sizeof(text), "Log -- %s", message);
}
if (LogHasFlag(LOG_TO_ADMINS))
{
ZR_PrintToAdminChat(text);
}
if (LogHasFlag(LOG_TO_CLIENT) && IsClientConnected(client) && IsClientInGame(client))
{
PrintToConsole(client, "[ZR] %s", text);
}
LogMessage(text);
}
stock ZR_ReplyToCommand(client, any:...) stock ZR_ReplyToCommand(client, any:...)
{ {
decl String:phrase[192]; decl String:phrase[192];
@ -119,7 +147,7 @@ stock ZR_ReplyToCommand(client, any:...)
stock ZR_PrintToAdminChat(String:message[]) stock ZR_PrintToAdminChat(String:message[])
{ {
decl String:buffer[192]; decl String:buffer[256];
Format(buffer, sizeof(buffer), "[ZR] %s", message); Format(buffer, sizeof(buffer), "[ZR] %s", message);
for (new client = 1; client < maxclients; client++) for (new client = 1; client < maxclients; client++)
{ {

View File

@ -118,7 +118,7 @@ RestrictWeaponGroup(const String:group[])
PushArrayString(restrictedWeapons, "ak47"); PushArrayString(restrictedWeapons, "ak47");
PushArrayString(restrictedWeapons, "m4a1"); PushArrayString(restrictedWeapons, "m4a1");
PushArrayString(restrictedWeapons, "sg552"); PushArrayString(restrictedWeapons, "sg552");
PushArrayString(restrictedWeapons, "bullpup"); PushArrayString(restrictedWeapons, "aug");
} }
else if (StrEqual(group, "snipers", false)) else if (StrEqual(group, "snipers", false))
{ {
@ -185,7 +185,7 @@ UnRestrictWeaponGroup(const String:group[])
UnRestrictWeapon("ak47"); UnRestrictWeapon("ak47");
UnRestrictWeapon("m4a1"); UnRestrictWeapon("m4a1");
UnRestrictWeapon("sg552"); UnRestrictWeapon("sg552");
UnRestrictWeapon("bullpup"); UnRestrictWeapon("aug");
} }
else if (StrEqual(group, "snipers", false)) else if (StrEqual(group, "snipers", false))
{ {

View File

@ -31,11 +31,18 @@ enum ZTeam
#define Game_Commencing 16 // Game Commencing! #define Game_Commencing 16 // Game Commencing!
#define DXLEVEL_MIN 90 #define DXLEVEL_MIN 90
#define DEFAULT_FOV 90 #define DEFAULT_FOV 90
new bool:market; #define LOG_CORE_EVENTS 1
#define LOG_GAME_EVENTS 2
#define LOG_PLAYER_COMMANDS 4
#define LOG_DEBUG 8
#define LOG_DEBUG_DETAIL 16
#define LOG_DEBUG_MAX_DETAIL 32
#define LOG_TO_ADMINS 64
#define LOG_TO_CLIENT 128
new bool:market;
new dxLevel[MAXPLAYERS+1]; new dxLevel[MAXPLAYERS+1];
new bool:zombieSpawned; new bool:zombieSpawned;
@ -212,17 +219,3 @@ bool:IsClientPlayer(client)
return false; return false;
} }
} }
ZR_DebugPrintToConsole(client, String:message[])
{
if (client)
{ /* Client console */
if (IsClientInGame(client)) PrintToConsole(client, message);
LogMessage("Debug log (client %i) -- %s", client, message);
}
else
{ /* Server console */
PrintToServer(message);
LogMessage("Debug log (client %i) -- %s", client, message);
}
}

View File

@ -23,6 +23,7 @@ ZRAdminMenu(client)
decl String:ztele[] = "Teleporter commands"; decl String:ztele[] = "Teleporter commands";
decl String:zrestrict[] = "Restrict a weapon"; decl String:zrestrict[] = "Restrict a weapon";
decl String:zunrestrict[] = "Unrestrict a weapon"; decl String:zunrestrict[] = "Unrestrict a weapon";
decl String:zlogflags[] = "Logging flags";
AddMenuItem(zr_admin_menu, "zknockbackm", zknockbackm); AddMenuItem(zr_admin_menu, "zknockbackm", zknockbackm);
AddMenuItem(zr_admin_menu, "zknockback", zknockback); AddMenuItem(zr_admin_menu, "zknockback", zknockback);
@ -32,6 +33,7 @@ ZRAdminMenu(client)
AddMenuItem(zr_admin_menu, "ztele", ztele); AddMenuItem(zr_admin_menu, "ztele", ztele);
AddMenuItem(zr_admin_menu, "zrestrict", zrestrict, ITEMDRAW_DISABLED); AddMenuItem(zr_admin_menu, "zrestrict", zrestrict, ITEMDRAW_DISABLED);
AddMenuItem(zr_admin_menu, "zunrestrict", zunrestrict, ITEMDRAW_DISABLED); AddMenuItem(zr_admin_menu, "zunrestrict", zunrestrict, ITEMDRAW_DISABLED);
AddMenuItem(zr_admin_menu, "zlogflags", zlogflags);
DisplayMenu(zr_admin_menu, client, MENU_TIME_FOREVER); DisplayMenu(zr_admin_menu, client, MENU_TIME_FOREVER);
} }
@ -74,6 +76,10 @@ public ZRAdminMenuHandle(Handle:zr_admin_menu, MenuAction:action, client, slot)
{ {
// unrestrict // unrestrict
} }
case 8:
{
ZRLogFlagsMenu(client);
}
} }
} }
if (action == MenuAction_End) if (action == MenuAction_End)
@ -424,6 +430,103 @@ public ZRTeleHandle(Handle:zr_tele_menu , MenuAction:action, client, slot)
} }
} }
ZRLogFlagsMenu(client)
{
new Handle:zr_log_flags_menu = CreateMenu(ZRLogFlagsMenuHandle);
decl String:z_log_core[64];
decl String:z_log_game[64];
decl String:z_log_player[64];
decl String:z_log_debug[64];
decl String:z_log_debug_detail[64];
decl String:z_log_debug_max[64];
decl String:z_log_admins[64];
decl String:z_log_client[64];
Format(z_log_core, sizeof(z_log_core), "Log core events (%d)", LogHasFlag(LOG_CORE_EVENTS));
Format(z_log_game, sizeof(z_log_game), "Log game events (%d)", LogHasFlag(LOG_GAME_EVENTS));
Format(z_log_player, sizeof(z_log_player), "Log player commands (%d)", LogHasFlag(LOG_PLAYER_COMMANDS));
Format(z_log_debug, sizeof(z_log_debug), "Log debug messages (%d)", LogHasFlag(LOG_DEBUG));
Format(z_log_debug_detail, sizeof(z_log_debug_detail), "Log detailed debug messages (%d)", LogHasFlag(LOG_DEBUG_DETAIL));
Format(z_log_debug_max, sizeof(z_log_debug_max), "Log low level debug messages (%d)", LogHasFlag(LOG_DEBUG_MAX_DETAIL));
Format(z_log_admins, sizeof(z_log_admins), "Also log to admin chat (%d)", LogHasFlag(LOG_TO_ADMINS));
Format(z_log_client, sizeof(z_log_client), "Also log to client console (%d)", LogHasFlag(LOG_TO_CLIENT));
SetMenuTitle(zr_log_flags_menu, "Toggle logging flags");
AddMenuItem(zr_log_flags_menu, z_log_core, z_log_core);
AddMenuItem(zr_log_flags_menu, z_log_game, z_log_game);
AddMenuItem(zr_log_flags_menu, z_log_player, z_log_player);
AddMenuItem(zr_log_flags_menu, z_log_debug, z_log_debug);
AddMenuItem(zr_log_flags_menu, z_log_debug_detail, z_log_debug_detail);
AddMenuItem(zr_log_flags_menu, z_log_debug_max, z_log_debug_max);
AddMenuItem(zr_log_flags_menu, z_log_admins, z_log_admins);
AddMenuItem(zr_log_flags_menu, z_log_client, z_log_client);
SetMenuExitBackButton(zr_log_flags_menu, true);
DisplayMenu(zr_log_flags_menu, client, MENU_TIME_FOREVER);
}
public ZRLogFlagsMenuHandle(Handle:zr_log_flags_menu , MenuAction:action, client, slot)
{
if (action == MenuAction_Select)
{
switch(slot)
{
case 0:
{
ToggleLogFlag(LOG_CORE_EVENTS);
ZRLogFlagsMenu(client);
}
case 1:
{
ToggleLogFlag(LOG_GAME_EVENTS);
ZRLogFlagsMenu(client);
}
case 2:
{
ToggleLogFlag(LOG_PLAYER_COMMANDS);
ZRLogFlagsMenu(client);
}
case 3:
{
ToggleLogFlag(LOG_DEBUG);
ZRLogFlagsMenu(client);
}
case 4:
{
ToggleLogFlag(LOG_DEBUG_DETAIL);
ZRLogFlagsMenu(client);
}
case 5:
{
ToggleLogFlag(LOG_DEBUG_MAX_DETAIL);
ZRLogFlagsMenu(client);
}
case 6:
{
ToggleLogFlag(LOG_TO_ADMINS);
ZRLogFlagsMenu(client);
}
case 7:
{
ToggleLogFlag(LOG_TO_CLIENT);
ZRLogFlagsMenu(client);
}
}
}
if (action == MenuAction_Cancel)
{
if (slot == MenuCancel_ExitBack)
{
ZRAdminMenu(client);
}
}
if (action == MenuAction_End)
{
CloseHandle(zr_log_flags_menu );
}
}
AddToKnockbackMultiplier(Float:value) AddToKnockbackMultiplier(Float:value)
{ {
new Float:current_val = GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]); new Float:current_val = GetConVarFloat(gCvars[CVAR_ZOMBIE_KNOCKBACK]);
@ -434,3 +537,18 @@ AddToClassKnockback(classindex, Float:value)
{ {
arrayClasses[classindex][data_knockback] = arrayClasses[classindex][data_knockback] + value; arrayClasses[classindex][data_knockback] = arrayClasses[classindex][data_knockback] + value;
} }
ToggleLogFlag(flag)
{
new log_flags;
log_flags = GetConVarInt(gCvars[CVAR_LOG]);
if (log_flags & flag)
{
log_flags = log_flags - flag;
}
else
{
log_flags = log_flags + flag;
}
SetConVarInt(gCvars[CVAR_LOG], log_flags);
}