Hooked autobuy/rebuy, added fog to visual effects, create effect functions in visualeffects.inc, fixed ambience, hooked mp_restartgame, mother count is rounded to nearest instead of ceiling, recoded cvars.inc and added logging, recoded event.inc, killed respawn timers on round end.

This commit is contained in:
Greyscale 2009-04-27 04:00:38 +02:00
parent 65411df2c0
commit abd38ee033
14 changed files with 738 additions and 301 deletions

View File

@ -23,12 +23,12 @@
// External api (not done)
//#include "zr/global"
// Cvars (core)
#include "zr/cvars"
// Log (core)
#include "zr/log"
// Cvars (core)
#include "zr/cvars"
// Translations (core)
#include "zr/translation"
@ -90,6 +90,8 @@
#include "zr/sayhooks"
#include "zr/zadmin"
#include "zr/commands"
// Event
#include "zr/event"
public Plugin:myinfo =
@ -120,12 +122,13 @@ public OnPluginStart()
// ======================================================================
// Log
LogInit();
// Cvars
CvarsInit();
CvarsHook();
// TODO: Be modulized/recoded.
HookEvents();
HookChatCmds();
CreateCommands();
HookCommands();
@ -138,6 +141,9 @@ public OnPluginStart()
// Damage
DamageInit();
// Event
EventInit();
// ======================================================================
g_bMarket = LibraryExists("market");

View File

