Fixed message typos. Added debug messags when applying models. Added log messages on manual infections and weapon resticitons.

This commit is contained in:
richard 2009-02-02 01:56:53 +01:00
parent 58949a7fe8
commit b46d886c9c
8 changed files with 103 additions and 25 deletions

View File

@ -1,3 +1,8 @@
2009.02.02 - 2.5.1.26
* Fixed message typo.
* Added debug messages when applying models.
* Added log messages on manual infecions and weapon restrictions.
2009.01.31 - 2.5.1.25 2009.01.31 - 2.5.1.25
* Fixed incorrect weapon name used in group weapon restrictions (bullpup => aug). * 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. * 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.

View File

@ -15,7 +15,7 @@
#undef REQUIRE_PLUGIN #undef REQUIRE_PLUGIN
#include <market> #include <market>
#define VERSION "2.5.1.25" #define VERSION "2.5.1.26"
#include "zr/zombiereloaded" #include "zr/zombiereloaded"
#include "zr/global" #include "zr/global"

View File

@ -274,9 +274,8 @@ 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)) if (LogHasFlag(LOG_GAME_EVENTS))
{ {
//GetClientName(client, client_name, sizeof(client_name));
ZR_LogMessageFormatted(client, "Anticamp", "Remove volume", "Admin %L removed volume %d.", true, client, vol_index); ZR_LogMessageFormatted(client, "Anticamp", "Remove volume", "Admin %L removed volume %d.", true, client, vol_index);
} }
} }
@ -389,7 +388,7 @@ bool:IsPlayerInVolume(client, volume_index)
if (log) ZR_LogMessageFormatted(client, "Anticamp", "IsPlayerInVolume", "Client %d matches Y values.", true, 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 (log) ZR_LogMessageFormatted(client, "Anticamp", "IsPlayerInVolume", "Client %d matches X values.", true, client); if (log) ZR_LogMessageFormatted(client, "Anticamp", "IsPlayerInVolume", "Client %d matches Z values.", true, client);
return true; return true;
} }
} }

View File

