Made visualambience module, removed an offset thats provided by SM, moved zombie/human checks to infect module (renamed), fixed blast cvar, renamed some functions, removed zombie cvar enable because it didnt work.

This commit is contained in:
Greyscale 2009-04-24 05:02:19 +02:00
parent a8be3d6d0a
commit 2e623447d5
30 changed files with 158 additions and 158 deletions

View File

@ -10,12 +10,6 @@
"Offsets" "Offsets"
{ {
"EyePosition"
{
"windows" "117"
"linux" "118"
}
"EyeAngles" "EyeAngles"
{ {
"windows" "206" "windows" "206"

View File

@ -59,6 +59,9 @@
// Account (module) // Account (module)
#include "zr/account" #include "zr/account"
// Visual Effects (module)
#include "zr/visualeffects"
// Sound Effects (module) // Sound Effects (module)
#include "zr/soundeffects/soundeffects" #include "zr/soundeffects/soundeffects"
@ -142,12 +145,8 @@ public OnPluginStart()
// ====================================================================== // ======================================================================
CreateConVar("gs_zombiereloaded_version", VERSION, "[ZR] Current version of this plugin", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY); CreateConVar("gs_zombiereloaded_version", VERSION, "[ZR] Current version of this plugin", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
CreateConVar("zombie_version", VERSION, "Zombie:Reloaded Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
// Create zombie_version variable if specified. CreateConVar("zombie_enabled", "1", "Not synced with zr_enable", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
if (GetConVarBool(g_hCvarsList[CVAR_ENABLE_ZM_VERSION_VAR]))
{
CreateConVar("zombie_version", VERSION, "Zombie:Reloaded Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
}
// ====================================================================== // ======================================================================
@ -210,12 +209,11 @@ public OnConfigsExecuted()
} }
} }
FindMapSky();
// Forward event to modules. // Forward event to modules.
WeaponsLoad(); WeaponsLoad();
HitgroupsLoad(); HitgroupsLoad();
InfectLoad(); InfectLoad();
VEffectsLoad();
SEffectsLoad(); SEffectsLoad();
} }

View File

@ -348,7 +348,7 @@ HurtPlayersInVolume(volume_index)
{ {
if (IsClientInGame(x) && if (IsClientInGame(x) &&
IsPlayerAlive(x) && IsPlayerAlive(x) &&
IsPlayerHuman(x)) InfectIsClientHuman(x))
{ {
if (IsPlayerInVolume(x, volume_index)) if (IsPlayerInVolume(x, volume_index))
{ {

View File

@ -84,7 +84,7 @@ AntiStickIsStuck(client)
if (clientloc[2] <= stuckloc[2]) if (clientloc[2] <= stuckloc[2])
{ {
new Float:eyeloc[3]; new Float:eyeloc[3];
GetPlayerEyePosition(client, eyeloc); GetClientEyePosition(client, eyeloc);
// Get the distance between the eyes and feet and subtract the stack "view crush." // Get the distance between the eyes and feet and subtract the stack "view crush."
new Float:eyedistance = FloatAbs(eyeloc[2] - clientloc[2]) - PLAYER_HULL_STACK_OFFSET; new Float:eyedistance = FloatAbs(eyeloc[2] - clientloc[2]) - PLAYER_HULL_STACK_OFFSET;

View File

@ -71,7 +71,7 @@ public Action:Command_Infect(client, argc)
for (new x = 0; x < tcount; x++) for (new x = 0; x < tcount; x++)
{ {
InfectPlayer(targets[x]); InfectClient(targets[x]);
if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_COMMANDS)) if (LogCheckFlag(LOG_GAME_EVENTS, LOG_MODULE_COMMANDS))
{ {
GetClientName(targets[x], target_name, sizeof(target_name)); GetClientName(targets[x], target_name, sizeof(target_name));
@ -292,7 +292,7 @@ public Action:Command_GetClassKnockback(client, argc)
public Action:Command_AdminMenu(client, argc) public Action:Command_AdminMenu(client, argc)
{ {
if (ZRIsValidClient(client)) if (ZRIsClientValid(client))
{ {
ZRAdminMenu(client); ZRAdminMenu(client);
} }
@ -306,7 +306,7 @@ public Action:Command_AdminMenu(client, argc)
public Action:Command_KnockbackMMenu(client, argc) public Action:Command_KnockbackMMenu(client, argc)
{ {
if (ZRIsValidClient(client)) if (ZRIsClientValid(client))
{ {
// Disabled, under construction. // Disabled, under construction.
// ZRKnockbackMMenu(client); // ZRKnockbackMMenu(client);
@ -321,7 +321,7 @@ public Action:Command_KnockbackMMenu(client, argc)
public Action:Command_TeleMenu(client, argc) public Action:Command_TeleMenu(client, argc)
{ {
if (ZRIsValidClient(client)) if (ZRIsClientValid(client))
{ {
ZRZTeleMenu(client); ZRZTeleMenu(client);
} }

View File

@ -15,7 +15,6 @@
enum CvarsList enum CvarsList
{ {
Handle:CVAR_ENABLE, Handle:CVAR_ENABLE,
Handle:CVAR_ENABLE_ZM_VERSION_VAR,
Handle:CVAR_LOG, Handle:CVAR_LOG,
Handle:CVAR_LOGFLAGS, Handle:CVAR_LOGFLAGS,
Handle:CVAR_CLASSES_SPAWN, Handle:CVAR_CLASSES_SPAWN,
@ -53,9 +52,13 @@ enum CvarsList
Handle:CVAR_INFECT_SHAKE_DURATION, Handle:CVAR_INFECT_SHAKE_DURATION,
Handle:CVAR_ACCOUNT_CASHFILL, Handle:CVAR_ACCOUNT_CASHFILL,
Handle:CVAR_ACCOUNT_CASHFILL_VALUE, Handle:CVAR_ACCOUNT_CASHFILL_VALUE,
Handle:CVAR_SOUNDEFFECTS_MOAN, Handle:CVAR_VEFFECTS_LIGHTSTYLE,
Handle:CVAR_SOUNDEFFECTS_GROAN, Handle:CVAR_VEFFECTS_LIGHTSTYLE_VALUE,
Handle:CVAR_SOUNDEFFECTS_DEATH, Handle:CVAR_VEFFECTS_SKY,
Handle:CVAR_VEFFECTS_SKY_PATH,
Handle:CVAR_SEFFECTS_MOAN,
Handle:CVAR_SEFFECTS_GROAN,
Handle:CVAR_SEFFECTS_DEATH,
Handle:CVAR_AMBIENTSOUNDS, Handle:CVAR_AMBIENTSOUNDS,
Handle:CVAR_AMBIENTSOUNDS_FILE, Handle:CVAR_AMBIENTSOUNDS_FILE,
Handle:CVAR_AMBIENTSOUNDS_LENGTH, Handle:CVAR_AMBIENTSOUNDS_LENGTH,
@ -75,9 +78,6 @@ enum CvarsList
Handle:CVAR_OVERLAY_REDISPLAY, Handle:CVAR_OVERLAY_REDISPLAY,
Handle:CVAR_ZVISION_ALLOW_DISABLE, Handle:CVAR_ZVISION_ALLOW_DISABLE,
Handle:CVAR_MENU_AUTOCLOSE, Handle:CVAR_MENU_AUTOCLOSE,
Handle:CVAR_DARK,
Handle:CVAR_DARK_LEVEL,
Handle:CVAR_DARK_SKY,
Handle:CVAR_ZSPAWN, Handle:CVAR_ZSPAWN,
Handle:CVAR_ZTELE, Handle:CVAR_ZTELE,
Handle:CVAR_ZTELE_STARTUP_DELAY, Handle:CVAR_ZTELE_STARTUP_DELAY,
@ -121,7 +121,6 @@ CvarsInit()
// =========================== // ===========================
g_hCvarsList[CVAR_ENABLE] = CreateConVar("zr_enable", "1", ""); g_hCvarsList[CVAR_ENABLE] = CreateConVar("zr_enable", "1", "");
g_hCvarsList[CVAR_ENABLE_ZM_VERSION_VAR] = CreateConVar("zr_enable_zm_version_var", "1", "Enable zombie_version variable for compatibility with ZombieMod server filters.");
// =========================== // ===========================
// Log (core) // Log (core)
@ -258,17 +257,26 @@ CvarsInit()
g_hCvarsList[CVAR_ACCOUNT_CASHFILL_VALUE] = CreateConVar("zr_account_cashfill_value", "12000", ""); g_hCvarsList[CVAR_ACCOUNT_CASHFILL_VALUE] = CreateConVar("zr_account_cashfill_value", "12000", "");
// Old Desc: How much money players will have when they spawn when zr_cashfill is 1 // Old Desc: How much money players will have when they spawn when zr_cashfill is 1
// ===========================
// Visual Effects (module)
// ===========================
g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE] = CreateConVar("zr_veffects_lightstyle", "1", "");
g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE_VALUE] = CreateConVar("zr_veffects_lightstyle_value", "a", "");
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", "");
// =========================== // ===========================
// Sound Effects (module) // Sound Effects (module)
// =========================== // ===========================
// Zombie Sounds // Zombie Sounds
g_hCvarsList[CVAR_SOUNDEFFECTS_MOAN] = CreateConVar("zr_soundeffects_moan", "30", ""); g_hCvarsList[CVAR_SEFFECTS_MOAN] = CreateConVar("zr_seffects_moan", "30", "");
// Old Desc: How often, in seconds, a zombie moans (0: Disable) // Old Desc: How often, in seconds, a zombie moans (0: Disable)
g_hCvarsList[CVAR_SOUNDEFFECTS_GROAN] = CreateConVar("zr_soundeffects_groan", "5", ""); g_hCvarsList[CVAR_SEFFECTS_GROAN] = CreateConVar("zr_seffects_groan", "5", "");
// Old Desc: Chance factor a zombie will groan when shot (Lower: More often, 0: Disable) // Old Desc: Chance factor a zombie will groan when shot (Lower: More often, 0: Disable)
g_hCvarsList[CVAR_SOUNDEFFECTS_DEATH] = CreateConVar("zr_soundeffects_death", "1", ""); g_hCvarsList[CVAR_SEFFECTS_DEATH] = CreateConVar("zr_seffects_death", "1", "");
// Old Desc: Zombie will emit a death sound when killed (0: Disable) // Old Desc: Zombie will emit a death sound when killed (0: Disable)
// Ambient Sounds // Ambient Sounds
@ -340,12 +348,6 @@ CvarsInit()
// Old Desc: Allow users to disable ZVision with their nightvision key (0: Disable) // Old Desc: Allow users to disable ZVision with their nightvision key (0: Disable)
g_hCvarsList[CVAR_MENU_AUTOCLOSE] = CreateConVar("zr_menu_autoclose", "0", ""); g_hCvarsList[CVAR_MENU_AUTOCLOSE] = CreateConVar("zr_menu_autoclose", "0", "");
// Old Desc: Automatically close menus on selection. If disabled the menu will remain open. // Old Desc: Automatically close menus on selection. If disabled the menu will remain open.
g_hCvarsList[CVAR_DARK] = CreateConVar("zr_dark", "0", "");
// Old Desc: Default value for darkening maps, most dislike this feature (0: Disable)
g_hCvarsList[CVAR_DARK_LEVEL] = CreateConVar("zr_dark_level", "a", "");
// Old Desc: The darkness of the map, a being the darkest, z being extremely bright when zr_dark is 1 (n: Default)
g_hCvarsList[CVAR_DARK_SKY] = CreateConVar("zr_dark_sky", "sky_borealis01", "");
// Old Desc: The sky the map will have when zr_dark is 1
g_hCvarsList[CVAR_ZSPAWN] = CreateConVar("zr_zspawn", "1", ""); g_hCvarsList[CVAR_ZSPAWN] = CreateConVar("zr_zspawn", "1", "");
// Old Desc: Allow players to spawn if they just joined the game (0: Disable) // Old Desc: Allow players to spawn if they just joined the game (0: Disable)
g_hCvarsList[CVAR_ZTELE] = CreateConVar("zr_tele", "1", ""); g_hCvarsList[CVAR_ZTELE] = CreateConVar("zr_tele", "1", "");

View File

@ -108,14 +108,20 @@ public DamageTraceAttack(client, inflictor, attacker, damage, hitbox, hitgroup)
// new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]); // new bool:enabled = GetConVarBool(g_hCvarsList[CVAR_ENABLE]);
// If attacker isn't valid, then stop. // If attacker isn't valid, then stop.
if (!ZRIsValidClient(attacker)) if (!ZRIsClientValid(attacker))
{
return Hacks_Continue;
}
// If client is attacking himself, then stop.
if(attacker == client)
{ {
return Hacks_Continue; return Hacks_Continue;
} }
// Get zombie flag for each client. // Get zombie flag for each client.
new bool:clientzombie = IsPlayerZombie(client); new bool:clientzombie = InfectIsClientInfected(client);
new bool:attackerzombie = IsPlayerZombie(attacker); new bool:attackerzombie = InfectIsClientInfected(attacker);
// If the flags are the same on both clients, then stop. // If the flags are the same on both clients, then stop.
if (clientzombie == attackerzombie) if (clientzombie == attackerzombie)
@ -190,14 +196,14 @@ public DamageOnTakeDamage(client, inflictor, attacker, damage, damagetype, ammot
if (damagetype & DMG_BULLET) if (damagetype & DMG_BULLET)
{ {
// If attacker isn't valid, then allow damage. // If attacker isn't valid, then allow damage.
if (!ZRIsValidClient(attacker)) if (!ZRIsClientValid(attacker))
{ {
return Hacks_Continue; return Hacks_Continue;
} }
// Get zombie flag for each client. // Get zombie flag for each client.
new bool:clientzombie = IsPlayerZombie(client); new bool:clientzombie = InfectIsClientInfected(client);
new bool:attackerzombie = IsPlayerZombie(attacker); new bool:attackerzombie = InfectIsClientInfected(attacker);
// If client and attacker are on the same team, then let CS:S handle the rest. // If client and attacker are on the same team, then let CS:S handle the rest.
if (clientzombie == attackerzombie) if (clientzombie == attackerzombie)
@ -231,13 +237,13 @@ public DamageOnTakeDamage(client, inflictor, attacker, damage, damagetype, ammot
} }
// If attacker isn't valid, then allow damage. // If attacker isn't valid, then allow damage.
if (!ZRIsValidClient(attacker)) if (!ZRIsClientValid(attacker))
{ {
return Hacks_Continue; return Hacks_Continue;
} }
// If client is a zombie, then allow damage. // If client is a zombie, then allow damage.
if (IsPlayerZombie(client)) if (InfectIsClientInfected(client))
{ {
return Hacks_Continue; return Hacks_Continue;
} }
@ -249,7 +255,7 @@ public DamageOnTakeDamage(client, inflictor, attacker, damage, damagetype, ammot
else if (damagetype & DMG_FALL) else if (damagetype & DMG_FALL)
{ {
// If client isn't a zombie, then allow damage. // If client isn't a zombie, then allow damage.
if (!IsPlayerZombie(client)) if (!InfectIsClientInfected(client))
{ {
return Hacks_Continue; return Hacks_Continue;
} }
@ -293,7 +299,7 @@ public Action:DamageSuicideIntercept(client, argc)
} }
// If client is invalid, then stop. (Stop console.) // If client is invalid, then stop. (Stop console.)
if (!ZRIsValidClient(client)) if (!ZRIsClientValid(client))
{ {
return Plugin_Continue; return Plugin_Continue;
} }
@ -305,7 +311,7 @@ public Action:DamageSuicideIntercept(client, argc)
} }
// Get zombie flag on client. // Get zombie flag on client.
new bool:clientzombie = IsPlayerZombie(client); new bool:clientzombie = InfectIsClientInfected(client);
// Get cvar values for suicide interception. // Get cvar values for suicide interception.
new bool:suicidezombie = GetConVarBool(g_hCvarsList[CVAR_DAMAGE_SUICIDE_ZOMBIE]); new bool:suicidezombie = GetConVarBool(g_hCvarsList[CVAR_DAMAGE_SUICIDE_ZOMBIE]);

View File

@ -33,14 +33,13 @@ UnhookEvents()
} }
public Action:RoundStart(Handle:event, const String:name[], bool:dontBroadcast) public Action:RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{ {
ChangeLightStyle();
ZR_PrintToChat(0, "Round objective"); ZR_PrintToChat(0, "Round objective");
// Forward event to sub-modules. // Forward event to sub-modules.
RoundEndOnRoundStart(); RoundEndOnRoundStart();
InfectOnRoundStart(); InfectOnRoundStart();
VEffectsOnRoundStart();
SEffectsOnRoundStart(); SEffectsOnRoundStart();
AntiStickOnRoundStart(); AntiStickOnRoundStart();
} }
@ -84,6 +83,9 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
// Get all required event info. // Get all required event info.
new index = GetClientOfUserId(GetEventInt(event, "userid")); new index = GetClientOfUserId(GetEventInt(event, "userid"));
// Call post player_spawn
CreateTimer(0.0, PlayerSpawnPost, index);
// Reset FOV and overlay. // Reset FOV and overlay.
SetPlayerFOV(index, 90); SetPlayerFOV(index, 90);
ClientCommand(index, "r_screenoverlay \"\""); ClientCommand(index, "r_screenoverlay \"\"");
@ -122,6 +124,12 @@ public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
ZR_PrintToChat(index, "!zmenu reminder"); 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) public Action:PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{ {
// Get all required event info. // Get all required event info.
@ -162,10 +170,10 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
ExtinguishEntity(index); ExtinguishEntity(index);
// If the attacker is valid, then continue. // If the attacker is valid, then continue.
if (ZRIsValidClient(attacker)) if (ZRIsClientValid(attacker))
{ {
// If the client is a zombie, then continue. // If the client is a zombie, then continue.
if (IsPlayerZombie(index)) if (InfectIsClientInfected(index))
{ {
// Add kill bonus to attacker's score. // Add kill bonus to attacker's score.
new bonus = ClassGetKillBonus(attacker); new bonus = ClassGetKillBonus(attacker);

View File

@ -123,7 +123,7 @@ InfectOnClientDisconnect(client)
ZRCountValidClients(zombiecount, humancount); ZRCountValidClients(zombiecount, humancount);
// If client is a human. // If client is a human.
if (IsPlayerHuman(client)) if (InfectIsClientHuman(client))
{ {
// If there are other humans (ignoring this human), then stop. // If there are other humans (ignoring this human), then stop.
if (humancount > 1) if (humancount > 1)
@ -176,7 +176,7 @@ InfectOnClientDisconnect(client)
new randclient = GetArrayCell(arrayEligibleClients, randindex); new randclient = GetArrayCell(arrayEligibleClients, randindex);
// Infect player. // Infect player.
InfectPlayer(randclient); InfectClient(randclient);
// Tell client they have been randomly been chosen to replace disconnecting zombie. // Tell client they have been randomly been chosen to replace disconnecting zombie.
ZR_PrintToChat(randclient, "Zombie replacement"); ZR_PrintToChat(randclient, "Zombie replacement");
@ -223,19 +223,19 @@ InfectOnClientSpawn(client)
InfectOnClientHurt(client, attacker, const String:weapon[]) InfectOnClientHurt(client, attacker, const String:weapon[])
{ {
// If attacker isn't valid, then stop. // If attacker isn't valid, then stop.
if (!ZRIsValidClient(attacker)) if (!ZRIsClientValid(attacker))
{ {
return; return;
} }
// If client isn't a human, then stop. // If client isn't a human, then stop.
if (!IsPlayerHuman(client)) if (!InfectIsClientHuman(client))
{ {
return; return;
} }
// Attacker isn't a zombie, then stop. // Attacker isn't a zombie, then stop.
if (!IsPlayerZombie(attacker)) if (!InfectIsClientInfected(attacker))
{ {
return; return;
} }
@ -253,7 +253,7 @@ InfectOnClientHurt(client, attacker, const String:weapon[])
} }
// Infect client. // Infect client.
InfectPlayer(client, attacker); InfectClient(client, attacker);
} }
/** /**
@ -425,7 +425,7 @@ public Action:InfectMotherZombie(Handle:timer)
client = GetArrayCell(arrayEligibleClients, randindex); client = GetArrayCell(arrayEligibleClients, randindex);
// Infect player. // Infect player.
InfectPlayer(client, _, true); InfectClient(client, _, true);
} }
else else
{ {
@ -457,7 +457,7 @@ public Action:InfectMotherZombie(Handle:timer)
client = GetArrayCell(arrayEligibleClients, randindex); client = GetArrayCell(arrayEligibleClients, randindex);
// Infect player. // Infect player.
InfectPlayer(client, _, true); InfectClient(client, _, true);
// Remove player from eligible zombie list. // Remove player from eligible zombie list.
RemoveFromArray(arrayEligibleClients, randindex); RemoveFromArray(arrayEligibleClients, randindex);
@ -479,7 +479,7 @@ public Action:InfectMotherZombie(Handle:timer)
* @param attacker (Optional) The attacker who did the infect. * @param attacker (Optional) The attacker who did the infect.
* @param motherinfect (Optional) Indicates a mother zombie infect. * @param motherinfect (Optional) Indicates a mother zombie infect.
*/ */
InfectPlayer(client, attacker = -1, bool:motherinfect = false) InfectClient(client, attacker = -1, bool:motherinfect = false)
{ {
// Mark player as zombie. // Mark player as zombie.
bZombie[client] = true; bZombie[client] = true;
@ -521,10 +521,10 @@ InfectPlayer(client, attacker = -1, bool:motherinfect = false)
bInfectImmune[client][INFECT_TYPE_MOTHER] = infectconsecutiveblock ? motherinfect : false; bInfectImmune[client][INFECT_TYPE_MOTHER] = infectconsecutiveblock ? motherinfect : false;
// Apply effects. // Apply effects.
InfectEffects(client); InfectFireEffects(client);
// If attacker is valid, then continue. // If attacker is valid, then continue.
if (ZRIsValidClient(attacker)) if (ZRIsClientValid(attacker))
{ {
// Create and send custom player_death event. // Create and send custom player_death event.
new Handle:event = CreateEvent("player_death"); new Handle:event = CreateEvent("player_death");
@ -576,7 +576,7 @@ InfectPlayer(client, attacker = -1, bool:motherinfect = false)
* *
* @param client The client index. * @param client The client index.
*/ */
InfectEffects(client) InfectFireEffects(client)
{ {
// Create location and direction arrays. // Create location and direction arrays.
new Float:clientloc[3]; new Float:clientloc[3];
@ -668,4 +668,40 @@ InfectEffects(client)
EndMessage(); EndMessage();
} }
} }
}
/**
* Returns if a client is infected.
*
* @param client The client index.
* @return True if the client has been infected, false otherwise.
*/
bool:InfectIsClientInfected(client)
{
// If client is invalid, then stop.
if (!ZRIsClientValid(client))
{
return false;
}
// Return client's zombie flag.
return bZombie[client];
}
/**
* Returns if a client is a human.
*
* @param client The client index.
* @return True if the client is a human, false otherwise.
*/
bool:InfectIsClientHuman(client)
{
// If client is invalid, then stop.
if (!ZRIsClientValid(client))
{
return true;
}
// Return opposite of client's zombie flag.
return !bZombie[client];
} }

View File

@ -17,19 +17,19 @@
KnockbackOnClientHurt(client, attacker, const String:weapon[], hitgroup, dmg_health) KnockbackOnClientHurt(client, attacker, const String:weapon[], hitgroup, dmg_health)
{ {
// If attacker is invalid, then stop. // If attacker is invalid, then stop.
if (!ZRIsValidClient(attacker)) if (!ZRIsClientValid(attacker))
{ {
return; return;
} }
// Client is a human, then stop. // Client is a human, then stop.
if (IsPlayerHuman(client)) if (InfectIsClientHuman(client))
{ {
return; return;
} }
// If attacker is a zombie, then stop. // If attacker is a zombie, then stop.
if (IsPlayerZombie(attacker)) if (InfectIsClientInfected(attacker))
{ {
return; return;
} }
@ -55,7 +55,7 @@ KnockbackOnClientHurt(client, attacker, const String:weapon[], hitgroup, dmg_hea
else else
{ {
// Get attackers eye position. // Get attackers eye position.
GetPlayerEyePosition(attacker, attackerloc); GetClientEyePosition(attacker, attackerloc);
// Get attackers eye angles. // Get attackers eye angles.
new Float:attackerang[3]; new Float:attackerang[3];

View File

@ -118,7 +118,7 @@ LogMessageFormatted(client, const String:module[], const String:block[], const S
LogToAdmins(text); LogToAdmins(text);
} }
if (ZRIsValidClient(client) && LogCheckFlag(LOG_TO_CLIENT)) if (ZRIsClientValid(client) && LogCheckFlag(LOG_TO_CLIENT))
{ {
// Set client as translation target. // Set client as translation target.
SetGlobalTransTarget(client); SetGlobalTransTarget(client);

View File

@ -23,7 +23,7 @@
NapalmOnClientHurt(client, const String:weapon[]) NapalmOnClientHurt(client, const String:weapon[])
{ {
// If player isn't a zombie, then stop. // If player isn't a zombie, then stop.
if (!IsPlayerZombie(client)) if (!InfectIsClientInfected(client))
{ {
return; return;
} }

View File

@ -21,7 +21,6 @@ new offsRender;
new offsActiveWeapon; new offsActiveWeapon;
new Handle:g_hGameConf = INVALID_HANDLE; new Handle:g_hGameConf = INVALID_HANDLE;
new Handle:g_hEyePosition = INVALID_HANDLE;
new Handle:g_hEyeAngles = INVALID_HANDLE; new Handle:g_hEyeAngles = INVALID_HANDLE;
new Handle:g_hTerminateRound = INVALID_HANDLE; new Handle:g_hTerminateRound = INVALID_HANDLE;
new Handle:g_hCSWeaponDrop = INVALID_HANDLE; new Handle:g_hCSWeaponDrop = INVALID_HANDLE;
@ -111,16 +110,6 @@ SetupGameData()
{ {
// Load game config file. // Load game config file.
g_hGameConf = LoadGameConfigFile("plugin.zombiereloaded"); g_hGameConf = LoadGameConfigFile("plugin.zombiereloaded");
StartPrepSDKCall(SDKCall_Player);
PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Virtual, "EyePosition");
PrepSDKCall_SetReturnInfo(SDKType_QAngle, SDKPass_ByValue);
g_hEyePosition = EndPrepSDKCall();
if(g_hEyePosition == INVALID_HANDLE)
{
SetFailState("Couldn't find offset \"EyePosition\"!");
}
StartPrepSDKCall(SDKCall_Player); StartPrepSDKCall(SDKCall_Player);
PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Virtual, "EyeAngles"); PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Virtual, "EyeAngles");
@ -242,11 +231,6 @@ AddPlayerDeath(client, amount)
SetEntProp(client, Prop_Data, "m_iDeaths", deaths + amount); SetEntProp(client, Prop_Data, "m_iDeaths", deaths + amount);
} }
GetPlayerEyePosition(client, Float:vec[3])
{
SDKCall(g_hEyePosition, client, vec);
}
GetPlayerEyeAngles(client, Float:ang[3]) GetPlayerEyeAngles(client, Float:ang[3])
{ {
SDKCall(g_hEyeAngles, client, ang); SDKCall(g_hEyeAngles, client, ang);

View File

@ -22,7 +22,7 @@
*/ */
ClassClientInit(client) ClassClientInit(client)
{ {
if (ZRIsValidClient(client)) if (ZRIsClientValid(client))
{ {
// Set default class indexes on the player. // Set default class indexes on the player.
ClassClientSetDefaultIndexes(client); ClassClientSetDefaultIndexes(client);

View File

@ -86,7 +86,7 @@ ClassOverlayStop(client)
public Action:ClassOverlayTimer(Handle:timer, any:client) public Action:ClassOverlayTimer(Handle:timer, any:client)
{ {
if (!IsClientInGame(client) || !IsPlayerZombie(client)) if (!IsClientInGame(client) || !InfectIsClientInfected(client))
{ {
tOverlay[client] = INVALID_HANDLE; tOverlay[client] = INVALID_HANDLE;
return Plugin_Stop; return Plugin_Stop;

View File

@ -331,7 +331,7 @@ ClassGetActiveIndex(client)
return -1; return -1;
} }
if (IsPlayerHuman(client)) if (InfectIsClientHuman(client))
{ {
teamid = ZR_CLASS_TEAM_HUMANS; teamid = ZR_CLASS_TEAM_HUMANS;
} }

View File

@ -456,7 +456,7 @@ bool:ClassReloadDataCache()
bool:ClassReloadPlayerCache(client, classindex, cachetype = ZR_CLASS_CACHE_MODIFIED) bool:ClassReloadPlayerCache(client, classindex, cachetype = ZR_CLASS_CACHE_MODIFIED)
{ {
// Validate indexes. // Validate indexes.
if (!ClassValidateIndex(classindex) || !ZRIsValidClient(client)) if (!ClassValidateIndex(classindex) || !ZRIsClientValid(client))
{ {
return false; return false;
} }

View File

@ -56,10 +56,10 @@ RespawnOnClientSpawn(client)
RespawnOnClientDeath(client, attacker, const String:weapon[]) RespawnOnClientDeath(client, attacker, const String:weapon[])
{ {
// If client is a zombie, check if they were killed by world. // If client is a zombie, check if they were killed by world.
if (IsPlayerZombie(client)) if (InfectIsClientInfected(client))
{ {
// Set pKilledByWorld to true if attacker is not a valid client. // Set pKilledByWorld to true if attacker is not a valid client.
pKilledByWorld[client] = !ZRIsValidClient(attacker); pKilledByWorld[client] = !ZRIsClientValid(attacker);
} }
// If timer is running, kill it. // If timer is running, kill it.
@ -126,13 +126,13 @@ RespawnSpawnClient(client)
// Get suicide respawn cvar // Get suicide respawn cvar
if (respawn_zombie) if (respawn_zombie)
{ {
InfectPlayer(client); InfectClient(client);
return; return;
} }
if (GetConVarBool(g_hCvarsList[CVAR_RESPAWN_ZOMBIE_WORLD]) && pKilledByWorld[client]) if (GetConVarBool(g_hCvarsList[CVAR_RESPAWN_ZOMBIE_WORLD]) && pKilledByWorld[client])
{ {
InfectPlayer(client); InfectClient(client);
pKilledByWorld[client] = false; pKilledByWorld[client] = false;
} }
} }

View File

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

View File

@ -69,10 +69,20 @@ SEffectsOnRoundStart()
SEffectsOnClientSpawn(client) SEffectsOnClientSpawn(client)
{ {
// Forward event to sub-modules. // Forward event to sub-modules.
AmbientSoundsOnClientSpawn(client); //AmbientSoundsOnClientSpawn(client);
ZombieSoundsOnClientSpawn(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. * Client has been killed.
* *
@ -121,7 +131,7 @@ SEffectsEmitAmbientSound(const String:sound[], Float:ambientvolume = 1.0, client
// Stop sound before playing again. // Stop sound before playing again.
SEffectsStopAmbientSound(sound); SEffectsStopAmbientSound(sound);
if (ZRIsValidClient(client)) if (ZRIsClientValid(client))
{ {
// Emit ambient sound. // Emit ambient sound.
EmitSoundToClient(client, sound, SOUND_FROM_PLAYER, SOUND_AMBIENT_CHANNEL, _, _, ambientvolume); EmitSoundToClient(client, sound, SOUND_FROM_PLAYER, SOUND_AMBIENT_CHANNEL, _, _, ambientvolume);

View File

@ -99,13 +99,13 @@ ZombieSoundsOnClientDeath(client)
tSEffectsMoan[client] = INVALID_HANDLE; tSEffectsMoan[client] = INVALID_HANDLE;
// If player isn't a zombie, then stop. // If player isn't a zombie, then stop.
if (!IsPlayerZombie(client)) if (!InfectIsClientInfected(client))
{ {
return; return;
} }
// If death sound cvar is disabled, then stop. // If death sound cvar is disabled, then stop.
new bool:death = GetConVarBool(g_hCvarsList[CVAR_SOUNDEFFECTS_DEATH]); new bool:death = GetConVarBool(g_hCvarsList[CVAR_SEFFECTS_DEATH]);
if (!death) if (!death)
{ {
return; return;
@ -126,13 +126,13 @@ ZombieSoundsOnClientDeath(client)
ZombieSoundsOnClientHurt(client) ZombieSoundsOnClientHurt(client)
{ {
// If player isn't a zombie, then stop. // If player isn't a zombie, then stop.
if (!IsPlayerZombie(client)) if (!InfectIsClientInfected(client))
{ {
return; return;
} }
// Get groan factor, if 0, then stop. // Get groan factor, if 0, then stop.
new groan = GetConVarInt(g_hCvarsList[CVAR_SOUNDEFFECTS_GROAN]); new groan = GetConVarInt(g_hCvarsList[CVAR_SEFFECTS_GROAN]);
if (!groan) if (!groan)
{ {
return; return;
@ -157,7 +157,7 @@ ZombieSoundsOnClientHurt(client)
ZombieSoundsOnClientInfected(client) ZombieSoundsOnClientInfected(client)
{ {
// If interval is set to 0, then stop. // If interval is set to 0, then stop.
new Float:interval = GetConVarFloat(g_hCvarsList[CVAR_SOUNDEFFECTS_MOAN]); new Float:interval = GetConVarFloat(g_hCvarsList[CVAR_SEFFECTS_MOAN]);
if (!interval) if (!interval)
{ {
return; return;
@ -245,7 +245,7 @@ bool:ZombieSoundsGetRandomSound(String:sound[], ZombieSounds:soundtype)
public Action:ZombieSoundsMoanTimer(Handle:timer, any:client) public Action:ZombieSoundsMoanTimer(Handle:timer, any:client)
{ {
// If client isn't in-game or client is no longer a zombie, then stop. // If client isn't in-game or client is no longer a zombie, then stop.
if (!IsClientInGame(client) || !IsPlayerZombie(client)) if (!IsClientInGame(client) || !InfectIsClientInfected(client))
{ {
// Reset timer handle. // Reset timer handle.
tSEffectsMoan[client] = INVALID_HANDLE; tSEffectsMoan[client] = INVALID_HANDLE;

View File

@ -129,7 +129,7 @@ public Action:SpawnProtectTimer(Handle:timer, any:client)
} }
// If client has become a zombie, then stop timer. // If client has become a zombie, then stop timer.
if (!IsPlayerHuman(client)) if (!InfectIsClientHuman(client))
{ {
return Plugin_Stop; return Plugin_Stop;
} }

View File

@ -390,7 +390,7 @@ bool:ZTele(client)
} }
// Check limits. // Check limits.
if (IsPlayerHuman(client)) if (InfectIsClientHuman(client))
{ {
new human_limit = GetConVarInt(g_hCvarsList[CVAR_ZTELE_HUMAN_LIMIT]); new human_limit = GetConVarInt(g_hCvarsList[CVAR_ZTELE_HUMAN_LIMIT]);
new bool:tele_humans; new bool:tele_humans;
@ -454,7 +454,7 @@ TeleportClient(client, bool:no_delay = false, bool:free_tele = false, bool:no_co
new bool:teleports_unlimited = false; new bool:teleports_unlimited = false;
new Float:empty_vector[3] = {0.0, 0.0, 0.0}; new Float:empty_vector[3] = {0.0, 0.0, 0.0};
if (IsPlayerHuman(client)) if (InfectIsClientHuman(client))
{ {
new human_delay = GetConVarInt(g_hCvarsList[CVAR_ZTELE_HUMAN_DELAY]); new human_delay = GetConVarInt(g_hCvarsList[CVAR_ZTELE_HUMAN_DELAY]);
new human_limit = GetConVarInt(g_hCvarsList[CVAR_ZTELE_HUMAN_LIMIT]); new human_limit = GetConVarInt(g_hCvarsList[CVAR_ZTELE_HUMAN_LIMIT]);

View File

@ -19,7 +19,7 @@ stock ZR_PrintToChat(client, any:...)
{ {
decl String:phrase[192]; decl String:phrase[192];
if (ZRIsValidClient(client)) if (ZRIsClientValid(client))
{ {
SetGlobalTransTarget(client); SetGlobalTransTarget(client);

View File

@ -79,7 +79,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
} }
// If player is a zombie, then stop. // If player is a zombie, then stop.
if (IsPlayerZombie(client)) if (InfectIsClientInfected(client))
{ {
ZR_PrintToChat(client, "Zombie cant use weapon"); ZR_PrintToChat(client, "Zombie cant use weapon");

View File

@ -226,7 +226,7 @@ public Action:RestrictBuyHook(client, argc)
} }
// If player is a zombie then block command. // If player is a zombie then block command.
if (IsPlayerZombie(client)) if (InfectIsClientInfected(client))
{ {
ZR_PrintToChat(client, "Zombie cant use weapon"); ZR_PrintToChat(client, "Zombie cant use weapon");
@ -864,7 +864,7 @@ public RestrictCanUse(client, weapon, dummy1, dummy2, dummy3, dummy4)
} }
// If the player is a zombie and the weapon isn't a knife then prevent pickup. // If the player is a zombie and the weapon isn't a knife then prevent pickup.
if (IsPlayerZombie(client) && !StrEqual(weaponname, "knife")) if (InfectIsClientInfected(client) && !StrEqual(weaponname, "knife"))
{ {
return 0; return 0;
} }

View File

@ -397,7 +397,7 @@ public ZRInfectHandle(Handle:menu_infect, MenuAction:action, client, slot)
{ {
decl String:name[64]; decl String:name[64];
GetClientName(target, name, sizeof(name)); GetClientName(target, name, sizeof(name));
InfectPlayer(target); InfectClient(target);
ShowActivity2(client, "[ZR] ", "Infected %s", name); ShowActivity2(client, "[ZR] ", "Infected %s", name);
ZRInfectMenu(client); ZRInfectMenu(client);
} }

View File

@ -171,7 +171,7 @@ ZHPUpdateHUD(client)
} }
// If player is a zombie, or has ZHP disabled, then stop. // If player is a zombie, or has ZHP disabled, then stop.
if (!IsPlayerZombie(client) || !pZHP[client]) if (!InfectIsClientInfected(client) || !pZHP[client])
{ {
return; return;
} }

View File

@ -5,8 +5,6 @@
* Author: Greyscale * Author: Greyscale
* ==================== * ====================
*/ */
new String:skyname[32];
HookCommands() HookCommands()
{ {
@ -27,7 +25,7 @@ public Action:Command_NightVision(client, argc)
return; return;
} }
if (!IsPlayerZombie(client)) if (!InfectIsClientInfected(client))
{ {
return; return;
} }
@ -50,32 +48,6 @@ public Action:Command_NightVision(client, argc)
} }
} }
FindMapSky()
{
GetConVarString(FindConVar("sv_skyname"), skyname, sizeof(skyname));
}
ChangeLightStyle()
{
new bool:dark = GetConVarBool(g_hCvarsList[CVAR_DARK]);
if (dark)
{
decl String:darkness[2];
decl String:sky[32];
GetConVarString(g_hCvarsList[CVAR_DARK_LEVEL], darkness, sizeof(darkness));
GetConVarString(g_hCvarsList[CVAR_DARK_SKY], sky, sizeof(sky));
SetLightStyle(0, darkness);
SetConVarString(FindConVar("sv_skyname"), sky, true, false);
}
else
{
SetLightStyle(0, "n");
SetConVarString(FindConVar("sv_skyname"), skyname, true, false);
}
}
JumpBoost(client, Float:distance, Float:height) JumpBoost(client, Float:distance, Float:height)
{ {
new Float:vel[3]; new Float:vel[3];
@ -110,14 +82,4 @@ RemoveObjectives()
RemoveEdict(x); RemoveEdict(x);
} }
} }
}
bool:IsPlayerZombie(client)
{
return bZombie[client];
}
bool:IsPlayerHuman(client)
{
return !bZombie[client];
} }

View File

@ -98,7 +98,7 @@ ZRCreateEligibleClientList(&Handle:arrayEligibleClients, bool:team = false, bool
} }
// If client is already zombie (via admin), then stop. // If client is already zombie (via admin), then stop.
if (human && !IsPlayerHuman(x)) if (human && !InfectIsClientHuman(x))
{ {
continue; continue;
} }
@ -117,7 +117,7 @@ ZRCreateEligibleClientList(&Handle:arrayEligibleClients, bool:team = false, bool
* @param console True to include console (index 0), false if not. * @param console True to include console (index 0), false if not.
* @return True if client is valid, false otherwise. * @return True if client is valid, false otherwise.
*/ */
bool:ZRIsValidClient(client, bool:console = false) bool:ZRIsClientValid(client, bool:console = false)
{ {
// If index is greater than max number of clients, then return false. // If index is greater than max number of clients, then return false.
if (client > MaxClients) if (client > MaxClients)
@ -167,12 +167,12 @@ bool:ZRCountValidClients(&zombiecount = 0, &humancount = 0, bool:alive = true, b
} }
// If player is a zombie, then increment zombie variable. // If player is a zombie, then increment zombie variable.
if (IsPlayerZombie(x)) if (InfectIsClientInfected(x))
{ {
zombiecount++; zombiecount++;
} }
// If player is a human, then increment human variable. // If player is a human, then increment human variable.
else if (IsPlayerHuman(x)) else if (InfectIsClientHuman(x))
{ {
humancount++; humancount++;
} }
@ -191,7 +191,7 @@ bool:ZRCountValidClients(&zombiecount = 0, &humancount = 0, bool:alive = true, b
bool:ZRIsClientOnTeam(client, team = -1) bool:ZRIsClientOnTeam(client, team = -1)
{ {
// If index is invalid, then stop. // If index is invalid, then stop.
if (!ZRIsValidClient(client)) if (!ZRIsClientValid(client))
{ {
return false; return false;
} }
@ -234,7 +234,7 @@ bool:ZRTeamHasClients(team = -1)
bool:ZRIsClientAdmin(client) bool:ZRIsClientAdmin(client)
{ {
// If index is invalid, then stop. // If index is invalid, then stop.
if (!ZRIsValidClient(client)) if (!ZRIsClientValid(client))
{ {
return false; return false;
} }