@ -9,14 +9,21 @@
* ============================================================================
*/
/**
* @section Locked cvar value defines.
*/
#define CVARS_AUTOTEAMBALANCE_LOCKED 0
#define CVARS_LIMITTEAMS_LOCKED 0
/**
* @endsection
*/
/**
* List of cvars used by the plugin.
*/
enum CvarsList
{
Handle:CVAR_ENABLE,
Handle:CVAR_LOG,
Handle:CVAR_LOGFLAGS,
Handle:CVAR_CLASSES_SPAWN,
Handle:CVAR_CLASSES_RANDOM,
Handle:CVAR_CLASSES_DEFAULT_ZOMBIE,
@ -56,6 +63,14 @@ enum CvarsList
Handle:CVAR_VEFFECTS_LIGHTSTYLE_VALUE,
Handle:CVAR_VEFFECTS_SKY,
Handle:CVAR_VEFFECTS_SKY_PATH,
Handle:CVAR_VEFFECTS_FOG,
Handle:CVAR_VEFFECTS_FOG_OVERRIDE,
Handle:CVAR_VEFFECTS_FOG_PCOLOR,
Handle:CVAR_VEFFECTS_FOG_SCOLOR,
Handle:CVAR_VEFFECTS_FOG_DENSITY,
Handle:CVAR_VEFFECTS_FOG_STARTDIST,
Handle:CVAR_VEFFECTS_FOG_ENDDIST,
Handle:CVAR_VEFFECTS_FOG_FARZ,
Handle:CVAR_SEFFECTS_MOAN,
Handle:CVAR_SEFFECTS_GROAN,
Handle:CVAR_SEFFECTS_DEATH,
@ -96,10 +111,37 @@ enum CvarsList
*/
new g_hCvarsList[CvarsList];
/**
* @section Global cvar handles.
*/
new Handle:g_hAutoTeamBalance = INVALID_HANDLE;
new Handle:g_hLimitTeams = INVALID_HANDLE;
new Handle:g_hRestartGame = INVALID_HANDLE;
/**
* @endsection
*/
/**
* Cvars module init function.
*/
CvarsInit()
{
// Retrieve handles of CS:S cvars.
g_hAutoTeamBalance = FindConVar("mp_autoteambalance");
g_hLimitTeams = FindConVar("mp_limitteams");
g_hRestartGame = FindConVar("mp_restartgame");
// Create zombiereloaded cvars.
CvarsCreate();
// Hook cvars.
CvarsHook();
}
/**
* Create all cvars for plugin.
*/
CvarsCreate()
{
// Cvar naming guidelines:
// 1. Prefix: "zr_"
@ -126,9 +168,7 @@ CvarsInit()
// Log (core)
// ===========================
g_hCvarsList[CVAR_LOG] = CreateConVar("zr_log", "1", "");
g_hCvarsList[CVAR_LOGFLAGS] = CreateConVar("zr_logflags", "331", "");
// Old Desc: Logging flags. Log messages to sourcemod logs, server console or client console. Use zr_log_flags to see a list of flags. (0: Disable)
// Cvars created in log.inc, because of compilation problems when creating them here.
// ===========================
// Translations (core)
@ -198,7 +238,7 @@ CvarsInit()
g_hCvarsList[CVAR_ROUNDEND_OVERLAY] = CreateConVar("zr_roundend_overlay", "1", "");
// Old Desc: Shows an overlay to all clients when a team wins. (0: Disable)
g_hCvarsList[CVAR_ROUNDEND_OVERLAY_HUMAN] = CreateConVar("zr_roundend_overlays_human", "");
g_hCvarsList[CVAR_ROUNDEND_OVERLAY_HUMAN] = CreateConVar("zr_roundend_overlays_human", "overlays/zr/humans_win");
// Old Desc: overlays/zr/humans_win", "Path to \"humans win\" overlay
g_hCvarsList[CVAR_ROUNDEND_OVERLAY_ZOMBIE] = CreateConVar("zr_roundend_overlays_zombie", "overlays/zr/zombies_win", "");
// Old Desc: Path to \"zombies win\" overlay
@ -207,8 +247,8 @@ CvarsInit()
// Infect (core)
// ===========================
g_hCvarsList[CVAR_INFECT_MZOMBIE_RATIO] = CreateConVar("zr_infect_motherzombie_ratio", "5", "");
g_hCvarsList[CVAR_INFECT_MZOMBIE_RESPAWN] = CreateConVar("zr_infect_motherzombie_respawn", "0", "");
g_hCvarsList[CVAR_INFECT_MZOMBIE_RATIO] = CreateConVar("zr_infect_mzombie_ratio", "5", "");
g_hCvarsList[CVAR_INFECT_MZOMBIE_RESPAWN] = CreateConVar("zr_infect_mzombie_respawn", "0", "");
g_hCvarsList[CVAR_INFECT_SPAWNTIME_MIN] = CreateConVar("zr_infect_spawntime_min", "30.0", "");
g_hCvarsList[CVAR_INFECT_SPAWNTIME_MAX] = CreateConVar("zr_infect_spawntime_max", "50.0", "");
g_hCvarsList[CVAR_INFECT_CONSECUTIVE_BLOCK] = CreateConVar("zr_infect_consecutive_block", "1", "");
@ -261,10 +301,28 @@ CvarsInit()
// Visual Effects (module)
// ===========================
g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE] = CreateConVar("zr_veffects_lightstyle", "1", "");
// Lightstyle
g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE] = CreateConVar("zr_veffects_lightstyle", "0", "");
g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE_VALUE] = CreateConVar("zr_veffects_lightstyle_value", "a", "");
// Sky
g_hCvarsList[CVAR_VEFFECTS_SKY] = CreateConVar("zr_veffects_sky", "1", "");
g_hCvarsList[CVAR_VEFFECTS_SKY_PATH] = CreateConVar("zr_veffects_sky_path", "skybox/sky_c17_05bk.vmt", "");
g_hCvarsList[CVAR_VEFFECTS_SKY_PATH] = CreateConVar("zr_veffects_sky_path", "sky_fake_white.vmt", "");
// Fog
g_hCvarsList[CVAR_VEFFECTS_FOG] = CreateConVar("zr_veffects_fog", "0", "");
// NOTE DISABLE. SOURCEMOD DOESNT SUPPORT THIS YET.
g_hCvarsList[CVAR_VEFFECTS_FOG_OVERRIDE] = CreateConVar("zr_veffects_fog_override", "0", "");
// NOTE DISABLE. SOURCEMOD DOESNT SUPPORT THIS YET.
g_hCvarsList[CVAR_VEFFECTS_FOG_PCOLOR] = CreateConVar("zr_veffects_fog_pcolor", "255 255 255", "");
g_hCvarsList[CVAR_VEFFECTS_FOG_SCOLOR] = CreateConVar("zr_veffects_fog_scolor", "255 255 255", "");
g_hCvarsList[CVAR_VEFFECTS_FOG_DENSITY] = CreateConVar("zr_veffects_fog_density", "0.8", "");
g_hCvarsList[CVAR_VEFFECTS_FOG_STARTDIST] = CreateConVar("zr_veffects_fog_startdist", "0", "");
g_hCvarsList[CVAR_VEFFECTS_FOG_ENDDIST] = CreateConVar("zr_veffects_fog_enddist", "400", "");
g_hCvarsList[CVAR_VEFFECTS_FOG_FARZ] = CreateConVar("zr_veffects_fog_farz", "2000", "");
// ===========================
// Sound Effects (module)
@ -371,53 +429,105 @@ CvarsInit()
g_hCvarsList[CVAR_ANTICAMP_UPDATE_INTERVAL] = CreateConVar("zr_anticamp_update_interval", "1", "");
// Old Desc: How often to update player locations (in seconds).
// TODO: Recode.
//HookConVarChange(g_hCvarsList[CVAR_ENABLE], EnableHook);
// Auto-generate config file if it doesn't exist, then execute.
AutoExecConfig(true, "zombiereloaded", "sourcemod/zombiereloaded");
}
CvarsHook()
/**
* Hook cvar changes.
*
* @param unhook If true, cvars will be unhooked, false to hook cvars.
*/
CvarsHook(bool:unhook = false)
{
SetConVarBool(FindConVar("mp_autoteambalance"), false);
SetConVarInt(FindConVar("mp_limitteams"), 0);
// If unhook is true, then continue.
if (unhook)
{
// Unhook all cvars.
UnhookConVarChange(g_hAutoTeamBalance, CvarsHookLocked);
UnhookConVarChange(g_hLimitTeams, CvarsHookLocked);
UnhookConVarChange(g_hRestartGame, CvarsHookRestartGame);
HookConVarChange(FindConVar("mp_autoteambalance"), AutoTeamBalanceHook);
HookConVarChange(FindConVar("mp_limitteams"), LimitTeamsHook);
// Stop after unhooking cvars.
return;
}
// Set locked cvars to their locked value.
SetConVarInt(g_hAutoTeamBalance, CVARS_AUTOTEAMBALANCE_LOCKED);
SetConVarInt(g_hLimitTeams, CVARS_LIMITTEAMS_LOCKED);
// Hook cvar to prevent it from changing.
HookConVarChange(g_hAutoTeamBalance, CvarsHookLocked);
//HookConVarChange(hLimitTeams, CvarsHookLocked);
HookConVarChange(g_hRestartGame, CvarsHookRestartGame);
// Anticamp shtuff. (needs to be moved to anticamp if these hooks are necessary)
HookConVarChange(g_hCvarsList[CVAR_ANTICAMP], AnticampHook);
HookConVarChange(g_hCvarsList[CVAR_ANTICAMP_UPDATE_INTERVAL], UpdateIntervalHook);
}
CvarsUnhook()
/**
* Cvar hook callback (mp_autoteambalance, mp_limitteams)
* Prevents changes to cvar.
*
* @param convar The cvar handle.
* @param oldvalue The value before the attempted change.
* @param newvalue The new value.
*/
public CvarsHookLocked(Handle:cvar, const String:oldvalue[], const String:newvalue[])
{
UnhookConVarChange(FindConVar("mp_autoteambalance"), AutoTeamBalanceHook);
UnhookConVarChange(FindConVar("mp_limitteams"), LimitTeamsHook);
}
/*public EnableHook(Handle:convar, const String:oldValue[], const String:newValue[])
{
new bool:enable = bool:StringToInt(newValue);
if (enable)
// If cvar is mp_autoteambalance, then continue.
if (cvar == g_hAutoTeamBalance)
{
HookEvents();
HookCvars();
// Revert to locked value.
SetConVarInt(g_hAutoTeamBalance, CVARS_AUTOTEAMBALANCE_LOCKED);
TerminateRound(3.0, Game_Commencing);
}
else
// If log flag check fails, then don't log.
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE))
{
ZREnd();
LogMessageFormatted(-1, "Cvars", "Cvar Locked", "Cvar \"mp_autoteambalance\" was reverted back to \"CVARS_AUTOTEAMBALANCE_LOCKED\".", LOG_FORMAT_TYPE_FULL);
}
}*/
}
// If cvar is mp_limitteams, then continue.
else if (cvar == g_hLimitTeams)
{
// Revert to locked value.
SetConVarInt(g_hLimitTeams, CVARS_LIMITTEAMS_LOCKED);
public AutoTeamBalanceHook(Handle:convar, const String:oldValue[], const String:newValue[])
{
SetConVarBool(FindConVar("mp_autoteambalance"), false);
// If log flag check fails, then don't log.
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE))
{
LogMessageFormatted(-1, "Cvars", "Cvar Locked", "Cvar \"mp_limitteams\" was reverted back to \"CVARS_LIMITTEAMS_LOCKED\".", LOG_FORMAT_TYPE_FULL);
}
}
}
public LimitTeamsHook(Handle:convar, const String:oldValue[], const String:newValue[])
/**
* Cvar hook callback (mp_restartgame)
* Stops restart and just ends the round.
*
* @param convar The cvar handle.
* @param oldvalue The value before the attempted change.
* @param newvalue The new value.
*/
public CvarsHookRestartGame(Handle:cvar, const String:oldvalue[], const String:newvalue[])
{
SetConVarInt(FindConVar("mp_limitteams"), 0);
// Prevent round restart.
SetConVarInt(cvar, 0);
// If value was invalid or 0, then stop.
new Float:delay = StringToFloat(newvalue);
if (delay <= 0)
{
return;
}
// Terminate the round with restart time as delay.
RoundEndRestart(delay);
// If log flag check fails, then don't log.
if (LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_CORE))
{
LogMessageFormatted(-1, "Cvars", "Restart Game", "\"mp_restartgame\" was caught and blocked, commencing round.", LOG_FORMAT_TYPE_FULL);
}
}

