Made a switch for printing suicide attempts to admin chat. Added suicide response text to client chat too, not just the console.

This commit is contained in:
richard 2008-11-18 01:02:23 +01:00
parent c49fcb2142
commit 298dec378c
5 changed files with 32 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2008.11.17 - 2.5.1.13 - Richard
* Made a switch for printing suicide attempts to admin chat.
* Added suicide response to client chat too, not just the console.
2008.11.16 - 2.5.1.12 - Richard
* Applied game rules not available fix from Grey Echo.

View File

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

View File

@ -48,6 +48,7 @@ enum ZRSettings
Handle:CVAR_RESPAWN_TEAM,
Handle:CVAR_RESPAWN_DELAY,
Handle:CVAR_SUICIDE,
Handle:CVAR_SUICIDE_ECHO,
Handle:CVAR_SPAWN_MIN,
Handle:CVAR_SPAWN_MAX,
Handle:CVAR_PROTECT,
@ -119,6 +120,7 @@ CreateCvars()
gCvars[CVAR_RESPAWN_TEAM] = CreateConVar("zr_respawn_team", "zombie", "Which team to respawn player as (Choices: zombie, human)");
gCvars[CVAR_RESPAWN_DELAY] = CreateConVar("zr_respawn_delay", "1", "How long to wait after death to respawn, in seconds");
gCvars[CVAR_SUICIDE] = CreateConVar("zr_suicide", "1", "Stops players from suiciding");
gCvars[CVAR_SUICIDE_ECHO] = CreateConVar("zr_suicide_echo", "0", "Log suicide attempts to admin chat.");
gCvars[CVAR_SPAWN_MIN] = CreateConVar("zr_spawn_min", "30", "Minimum time a player is picked to be zombie after the round starts, in seconds");
gCvars[CVAR_SPAWN_MAX] = CreateConVar("zr_spawn_max", "50", "Maximum time a player is picked to be zombie after the round starts, in seconds");
gCvars[CVAR_PROTECT] = CreateConVar("zr_protect", "10", "Players that join late will be protected for this long, in seconds (0: Disable)");

View File

@ -176,6 +176,17 @@ public Action:Attempt_Suicide(client, argc)
}
ZR_ReplyToCommand(client, "Suicide text");
ZR_PrintToChat(client, "Suicide text");
decl String:clientname[64];
decl String:buffer[192];
if (GetConVarBool(gCvars[CVAR_SUICIDE_ECHO]))
{
GetClientName(client, clientname, sizeof(clientname));
Format(buffer, sizeof(buffer), "Player '%s' attempted suicide.", clientname);
ZR_PrintToAdminChat(buffer);
}
return Plugin_Handled;
}

View File

@ -115,4 +115,17 @@ stock ZR_ReplyToCommand(client, any:...)
FormatTextString(phrase, sizeof(phrase));
ReplyToCommand(client, phrase);
}
stock ZR_PrintToAdminChat(String:message[])
{
decl String:buffer[192];
Format(buffer, sizeof(buffer), "[ZR] %s", message);
for (new client = 1; client < maxclients; client++)
{
if (IsClientConnected(client) && IsClientInGame(client) && GetUserAdmin(client) != INVALID_ADMIN_ID)
{
PrintToChat(client, buffer);
}
}
}