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"
{
"EyePosition"
{
"windows" "117"
"linux" "118"
}
"EyeAngles"
{
"windows" "206"

View File

@ -59,6 +59,9 @@
// Account (module)
#include "zr/account"
// Visual Effects (module)
#include "zr/visualeffects"
// Sound Effects (module)
#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);
// Create zombie_version variable if specified.
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);
}
CreateConVar("zombie_version", VERSION, "Zombie:Reloaded Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
CreateConVar("zombie_enabled", "1", "Not synced with zr_enable", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_UNLOGGED|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY);
// ======================================================================
@ -210,12 +209,11 @@ public OnConfigsExecuted()
}
}
FindMapSky();
// Forward event to modules.
WeaponsLoad();
HitgroupsLoad();
InfectLoad();
VEffectsLoad();
SEffectsLoad();
}

View File

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

View File

@ -84,7 +84,7 @@ AntiStickIsStuck(client)
if (clientloc[2] <= stuckloc[2])
{
new Float:eyeloc[3];
GetPlayerEyePosition(client, eyeloc);
GetClientEyePosition(client, eyeloc);
// 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;

View File

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

View File

@ -15,7 +15,6 @@
enum CvarsList
{
Handle:CVAR_ENABLE,
Handle:CVAR_ENABLE_ZM_VERSION_VAR,
Handle:CVAR_LOG,
Handle:CVAR_LOGFLAGS,
Handle:CVAR_CLASSES_SPAWN,
@ -53,9 +52,13 @@ enum CvarsList
Handle:CVAR_INFECT_SHAKE_DURATION,
Handle:CVAR_ACCOUNT_CASHFILL,
Handle:CVAR_ACCOUNT_CASHFILL_VALUE,
Handle:CVAR_SOUNDEFFECTS_MOAN,
Handle:CVAR_SOUNDEFFECTS_GROAN,
Handle:CVAR_SOUNDEFFECTS_DEATH,
Handle:CVAR_VEFFECTS_LIGHTSTYLE,
Handle:CVAR_VEFFECTS_LIGHTSTYLE_VALUE,
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_FILE,
Handle:CVAR_AMBIENTSOUNDS_LENGTH,
@ -75,9 +78,6 @@ enum CvarsList
Handle:CVAR_OVERLAY_REDISPLAY,
Handle:CVAR_ZVISION_ALLOW_DISABLE,
Handle:CVAR_MENU_AUTOCLOSE,
Handle:CVAR_DARK,
Handle:CVAR_DARK_LEVEL,
Handle:CVAR_DARK_SKY,
Handle:CVAR_ZSPAWN,
Handle:CVAR_ZTELE,
Handle:CVAR_ZTELE_STARTUP_DELAY,
@ -121,7 +121,6 @@ CvarsInit()
// ===========================
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)
@ -258,17 +257,26 @@ CvarsInit()
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
// ===========================
// 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)
// ===========================
// 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)
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)
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)
// Ambient Sounds
@ -340,12 +348,6 @@ CvarsInit()
// Old Desc: Allow users to disable ZVision with their nightvision key (0: Disable)
g_hCvarsList[CVAR_MENU_AUTOCLOSE] = CreateConVar("zr_menu_autoclose", "0", "");
// 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", "");
// Old Desc: Allow players to spawn if they just joined the game (0: Disable)
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]);
// 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;
}
// Get zombie flag for each client.
new bool:clientzombie = IsPlayerZombie(client);
new bool:attackerzombie = IsPlayerZombie(attacker);
new bool:clientzombie = InfectIsClientInfected(client);
new bool:attackerzombie = InfectIsClientInfected(attacker);
// If the flags are the same on both clients, then stop.
if (clientzombie == attackerzombie)
@ -190,14 +196,14 @@ public DamageOnTakeDamage(client, inflictor, attacker, damage, damagetype, ammot
if (damagetype & DMG_BULLET)
{
// If attacker isn't valid, then allow damage.
if (!ZRIsValidClient(attacker))
if (!ZRIsClientValid(attacker))
{
return Hacks_Continue;
}
// Get zombie flag for each client.
new bool:clientzombie = IsPlayerZombie(client);
new bool:attackerzombie = IsPlayerZombie(attacker);
new bool:clientzombie = InfectIsClientInfected(client);
new bool:attackerzombie = InfectIsClientInfected(attacker);
// If client and attacker are on the same team, then let CS:S handle the rest.
if (clientzombie == attackerzombie)
@ -231,13 +237,13 @@ public DamageOnTakeDamage(client, inflictor, attacker, damage, damagetype, ammot
}
// If attacker isn't valid, then allow damage.
if (!ZRIsValidClient(attacker))
if (!ZRIsClientValid(attacker))
{
return Hacks_Continue;
}
// If client is a zombie, then allow damage.
if (IsPlayerZombie(client))
if (InfectIsClientInfected(client))
{
return Hacks_Continue;
}
@ -249,7 +255,7 @@ public DamageOnTakeDamage(client, inflictor, attacker, damage, damagetype, ammot
else if (damagetype & DMG_FALL)
{
// If client isn't a zombie, then allow damage.
if (!IsPlayerZombie(client))
if (!InfectIsClientInfected(client))
{
return Hacks_Continue;
}
@ -293,7 +299,7 @@ public Action:DamageSuicideIntercept(client, argc)
}
// If client is invalid, then stop. (Stop console.)
if (!ZRIsValidClient(client))
if (!ZRIsClientValid(client))
{
return Plugin_Continue;
}
@ -305,7 +311,7 @@ public Action:DamageSuicideIntercept(client, argc)
}
// Get zombie flag on client.
new bool:clientzombie = IsPlayerZombie(client);
new bool:clientzombie = InfectIsClientInfected(client);
// Get cvar values for suicide interception.
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)
{
ChangeLightStyle();
{
ZR_PrintToChat(0, "Round objective");
// Forward event to sub-modules.
RoundEndOnRoundStart();
InfectOnRoundStart();
VEffectsOnRoundStart();
SEffectsOnRoundStart();
AntiStickOnRoundStart();
}
@ -84,6 +83,9 @@ public Action:PlayerSpawn(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 \"\"");
@ -122,6 +124,12 @@ 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)
{
// Get all required event info.
@ -162,10 +170,10 @@ public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
ExtinguishEntity(index);
// If the attacker is valid, then continue.
if (ZRIsValidClient(attacker))
if (ZRIsClientValid(attacker))
{
// If the client is a zombie, then continue.
if (IsPlayerZombie(index))
if (InfectIsClientInfected(index))
{
// Add kill bonus to attacker's score.
new bonus = ClassGetKillBonus(attacker);

View File

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

View File

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

View File

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

View File

@ -21,7 +21,6 @@ new offsRender;
new offsActiveWeapon;
new Handle:g_hGameConf = INVALID_HANDLE;
new Handle:g_hEyePosition = INVALID_HANDLE;
new Handle:g_hEyeAngles = INVALID_HANDLE;
new Handle:g_hTerminateRound = INVALID_HANDLE;
new Handle:g_hCSWeaponDrop = INVALID_HANDLE;
@ -111,16 +110,6 @@ SetupGameData()
{
// Load game config file.
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);
PrepSDKCall_SetFromConf(g_hGameConf, SDKConf_Virtual, "EyeAngles");
@ -242,11 +231,6 @@ AddPlayerDeath(client, amount)
SetEntProp(client, Prop_Data, "m_iDeaths", deaths + amount);
}
GetPlayerEyePosition(client, Float:vec[3])
{
SDKCall(g_hEyePosition, client, vec);
}
GetPlayerEyeAngles(client, Float:ang[3])
{
SDKCall(g_hEyeAngles, client, ang);

View File

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

View File

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

View File

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

View File

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

View File

@ -56,10 +56,10 @@ RespawnOnClientSpawn(client)
RespawnOnClientDeath(client, attacker, const String:weapon[])
{
// 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.
pKilledByWorld[client] = !ZRIsValidClient(attacker);
pKilledByWorld[client] = !ZRIsClientValid(attacker);
}
// If timer is running, kill it.
@ -126,13 +126,13 @@ RespawnSpawnClient(client)
// Get suicide respawn cvar
if (respawn_zombie)
{
InfectPlayer(client);
InfectClient(client);
return;
}
if (GetConVarBool(g_hCvarsList[CVAR_RESPAWN_ZOMBIE_WORLD]) && pKilledByWorld[client])
{
InfectPlayer(client);
InfectClient(client);
pKilledByWorld[client] = false;
}
}

View File

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

View File

@ -69,10 +69,20 @@ 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.
*
@ -121,7 +131,7 @@ SEffectsEmitAmbientSound(const String:sound[], Float:ambientvolume = 1.0, client
// Stop sound before playing again.
SEffectsStopAmbientSound(sound);
if (ZRIsValidClient(client))
if (ZRIsClientValid(client))
{
// Emit ambient sound.
EmitSoundToClient(client, sound, SOUND_FROM_PLAYER, SOUND_AMBIENT_CHANNEL, _, _, ambientvolume);

View File

@ -99,13 +99,13 @@ ZombieSoundsOnClientDeath(client)
tSEffectsMoan[client] = INVALID_HANDLE;
// If player isn't a zombie, then stop.
if (!IsPlayerZombie(client))
if (!InfectIsClientInfected(client))
{
return;
}
// 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)
{
return;
@ -126,13 +126,13 @@ ZombieSoundsOnClientDeath(client)
ZombieSoundsOnClientHurt(client)
{
// If player isn't a zombie, then stop.
if (!IsPlayerZombie(client))
if (!InfectIsClientInfected(client))
{
return;
}
// 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)
{
return;
@ -157,7 +157,7 @@ ZombieSoundsOnClientHurt(client)
ZombieSoundsOnClientInfected(client)
{
// 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)
{
return;
@ -245,7 +245,7 @@ bool:ZombieSoundsGetRandomSound(String:sound[], ZombieSounds:soundtype)
public Action:ZombieSoundsMoanTimer(Handle:timer, any:client)
{
// 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.
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 (!IsPlayerHuman(client))
if (!InfectIsClientHuman(client))
{
return Plugin_Stop;
}

View File

@ -390,7 +390,7 @@ bool:ZTele(client)
}
// Check limits.
if (IsPlayerHuman(client))
if (InfectIsClientHuman(client))
{
new human_limit = GetConVarInt(g_hCvarsList[CVAR_ZTELE_HUMAN_LIMIT]);
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 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_limit = GetConVarInt(g_hCvarsList[CVAR_ZTELE_HUMAN_LIMIT]);

View File

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

View File

@ -79,7 +79,7 @@ public bool:Market_OnWeaponSelected(client, String:weaponid[])
}
// If player is a zombie, then stop.
if (IsPlayerZombie(client))
if (InfectIsClientInfected(client))
{
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 (IsPlayerZombie(client))
if (InfectIsClientInfected(client))
{
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 (IsPlayerZombie(client) && !StrEqual(weaponname, "knife"))
if (InfectIsClientInfected(client) && !StrEqual(weaponname, "knife"))
{
return 0;
}

View File

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

View File

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

View File

@ -5,8 +5,6 @@
* Author: Greyscale
* ====================
*/
new String:skyname[32];
HookCommands()
{
@ -27,7 +25,7 @@ public Action:Command_NightVision(client, argc)
return;
}
if (!IsPlayerZombie(client))
if (!InfectIsClientInfected(client))
{
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)
{
new Float:vel[3];
@ -110,14 +82,4 @@ RemoveObjectives()
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 (human && !IsPlayerHuman(x))
if (human && !InfectIsClientHuman(x))
{
continue;
}
@ -117,7 +117,7 @@ ZRCreateEligibleClientList(&Handle:arrayEligibleClients, bool:team = false, bool
* @param console True to include console (index 0), false if not.
* @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 (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 (IsPlayerZombie(x))
if (InfectIsClientInfected(x))
{
zombiecount++;
}
// If player is a human, then increment human variable.
else if (IsPlayerHuman(x))
else if (InfectIsClientHuman(x))
{
humancount++;
}
@ -191,7 +191,7 @@ bool:ZRCountValidClients(&zombiecount = 0, &humancount = 0, bool:alive = true, b
bool:ZRIsClientOnTeam(client, team = -1)
{
// If index is invalid, then stop.
if (!ZRIsValidClient(client))
if (!ZRIsClientValid(client))
{
return false;
}
@ -234,7 +234,7 @@ bool:ZRTeamHasClients(team = -1)
bool:ZRIsClientAdmin(client)
{
// If index is invalid, then stop.
if (!ZRIsValidClient(client))
if (!ZRIsClientValid(client))
{
return false;
}