View File

@ -1,38 +1,69 @@
/**
* ====================
/*
* ============================================================================
*
* Zombie:Reloaded
* File: events.inc
* Author: Greyscale
* ====================
*
* File: (Core) event.inc
* Description: Event hooking and forwarding.
*
* ============================================================================
*/
HookEvents()
/**
* Init function for event module.
*/
EventInit()
{
HookEvent("round_start", RoundStart);
HookEvent("round_freeze_end", RoundFreezeEnd);
HookEvent("round_end", RoundEnd);
HookEvent("player_team", PlayerTeam, EventHookMode_Pre);
HookEvent("player_spawn", PlayerSpawn);
HookEvent("player_hurt", PlayerHurt);
HookEvent("player_death", PlayerDeath);
HookEvent("player_jump", PlayerJump);
HookEvent("weapon_fire", WeaponFire);
// Hook all events used by plugin.
EventHook();
}
UnhookEvents()
/**
* Hook events used by plugin.
*
* @param unhook If true, then unhook all events, if false, then hook.
*/
EventHook(bool:unhook = false)
{
UnhookEvent("round_start", RoundStart);
UnhookEvent("round_freeze_end", RoundFreezeEnd);
UnhookEvent("round_end", RoundEnd);
UnhookEvent("player_team", PlayerTeam, EventHookMode_Pre);
UnhookEvent("player_spawn", PlayerSpawn);
UnhookEvent("player_hurt", PlayerHurt);
UnhookEvent("player_death", PlayerDeath);
UnhookEvent("player_jump", PlayerJump);
UnhookEvent("weapon_fire", WeaponFire);
// If unhook is true, then continue.
if (unhook)
{
// Unhook all events.
UnhookEvent("round_start", EventRoundStart);
UnhookEvent("round_freeze_end", EventRoundFreezeEnd);
UnhookEvent("round_end", EventRoundEnd);
UnhookEvent("player_team", EventPlayerTeam, EventHookMode_Pre);
UnhookEvent("player_spawn", EventPlayerSpawn);
UnhookEvent("player_hurt", EventPlayerHurt);
UnhookEvent("player_death", EventPlayerDeath);
UnhookEvent("player_jump", EventPlayerJump);
UnhookEvent("weapon_fire", EventWeaponFire);
// Stop after unhooking events.
return;
}
// Hook all events used by plugin.
HookEvent("round_start", EventRoundStart);
HookEvent("round_freeze_end", EventRoundFreezeEnd);
HookEvent("round_end", EventRoundEnd);
HookEvent("player_team", EventPlayerTeam, EventHookMode_Pre);
HookEvent("player_spawn", EventPlayerSpawn);
HookEvent("player_hurt", EventPlayerHurt);
HookEvent("player_death", EventPlayerDeath);
HookEvent("player_jump", EventPlayerJump);
HookEvent("weapon_fire", EventWeaponFire);
}
public Action:RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
/**
* Event callback (round_start)
* The round is starting.
*
* @param event The event handle.
* @param name Name of the event.
* @dontBroadcast If true, event is broadcasted to all clients, false if not.
*/
public Action:EventRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
ZR_PrintToChat(0, "Round objective");
@ -44,7 +75,15 @@ public Action:RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
AntiStickOnRoundStart();
}
public Action:RoundFreezeEnd(Handle:event, const String:name[], bool:dontBroadcast)
/**
* Event callback (round_freeze_end)
* The freeze time is ending.
*
* @param event The event handle.
* @param name Name of the event.
* @dontBroadcast If true, event is broadcasted to all clients, false if not.
*/
public Action:EventRoundFreezeEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
RemoveObjectives();
@ -55,7 +94,15 @@ public Action:RoundFreezeEnd(Handle:event, const String:name[], bool:dontBroadca
}
public Action:RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
/**
* Event callback (round_end)
* The round is ending.
*
* @param event The event handle.
* @param name Name of the event.
* @dontBroadcast If true, event is broadcasted to all clients, false if not.
*/
public Action:EventRoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
// Get all required event info.
new reason = GetEventInt(event, "reason");
@ -63,10 +110,19 @@ public Action:RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
// Forward event to modules.
RoundEndOnRoundEnd(reason);
InfectOnRoundEnd();
RespawnOnRoundEnd();
ZTeleReset();
}
public Action:PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
/**
* Event callback (player_team)
* Client is joining a team.
*
* @param event The event handle.
* @param name Name of the event.
* @dontBroadcast If true, event is broadcasted to all clients, false if not.
*/
public Action:EventPlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
// Get all required event info.
new index = GetClientOfUserId(GetEventInt(event, "userid"));
@ -78,14 +134,19 @@ public Action:PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
return Plugin_Handled;
}
public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
/**
* Event callback (player_spawn)
* Client is spawning into the game.
*
* @param event The event handle.
* @param name Name of the event.
* @dontBroadcast If true, event is broadcasted to all clients, false if not.
*/
public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
// Get all required event info.
new index = GetClientOfUserId(GetEventInt(event, "userid"));
// Call post player_spawn
CreateTimer(0.0, PlayerSpawnPost, index);
// Reset FOV and overlay.
SetPlayerFOV(index, 90);
ClientCommand(index, "r_screenoverlay \"\"");
@ -124,13 +185,15 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
ZR_PrintToChat(index, "!zmenu reminder");
}
public Action:PlayerSpawnPost(Handle:timer, any:client)
{
// Forward event to modules.
SEffectsOnClientSpawnPost(client);
}
public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
/**
* Event callback (player_hurt)
* Client is being hurt.
*
* @param event The event handle.
* @param name Name of the event.
* @dontBroadcast If true, event is broadcasted to all clients, false if not.
*/
public Action:EventPlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{
// Get all required event info.
new index = GetClientOfUserId(GetEventInt(event, "userid"));
@ -138,7 +201,7 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
new hitgroup = GetEventInt(event, "hitgroup");
new dmg_health = GetEventInt(event, "dmg_health");
decl String:weapon[32];
decl String:weapon[WEAPONS_MAX_LENGTH];
GetEventString(event, "weapon", weapon, sizeof(weapon));
// Forward event to modules.
@ -150,10 +213,18 @@ public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
ZHPOnClientHurt(index);
}
public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
/**
* Event callback (player_death)
* Client has been killed.
*
* @param event The event handle.
* @param name Name of the event.
* @dontBroadcast If true, event is broadcasted to all clients, false if not.
*/
public Action:EventPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
// Get the weapon name.
decl String:weapon[32];
decl String:weapon[WEAPONS_MAX_LENGTH];
GetEventString(event, "weapon", weapon, sizeof(weapon));
// If client is being infected, then stop.
@ -190,7 +261,15 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
ZHPOnClientDeath(index);
}
public Action:PlayerJump(Handle:event, const String:name[], bool:dontBroadcast)
/**
* Event callback (player_jump)
* Client is jumping.
*
* @param event The event handle.
* @param name Name of the event.
* @dontBroadcast If true, event is broadcasted to all clients, false if not.
*/
public Action:EventPlayerJump(Handle:event, const String:name[], bool:dontBroadcast)
{
// Get all required event info.
new client = GetClientOfUserId(GetEventInt(event, "userid"));
@ -201,7 +280,15 @@ public Action:PlayerJump(Handle:event, const String:name[], bool:dontBroadcast)
JumpBoost(client, distance, height);
}
public Action:WeaponFire(Handle:event, const String:name[], bool:dontBroadcast)
/**
* Event callback (weapon_fire)
* Weapon has been fired.
*
* @param event The event handle.
* @param name Name of the event.
* @dontBroadcast If true, event is broadcasted to all clients, false if not.
*/
public Action:EventWeaponFire(Handle:event, const String:name[], bool:dontBroadcast)
{
// Get all required event info.
decl String:weapon[32];

View File

@ -82,7 +82,7 @@ HitgroupsLoad()
*/
HitgroupsValidateConfig()
{
// If log flag check fails, don't log.
// If log flag check fails, then don't log.
if (!LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_HITGROUPS))
{
return;

View File

@ -270,19 +270,6 @@ InfectOnRoundStart()
// Reset timer handle.
tInfect = INVALID_HANDLE;
}
// x = client index.
for (new x = 1; x <= MaxClients; x++)
{
// If client isn't in-game, then stop.
if (!IsClientInGame(x))
{
continue;
}
// Disable zombie flag on client.
bZombie[x] = false;
}
}
/**
@ -437,7 +424,7 @@ public Action:InfectMotherZombie(Handle:timer)
ZRCountValidClients(zombiecount, humancount, _, true);
// Calculate mother zombie count.
new mothercount = RoundToCeil(float(humancount) / ratio);
new mothercount = RoundToNearest(float(humancount) / ratio);
// x = current mother zombie count.
for (new x = 0; x < mothercount; x++)
@ -559,16 +546,10 @@ InfectClient(client, attacker = -1, bool:motherinfect = false)
// Forward event to modules.
ClassOnClientInfected(client, motherinfect);
RoundEndOnClientInfected();
SEffectsOnClientInfected(client);
ZHPOnClientInfected(client);
TeleportOnClientInfected(client);
// Terminate the round if the last player was infected.
new RoundEndOutcome:outcome;
if (RoundEndGetRoundStatus(outcome))
{
RoundEndTerminateRound(outcome);
}
}
/**
@ -578,7 +559,7 @@ InfectClient(client, attacker = -1, bool:motherinfect = false)
*/
InfectFireEffects(client)
{
// Create location and direction arrays.
// Initialize vector variables.
new Float:clientloc[3];
new Float:direction[3] = {0.0, 0.0, 0.0};
@ -586,31 +567,25 @@ InfectFireEffects(client)
GetClientAbsOrigin(client, clientloc);
clientloc[2] += 30;
// Get infection sound.
// If cvar contains path, then continue.
decl String:sound[PLATFORM_MAX_PATH];
GetConVarString(g_hCvarsList[CVAR_INFECT_SOUND], sound, sizeof(sound));
if (sound[0])
{
// Emit infect sound from infected client.
SEffectsEmitSoundFromClient(client, sound, SNDLEVEL_SCREAMING);
}
// Create an energy splash effect.
// If energy splash effect is enabled, then continue.
new bool:esplash = GetConVarBool(g_hCvarsList[CVAR_INFECT_ESPLASH]);
if (esplash)
{
TE_SetupEnergySplash(clientloc, direction, true);
TE_SendToAll();
// Create energy splash effect.
VEffectsCreateEnergySplash(clientloc, direction, true);
}
// Create an explosion entity.
new explosion = CreateEntityByName("env_explosion");
// If explosion entity is valid, then continue.
if (explosion != -1)
{
// Get and set flags on explosion.
new flags = GetEntProp(explosion, Prop_Data, "m_spawnflags");
flags = flags | EXP_NODAMAGE | EXP_NODECAL;
// Initialize explosion flags variable.
new flags;
// Set "nofireball" flag if fireball is disabled.
new bool:fireball = GetConVarBool(g_hCvarsList[CVAR_INFECT_FIREBALL]);
@ -633,40 +608,20 @@ InfectFireEffects(client)
flags = flags | EXP_NOSPARKS;
}
// Set new flags on entity.
SetEntProp(explosion, Prop_Data, "m_spawnflags", flags);
// Spawn the entity into the world.
DispatchSpawn(explosion);
// Precache fireball model.
PrecacheModel("materials/sprites/xfireball3.vmt");
// Set origin and explosion key values on entity.
DispatchKeyValueVector(explosion, "origin", clientloc);
DispatchKeyValue(explosion, "fireballsprite", "materials/sprites/xfireball3.vmt");
// Tell the entity to explode.
AcceptEntityInput(explosion, "Explode");
}
// Create explosion at client's origin.
VEffectsCreateExplosion(clientloc, flags);
// If shake effect is enabled, then continue.
new bool:shake = GetConVarBool(g_hCvarsList[CVAR_INFECT_SHAKE]);
if (shake)
{
// If shake usermsg isn't invalid, then continue.
new Handle:hShake = StartMessageOne("Shake", client);
if (hShake != INVALID_HANDLE)
{
// Write shake information to usermsg handle.
BfWriteByte(hShake, 0);
BfWriteFloat(hShake, GetConVarFloat(g_hCvarsList[CVAR_INFECT_SHAKE_AMP]));
BfWriteFloat(hShake, GetConVarFloat(g_hCvarsList[CVAR_INFECT_SHAKE_FREQUENCY]));
BfWriteFloat(hShake, GetConVarFloat(g_hCvarsList[CVAR_INFECT_SHAKE_DURATION]));
// Get shake info.
new Float:shakeamp = GetConVarFloat(g_hCvarsList[CVAR_INFECT_SHAKE_AMP]);
new Float:shakefrequency = GetConVarFloat(g_hCvarsList[CVAR_INFECT_SHAKE_FREQUENCY]);
new Float:shakeduration = GetConVarFloat(g_hCvarsList[CVAR_INFECT_SHAKE_DURATION]);
// End usermsg and sent to client.
EndMessage();
}
// Shake client's screen.
VEffectsShakeClientScreen(client, shakeamp, shakefrequency, shakeduration);
}
}