@ -44,20 +44,36 @@ public Action:Command_Infect(client, argc)
decl String:arg1[32]; decl String:arg1[32];
GetCmdArg(1, arg1, sizeof(arg1)); GetCmdArg(1, arg1, sizeof(arg1));
decl String:target_name[MAX_TARGET_LENGTH]; decl String:target_name_list[MAX_TARGET_LENGTH];
decl String:target_name[64];
decl String:client_name[64];
new targets[MAXPLAYERS]; new targets[MAXPLAYERS];
new bool:tn_is_ml; new bool:tn_is_ml;
new tcount = ProcessTargetString(arg1, client, targets, MAXPLAYERS, COMMAND_FILTER_ALIVE, target_name, sizeof(target_name), tn_is_ml); new tcount = ProcessTargetString(arg1, client, targets, MAXPLAYERS, COMMAND_FILTER_ALIVE, target_name_list, sizeof(target_name), tn_is_ml);
if (tcount <= 0) if (tcount <= 0)
{ {
ReplyToTargetError(client, tcount); ReplyToTargetError(client, tcount);
return Plugin_Handled; return Plugin_Handled;
} }
if (client > 0)
{
GetClientName(client, client_name, sizeof(client_name));
}
else
{
client_name = "Console\0";
}
for (new x = 0; x < tcount; x++) for (new x = 0; x < tcount; x++)
{ {
Zombify(targets[x], 0); Zombify(targets[x], 0);
if (LogHasFlag(LOG_GAME_EVENTS))
{
GetClientName(targets[x], target_name, sizeof(target_name));
ZR_LogMessageFormatted(client, "Commands", "Manual infect", "Admin \"%s\" infected \"%s\".", true, client_name, target_name);
}
} }
return Plugin_Handled; return Plugin_Handled;
@ -66,6 +82,8 @@ public Action:Command_Infect(client, argc)
public Action:Command_Respawn(client, argc) public Action:Command_Respawn(client, argc)
{ {
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
decl String:client_name[64];
decl String:target_name[64];
if (argc < 1 || !enabled) if (argc < 1 || !enabled)
{ {
return Plugin_Handled; return Plugin_Handled;
@ -74,24 +92,37 @@ public Action:Command_Respawn(client, argc)
decl String:arg1[32]; decl String:arg1[32];
GetCmdArg(1, arg1, sizeof(arg1)); GetCmdArg(1, arg1, sizeof(arg1));
decl String:target_name[MAX_TARGET_LENGTH]; decl String:target_name_list[MAX_TARGET_LENGTH];
new targets[MAXPLAYERS]; new targets[MAXPLAYERS];
new bool:tn_is_ml; new bool:tn_is_ml;
new tcount = ProcessTargetString(arg1, client, targets, MAXPLAYERS, COMMAND_FILTER_DEAD, target_name, sizeof(target_name), tn_is_ml); new tcount = ProcessTargetString(arg1, client, targets, MAXPLAYERS, COMMAND_FILTER_DEAD, target_name_list, sizeof(target_name), tn_is_ml);
if (tcount <= 0) if (tcount <= 0)
{ {
ReplyToTargetError(client, tcount); ReplyToTargetError(client, tcount);
return Plugin_Handled; return Plugin_Handled;
} }
if (client > 0)
{
GetClientName(client, client_name, sizeof(client_name));
}
else
{
client_name = "Console\0";
}
new team; new team;
for (new x = 0; x < tcount; x++) for (new x = 0; x < tcount; x++)
{ {
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 (LogHasFlag(LOG_GAME_EVENTS)) ZR_LogMessageFormatted(targets[x], "Commands", "Command_Respawn", "ZSpawn spawned player %d.", true, targets[x]); if (LogHasFlag(LOG_GAME_EVENTS))
{
GetClientName(targets[x], target_name, sizeof(target_name));
ZR_LogMessageFormatted(targets[x], "Commands", "Manual spawn", "Admin \"%s\" spawned player \"%s\".", true, client_name, target_name);
}
RespawnPlayer(targets[x]); RespawnPlayer(targets[x]);
} }
} }
@ -102,6 +133,7 @@ public Action:Command_Respawn(client, argc)
public Action:Command_Restrict(client, argc) public Action:Command_Restrict(client, argc)
{ {
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
decl String:client_name[64];
if (argc < 1 || !enabled) if (argc < 1 || !enabled)
{ {
return Plugin_Handled; return Plugin_Handled;
@ -116,6 +148,21 @@ public Action:Command_Restrict(client, argc)
{ {
ZR_ReplyToCommand(client, "Weapon already restricted", arg1); ZR_ReplyToCommand(client, "Weapon already restricted", arg1);
} }
else
{
if (LogHasFlag(LOG_GAME_EVENTS))
{
if (client > 0)
{
GetClientName(client, client_name, sizeof(client_name));
}
else
{
client_name = "Console\0";
}
ZR_LogMessageFormatted(client, "Commands", "Weapon restictions", "Admin \"%s\" restricted weapon \"%s\".", true, client_name, arg1);
}
}
return Plugin_Handled; return Plugin_Handled;
} }
@ -123,6 +170,7 @@ public Action:Command_Restrict(client, argc)
public Action:Command_UnRestrict(client, argc) public Action:Command_UnRestrict(client, argc)
{ {
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
decl String:client_name[64];
if (argc < 1 || !enabled) if (argc < 1 || !enabled)
{ {
return Plugin_Handled; return Plugin_Handled;
@ -137,6 +185,21 @@ public Action:Command_UnRestrict(client, argc)
{ {
ZR_ReplyToCommand(client, "Weapon invalid", arg1); ZR_ReplyToCommand(client, "Weapon invalid", arg1);
} }
else
{
if (LogHasFlag(LOG_GAME_EVENTS))
{
if (client > 0)
{
GetClientName(client, client_name, sizeof(client_name));
}
else
{
client_name = "Console\0";
}
ZR_LogMessageFormatted(client, "Commands", "Weapon restictions", "Admin \"%s\" removed weapon restriction on \"%s\".", true, client_name, arg1);
}
}
return Plugin_Handled; return Plugin_Handled;
} }
@ -282,14 +345,14 @@ public Action:Command_LogFlags(client, argc)
{ {
decl String:message[2048]; 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_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_GAME_EVENTS (2) - Log game events like admin commands, suicide prevention and anticamp kills.\n");
StrCat(message, sizeof(message), "LOG_FLAG_PLAYER_COMMANDS (4) - Log zspawn, teleports, class change, etc.\n"); StrCat(message, sizeof(message), "LOG_PLAYER_COMMANDS (4) - Log commands made by the player.\n");
StrCat(message, sizeof(message), "LOG_FLAG_DEBUG (8) - Enable debug messages (if they exist).\n"); StrCat(message, sizeof(message), "LOG_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_DEBUG_DETAIL (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_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_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"); StrCat(message, sizeof(message), "LOG_LOG_TO_CLIENT (128) - Display log messages to the client that executed the event/command.\n");
ReplyToCommand(client, message); ReplyToCommand(client, message);
} }

View File

@ -182,7 +182,7 @@ public Action:Attempt_Suicide(client, argc)
decl String:buffer[192]; decl String:buffer[192];
GetClientName(client, clientname, sizeof(clientname)); GetClientName(client, clientname, sizeof(clientname));
if (LogHasFlag(LOG_CORE_EVENTS)) if (LogHasFlag(LOG_GAME_EVENTS))
{ {
ZR_LogMessageFormatted(client, "Damage control", "Suicide", "Player \"%s\" attempted suicide.", true, clientname); ZR_LogMessageFormatted(client, "Damage control", "Suicide", "Player \"%s\" attempted suicide.", true, clientname);
} }

View File

@ -198,8 +198,12 @@ TerminateRound(Float:delay, reason)
SetPlayerModel(client, const String:model[]) SetPlayerModel(client, const String:model[])
{ {
if (LogHasFlag(LOG_DEBUG)) ZR_LogMessageFormatted(-1, "Offsets", "Models", "Precaching model \"%s\".", true, model);
PrecacheModel(model); PrecacheModel(model);
if (LogHasFlag(LOG_DEBUG)) ZR_LogMessageFormatted(-1, "Offsets", "Models", "Model cached (\"%s\").", true, model);
if (LogHasFlag(LOG_DEBUG)) ZR_LogMessageFormatted(-1, "Offsets", "Models", "Applying model \"%s\" on client %d.", true, model, client);
SetEntityModel(client, model); SetEntityModel(client, model);
if (LogHasFlag(LOG_DEBUG)) ZR_LogMessageFormatted(-1, "Offsets", "Models", "Model applied (\"%s\") on client %d.", true, model, client);
} }
SetPlayerAlpha(client, alpha) SetPlayerAlpha(client, alpha)

View File

@ -226,8 +226,8 @@ public Action:Command_TeleSaveLocation(client, argc)
public Action:Command_TeleportToLocation(client, argc) public Action:Command_TeleportToLocation(client, argc)
{ {
decl String:client_name[192]; decl String:client_name[64];
decl String:target_name[192]; decl String:target_name[64];
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};
@ -243,12 +243,19 @@ 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 (client > 0)
{
GetClientName(client, client_name, sizeof(client_name));
}
else
{
client_name = "Console\0";
}
GetClientName(target_client, target_name, sizeof(target_name));
if (IsPlayerAlive(target_client)) if (IsPlayerAlive(target_client))
{ {
AbortTeleport(target_client); AbortTeleport(target_client);

View File

@ -105,7 +105,7 @@ 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:...) stock ZR_LogMessageFormatted(client, const String:module[], const String:block[], const String:message[], bool:full = false, any:...)
{ {
decl String:buffer[2048]; decl String:buffer[2048];
decl String:text[2048]; decl String:text[2048];
@ -113,7 +113,7 @@ stock ZR_LogMessageFormatted(client, const String:function[], const String:block
if (full) if (full)
{ {
VFormat(buffer, sizeof(buffer), message, 6); VFormat(buffer, sizeof(buffer), message, 6);
Format(text, sizeof(text), "Log -- Module: %s, Function/Block: %s -- %s", function, block, buffer); Format(text, sizeof(text), "Log -- Module: %s, Function/Block: %s -- %s", module, block, buffer);
} }
else else
{ {