View File

@ -58,6 +58,23 @@
* @endsection
*/
/**
* @section Global handles for modules cvars.
*/
new Handle:g_hLog = INVALID_HANDLE;
new Handle:g_hLogFlags = INVALID_HANDLE;
/**
* @endsection
*/
LogInit()
{
// Create modules cvars.
g_hLog = CreateConVar("zr_log", "1", "");
g_hLogFlags = CreateConVar("zr_logflags", "331", "");
// Old Desc: Logging flags. Log messages to sourcemod logs, server console or client console. Use zr_log_flags to see a list of flags. (0: Disable)
}
/**
* Logs a formatted message with module and block info depending, on the type.
*
@ -75,39 +92,45 @@
LogMessageFormatted(client, const String:module[], const String:block[], const String:message[], type = LOG_FORMAT_TYPE_FULL, any:...)
{
// If logging is disabled, then stop.
new bool:log = GetConVarBool(g_hCvarsList[CVAR_LOG]);
new bool:log = GetConVarBool(g_hLog);
if (!log)
{
return;
}
decl String:buffer[LOG_MAX_LENGTH_FILE];
decl String:text[LOG_MAX_LENGTH_FILE];
decl String:logtext[LOG_MAX_LENGTH_FILE];
if (client == 0 && LogCheckFlag(LOG_IGNORE_CONSOLE))
// Set to true if log to console, false if client.
new bool:console = !ZRIsClientValid(client);
// If client is invalid (console), and console is ignored, then stop.
if (console && LogCheckFlag(LOG_IGNORE_CONSOLE))
{
return;
}
// Format log text.
VFormat(logtext, sizeof(logtext), message, 6);
// Format other parameters onto the log text.
switch (type)
{
// Log type is simple.
case LOG_FORMAT_TYPE_SIMPLE:
{
VFormat(buffer, sizeof(buffer), message, 6);
Format(text, sizeof(text), "%s", message);
LogMessage(text);
LogMessage(logtext);
}
// Log type is full.
case LOG_FORMAT_TYPE_FULL:
{
VFormat(buffer, sizeof(buffer), message, 6);
Format(text, sizeof(text), "\"%s\" : \"%s\" -- %s", module, block, buffer);
LogMessage(text);
Format(logtext, sizeof(logtext), "\"%s\" : \"%s\" -- %s", module, block, logtext);
LogMessage(logtext);
}
// Log type is error.
case LOG_FORMAT_TYPE_ERROR:
{
VFormat(buffer, sizeof(buffer), message, 6);
Format(text, sizeof(text), "\"%s\" : \"%s\" -- %s", module, block, buffer);
LogError(text);
Format(logtext, sizeof(logtext), "\"%s\" : \"%s\" -- %s", module, block, logtext);
LogError(logtext);
}
}
@ -115,16 +138,17 @@ LogMessageFormatted(client, const String:module[], const String:block[], const S
if (LogCheckFlag(LOG_TO_ADMINS))
{
// Print text to admins.
LogToAdmins(text);
LogToAdmins(logtext);
}
if (ZRIsClientValid(client) && LogCheckFlag(LOG_TO_CLIENT))
// If client isn't console, and we log to client's then continue.
if (!console && LogCheckFlag(LOG_TO_CLIENT))
{
// Set client as translation target.
SetGlobalTransTarget(client);
// Print to client.
PrintToConsole(client, "%t %s", "ZR", text);
PrintToConsole(client, "%t %s", "ZR", logtext);
}
}
@ -164,7 +188,7 @@ LogToAdmins(String:message[])
bool:LogHasFlag(flag)
{
// Get log flags.
new logflags = GetConVarInt(g_hCvarsList[CVAR_LOGFLAGS]);
new logflags = GetConVarInt(g_hLogFlags);
// Return true if flag is found, false if not.
return bool:(logflags & flag);
@ -175,7 +199,7 @@ bool:LogHasFlag(flag)
* overrides are enabled only logs with it's module flag set will be logged.
*
* @param logtype Log type flag.
* @param module Specifies what module the log event belongs to.
* @param modulefilter Specifies what module the log event belongs to.
* @return True if the event should be logged, false otherwise.
*/
bool:LogCheckFlag(logtype, modulefilter = 0)
@ -187,3 +211,28 @@ bool:LogCheckFlag(logtype, modulefilter = 0)
return LogHasFlag(logtype);
}
/**
* Toggles a log flag.
*
* @param flag The flag to toggle.
*/
LogToggleFlag(flag)
{
// Get current flags
new logflags = GetConVarInt(g_hLogFlags);
// If cvar contains flag, then remove it.
if (logflags & flag)
{
logflags = logflags - flag;
}
// If cvar doesn't have the flag, then add it.
else
{
logflags = logflags + flag;
}
// Set new value to logflags cvar.
SetConVarInt(g_hLogFlags, logflags);
}

View File

@ -17,7 +17,7 @@ new Handle:tRespawn[MAXPLAYERS + 1];
/**
* Array for flagging zombies who were killed by world.
*/
new bool:pKilledByWorld[MAXPLAYERS + 1];
new bool:bKilledByWorld[MAXPLAYERS + 1];
/**
* Client is joining the server.
@ -27,8 +27,8 @@ RespawnClientInit(client)
// Reset timer handle.
tRespawn[client] = INVALID_HANDLE;
// Init pKilledByWorld for client.
pKilledByWorld[client] = false;
// Init bKilledByWorld for client.
bKilledByWorld[client] = false;
}
/**
@ -58,8 +58,8 @@ RespawnOnClientDeath(client, attacker, const String:weapon[])
// If client is a zombie, check if they were killed by world.
if (InfectIsClientInfected(client))
{
// Set pKilledByWorld to true if attacker is not a valid client.
pKilledByWorld[client] = !ZRIsClientValid(attacker);
// Set bKilledByWorld to true if attacker is not a valid client.
bKilledByWorld[client] = !ZRIsClientValid(attacker);
}
// If timer is running, kill it.
@ -86,6 +86,34 @@ RespawnOnClientDeath(client, attacker, const String:weapon[])
tRespawn[client] = CreateTimer(delay, RespawnTimer, client, TIMER_FLAG_NO_MAPCHANGE);
}
/**
* The round is ending.
*/
RespawnOnRoundEnd()
{
// x = client index.
for (new x = 1; x <= MaxClients; x++)
{
// If client isn't in-game, then stop.
if (!IsClientInGame(x))
{
continue;
}
// If timer isn't currently running, then stop.
if (tRespawn[x] == INVALID_HANDLE)
{
continue;
}
// Stop timer.
KillTimer(tRespawn[x]);
// Reset timer handle.
tRespawn[x] = INVALID_HANDLE;
}
}
/**
* Returns if a player is to be respawned as a zombie, because they were killed by world.
*
@ -95,7 +123,7 @@ RespawnOnClientDeath(client, attacker, const String:weapon[])
RespawnKilledByWorld(client)
{
// Return true if both the cvar is enabled and the player was killed by world.
return (GetConVarBool(g_hCvarsList[CVAR_RESPAWN_ZOMBIE_WORLD]) && pKilledByWorld[client]);
return (GetConVarBool(g_hCvarsList[CVAR_RESPAWN_ZOMBIE_WORLD]) && bKilledByWorld[client]);
}
/**
@ -130,10 +158,10 @@ RespawnSpawnClient(client)
return;
}
if (GetConVarBool(g_hCvarsList[CVAR_RESPAWN_ZOMBIE_WORLD]) && pKilledByWorld[client])
if (GetConVarBool(g_hCvarsList[CVAR_RESPAWN_ZOMBIE_WORLD]) && bKilledByWorld[client])
{
InfectClient(client);
pKilledByWorld[client] = false;
bKilledByWorld[client] = false;
}
}

View File

@ -84,10 +84,21 @@ RoundEndClientInit(client)
/**
* Client has been killed.
*
* @param client The client index.
*/
RoundEndOnClientDeath()
{
// Terminate the round if the last player was killed.
new RoundEndOutcome:outcome;
if (RoundEndGetRoundStatus(outcome))
{
RoundEndTerminateRound(outcome);
}
}
/**
* Client has been infected.
*/
RoundEndOnClientInfected()
{
// Terminate the round if the last player was infected.
new RoundEndOutcome:outcome;
@ -111,12 +122,6 @@ RoundEndOnRoundStart()
// Reset timer handle.
tRoundEnd = INVALID_HANDLE;
}
// Tell plugin no zombies have been spawned.
g_bZombieSpawned = false;
// Balance teams, and respawn all players.
RoundEndBalanceTeams(true);
}
/**
@ -331,12 +336,23 @@ RoundEndTerminateRound(RoundEndOutcome:outcome)
}
}
/**
* Restarts the game.
*
* @param delay How long to wait between round end and new round.
*/
RoundEndRestart(Float:delay)
{
// Terminate the round.
TerminateRound(delay, ROUNDEND_GAME_COMMENCING);
}
/**
* Balances teams
*
* @param spawn If true, it will respawn player after switching their team.
*/
RoundEndBalanceTeams(bool:spawn = false)
RoundEndBalanceTeams()
{
// Create eligible player list.
new Handle:arrayEligibleClients = INVALID_HANDLE;
@ -376,29 +392,6 @@ RoundEndBalanceTeams(bool:spawn = false)
CS_SwitchTeam(client, CS_TEAM_CT);
}
// If spawn is false, then stop.
if (!spawn)
{
return;
}
// x = array index.
// client = client index.
for (new x = 0; x < eligibleclients; x++)
{
// Get client stored in array index.
client = GetArrayCell(arrayEligibleClients, x);
// If client is dead, then stop.
if (!IsPlayerAlive(client))
{
continue;
}
// Respawn client.
CS_RespawnPlayer(client);
}
// Destroy handle.
CloseHandle(arrayEligibleClients);
}

View File

@ -122,7 +122,7 @@ AmbientSoundsOnRoundStart()
*
* @param client The client index.
*/
AmbientSoundsOnClientSpawnPost(client)
AmbientSoundsOnClientSpawn(client)
{
// If ambience is disabled, then stop.
if (!g_bAmbientSounds)

View File

@ -69,20 +69,10 @@ SEffectsOnRoundStart()
SEffectsOnClientSpawn(client)
{
// Forward event to sub-modules.
//AmbientSoundsOnClientSpawn(client);
AmbientSoundsOnClientSpawn(client);
ZombieSoundsOnClientSpawn(client);
}
/**
* Fired one frame after client spawns into the game.
*
* @param client The client index.
*/
SEffectsOnClientSpawnPost(client)
{
AmbientSoundsOnClientSpawnPost(client);
}
/**
* Client has been killed.
*

View File

@ -36,7 +36,19 @@ VEffectsLoad()
// Store map's default sky before applying new one.
GetConVarString(g_hSkyname, g_VEffectsDefaultSky, sizeof(g_VEffectsDefaultSky));
// TODO add sky to downloads table.
// If sky path is empty, then stop.
if (!g_VEffectsDefaultSky[0])
{
return;
}
decl String:downloadpath[PLATFORM_MAX_PATH];
// Prepend materials/skybox to the path.
Format(downloadpath, sizeof(downloadpath), "materials/skybox/%s", g_VEffectsDefaultSky);
// Add skybox file to downloads table.
AddFileToDownloadsTable(downloadpath);
}
/**
@ -55,6 +67,12 @@ VEffectsOnRoundStart()
// Apply new sky.
VEffectsApplySky(!sky);
// If fog is disabled, then disable.
new bool:fogoverride = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_FOG_OVERRIDE]);
// Apply fog.
VEffectsApplyFog(fogoverride);
}
VEffectsApplyLightStyle(bool:disable = false)
@ -94,3 +112,218 @@ VEffectsApplySky(bool:disable = false)
// Set new sky on all clients.
SetConVarString(g_hSkyname, skypath, true);
}
VEffectsApplyFog(bool:override = false)
{
// Find current fog index
new fogindex = FindEntityByClassname(-1, "env_fog_controller");
// If override is enabled, then continue.
if (override)
{
// If there is fog, then continue.
if (fogindex != -1)
{
// Delete fog.
RemoveEdict(fogindex);
}
}
// If fog is disabled, then stop.
new bool:fog = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_FOG]);
if (!fog)
{
return;
}
// If there is no fog on the map, create new fog.
if (fogindex == -1)
{
// Create and spawn fog.
fogindex = CreateEntityByName("env_fog_controller");
DispatchSpawn(fogindex);
}
decl String:fogcolor[16];
// Set primary fog color.
GetConVarString(g_hCvarsList[CVAR_VEFFECTS_FOG_PCOLOR], fogcolor, sizeof(fogcolor));
VEffectsSetFogColor(fogindex, fogcolor, true);
// Set secondary fog color.
GetConVarString(g_hCvarsList[CVAR_VEFFECTS_FOG_SCOLOR], fogcolor, sizeof(fogcolor));
VEffectsSetFogColor(fogindex, fogcolor, false);
// Set fog's density.
new Float:fogdensity = GetConVarFloat(g_hCvarsList[CVAR_VEFFECTS_FOG_DENSITY]);
VEffectsSetFogDensity(fogindex, fogdensity);
// Set fog's start distance.
new fogstart = GetConVarInt(g_hCvarsList[CVAR_VEFFECTS_FOG_STARTDIST]);
VEffectsSetFogStartDist(fogindex, fogstart);
// Set fog's end distance.
new fogend = GetConVarInt(g_hCvarsList[CVAR_VEFFECTS_FOG_ENDDIST]);
VEffectsSetFogEndDist(fogindex, fogend);
// Set fog's far z distance.
new fogfarz = GetConVarInt(g_hCvarsList[CVAR_VEFFECTS_FOG_FARZ]);
VEffectsSetFogFarZ(fogindex, fogfarz);
}
/**
* Set fog's primary or secondary color.
*
* @param fogindex Edict index of the fog to modify.
* @param color The rgb color of the fog.
* @param primary (Optional) True to set primary, false otherwise.
*/
VEffectsSetFogColor(fogindex, const String:color[], bool:primary = true)
{
// Set primary color.
if (primary)
{
// Set new color.
SetVariantString(color);
AcceptEntityInput(fogindex, "SetColor");
}
// Set secondary color.
else
{
// Set new color.
SetVariantString(color);
AcceptEntityInput(fogindex, "SetColorSecondary");
}
}
/**
* Set fog's density.
*
* @param fogindex Edict index of the fog to modify.
* @param density The density of the fog.
*/
VEffectsSetFogDensity(fogindex, Float:density)
{
// Set density.
DispatchKeyValueFloat(fogindex, "fogmaxdensity", density);
}
/**
* Set fog's start distance.
*
* @param fogindex Edict index of the fog to modify.
* @param startdist The start distance of the fog.
*/
VEffectsSetFogStartDist(fogindex, startdist)
{
// Set start distance.
SetVariantInt(startdist);
AcceptEntityInput(fogindex, "SetStartDist");
}
/**
* Set fog's end distance.
*
* @param fogindex Edict index of the fog to modify.
* @param enddist The end distance of the fog.
*/
VEffectsSetFogEndDist(fogindex, enddist)
{
// Set end distance.
SetVariantInt(enddist);
AcceptEntityInput(fogindex, "SetEndDist");
}
/**
* Set fog's far z distance.
*
* @param fogindex Edict index of the fog to modify.
* @param farz The far z distance of the fog.
*/
VEffectsSetFogFarZ(fogindex, farz)
{
// Set far z distance.
SetVariantInt(farz);
AcceptEntityInput(fogindex, "SetFarZ");
}
/**
* Create an energy splash effect.
*
* @param client The client index.
* @param origin The origin of the effect.
* @param direction The direction of the effect.
*/
VEffectsCreateEnergySplash(const Float:origin[3], const Float:direction[3], bool:explosive)
{
TE_SetupEnergySplash(origin, direction, explosive);
TE_SendToAll();
}
/**
* Create an explosion effect with strict flags.
*
* @param origin The (x, y, z) coordinate of the explosion.
* @param flags The flags to set on the explosion.
*/
VEffectsCreateExplosion(const Float:origin[3], flags)
{
// Create an explosion entity.
new explosion = CreateEntityByName("env_explosion");
// If explosion entity isn't valid, then stop.
if (explosion == -1)
{
return;
}
// Get and modify flags on explosion.
new spawnflags = GetEntProp(explosion, Prop_Data, "m_spawnflags");
spawnflags = spawnflags | EXP_NODAMAGE | EXP_NODECAL | flags;
// Set modified flags on entity.
SetEntProp(explosion, Prop_Data, "m_spawnflags", spawnflags);
// Spawn the entity into the world.
DispatchSpawn(explosion);
// Set the origin of the explosion.
DispatchKeyValueVector(explosion, "origin", origin);
// Set fireball material.
PrecacheModel("materials/sprites/xfireball3.vmt");
DispatchKeyValue(explosion, "fireballsprite", "materials/sprites/xfireball3.vmt");
// Tell the entity to explode.
AcceptEntityInput(explosion, "Explode");
// Remove entity from world.
RemoveEdict(explosion);
}
/**
* Shake a client's screen with specific parameters.
*
* @param client The client index.
* @param amplitude The amplitude (intensity) of the shaking.
* @param frequency The frequency (speed) of the shaking.
* @param duration The duration (time) of the shaking.
*/
VEffectsShakeClientScreen(client, Float:amplitude, Float:frequency, Float:duration)
{
// If shake usermsg isn't invalid, then stop.
new Handle:hShake = StartMessageOne("Shake", client);
if (hShake == INVALID_HANDLE)
{
return;
}
// Write shake information to usermsg handle.
BfWriteByte(hShake, 0);
BfWriteFloat(hShake, amplitude);
BfWriteFloat(hShake, frequency);
BfWriteFloat(hShake, duration);
// End usermsg and send to client.
EndMessage();
}

View File

@ -42,7 +42,9 @@ RestrictInit()
gRestrictedWeapons = CreateArray(32, 0);
// Hook buy command.
RegConsoleCmd("buy", RestrictBuyHook);
RegConsoleCmd("buy", RestrictBuyCommand);
RegConsoleCmd("autobuy", RestrictBuyCommand);
RegConsoleCmd("rebuy", RestrictBuyCommand);
}
/**
@ -136,7 +138,7 @@ RestrictDefaultRestrictions()
*/
RestrictValidateWeaponGroups()
{
// If log flag check fails, don't log.
// If log flag check fails, then don't log.
if (!LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
{
return;
@ -215,17 +217,18 @@ RestrictOnClientDisconnect(client)
* @param client The client index.
* @param argc Argument count.
*/
public Action:RestrictBuyHook(client, argc)
public Action:RestrictBuyCommand(client, argc)
{
// If plugin is disabled then stop.
new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
/*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 player is a zombie, then block command.
if (InfectIsClientInfected(client))
{
ZR_PrintToChat(client, "Zombie cant use weapon");

View File

@ -108,7 +108,7 @@ WeaponsLoad()
*/
WeaponsValidateConfig()
{
// If log flag check fails, don't log.
// If log flag check fails, then don't log.
if (!LogCheckFlag(LOG_CORE_EVENTS, LOG_MODULE_WEAPONS))
{
return;

View File

@ -583,112 +583,112 @@ public ZRLogFlagsMenuHandle(Handle:menu_log_flags, MenuAction:action, client, sl
{
case 0:
{
ToggleLogFlag(LOG_CORE_EVENTS);
LogToggleFlag(LOG_CORE_EVENTS);
ZRLogFlagsMenu(client);
}
case 1:
{
ToggleLogFlag(LOG_GAME_EVENTS);
LogToggleFlag(LOG_GAME_EVENTS);
ZRLogFlagsMenu(client);
}
case 2:
{
ToggleLogFlag(LOG_PLAYER_COMMANDS);
LogToggleFlag(LOG_PLAYER_COMMANDS);
ZRLogFlagsMenu(client);
}
case 3:
{
ToggleLogFlag(LOG_DEBUG);
LogToggleFlag(LOG_DEBUG);
ZRLogFlagsMenu(client);
}
case 4:
{
ToggleLogFlag(LOG_DEBUG_DETAIL);
LogToggleFlag(LOG_DEBUG_DETAIL);
ZRLogFlagsMenu(client);
}
case 5:
{
ToggleLogFlag(LOG_DEBUG_MAX_DETAIL);
LogToggleFlag(LOG_DEBUG_MAX_DETAIL);
ZRLogFlagsMenu(client);
}
case 6:
{
ToggleLogFlag(LOG_TO_ADMINS);
LogToggleFlag(LOG_TO_ADMINS);
ZRLogFlagsMenu(client);
}
case 7:
{
ToggleLogFlag(LOG_TO_CLIENT);
LogToggleFlag(LOG_TO_CLIENT);
ZRLogFlagsMenu(client);
}
case 8:
{
ToggleLogFlag(LOG_IGNORE_CONSOLE);
LogToggleFlag(LOG_IGNORE_CONSOLE);
ZRLogFlagsMenu(client);
}
case 9:
{
ToggleLogFlag(LOG_MODULES_ENABLED);
LogToggleFlag(LOG_MODULES_ENABLED);
ZRLogFlagsMenu(client);
}
case 10:
{
ToggleLogFlag(LOG_MODULE_ZOMBIE);
LogToggleFlag(LOG_MODULE_ZOMBIE);
ZRLogFlagsMenu(client);
}
case 11:
{
ToggleLogFlag(LOG_MODULE_AMBIENTSOUNDS);
LogToggleFlag(LOG_MODULE_AMBIENTSOUNDS);
ZRLogFlagsMenu(client);
}
case 12:
{
ToggleLogFlag(LOG_MODULE_OVERLAYS);
LogToggleFlag(LOG_MODULE_OVERLAYS);
ZRLogFlagsMenu(client);
}
case 13:
{
ToggleLogFlag(LOG_MODULE_SAYTRIGGERS);
LogToggleFlag(LOG_MODULE_SAYTRIGGERS);
ZRLogFlagsMenu(client);
}
case 14:
{
ToggleLogFlag(LOG_MODULE_TELEPORT);
LogToggleFlag(LOG_MODULE_TELEPORT);
ZRLogFlagsMenu(client);
}
case 15:
{
ToggleLogFlag(LOG_MODULE_CLASSES);
LogToggleFlag(LOG_MODULE_CLASSES);
ZRLogFlagsMenu(client);
}
case 16:
{
ToggleLogFlag(LOG_MODULE_WEAPONS);
LogToggleFlag(LOG_MODULE_WEAPONS);
ZRLogFlagsMenu(client);
}
case 17:
{
ToggleLogFlag(LOG_MODULE_HITGROUPS);
LogToggleFlag(LOG_MODULE_HITGROUPS);
ZRLogFlagsMenu(client);
}
case 18:
{
ToggleLogFlag(LOG_MODULE_COMMANDS);
LogToggleFlag(LOG_MODULE_COMMANDS);
ZRLogFlagsMenu(client);
}
case 19:
{
ToggleLogFlag(LOG_MODULE_ANTICAMP);
LogToggleFlag(LOG_MODULE_ANTICAMP);
ZRLogFlagsMenu(client);
}
case 20:
{
ToggleLogFlag(LOG_MODULE_DAMAGE);
LogToggleFlag(LOG_MODULE_DAMAGE);
ZRLogFlagsMenu(client);
}
case 21:
{
ToggleLogFlag(LOG_MODULE_OFFSETS);
LogToggleFlag(LOG_MODULE_OFFSETS);
ZRLogFlagsMenu(client);
}
}
@ -716,20 +716,3 @@ AddToClassKnockback(classindex, Float:value)
{
arrayClasses[classindex][data_knockback] = arrayClasses[classindex][data_knockback] + value;
}
ToggleLogFlag(flag)
{
new log_flags;
log_flags = GetConVarInt(g_hCvarsList[CVAR_LOG]);
if (log_flags & flag)
{
log_flags = log_flags - flag;
}
else
{
log_flags = log_flags + flag;
}
SetConVarInt(g_hCvarsList[CVAR_LOG], log_flags);
}