From 2e623447d554c3709af4c0885b5c2fd4c1d93315 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Fri, 24 Apr 2009 05:02:19 +0200 Subject: [PATCH] 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. --- .../gamedata/plugin.zombiereloaded.txt | 6 -- src/zombiereloaded.sp | 14 ++--- src/zr/anticamp.inc | 2 +- src/zr/antistick.inc | 2 +- src/zr/commands.inc | 8 +-- src/zr/cvars.inc | 36 +++++------ src/zr/damage.inc | 28 +++++---- src/zr/event.inc | 18 ++++-- src/zr/infect.inc | 60 +++++++++++++++---- src/zr/knockback.inc | 8 +-- src/zr/log.inc | 2 +- src/zr/napalm.inc | 2 +- src/zr/offsets.inc | 16 ----- src/zr/playerclasses/classevents.inc | 2 +- src/zr/playerclasses/clientoverlays.inc | 2 +- src/zr/playerclasses/filtertools.inc | 2 +- src/zr/playerclasses/playerclasses.inc | 2 +- src/zr/respawn.inc | 8 +-- src/zr/soundeffects/ambientsounds.inc | 2 +- src/zr/soundeffects/soundeffects.inc | 14 ++++- src/zr/soundeffects/zombiesounds.inc | 12 ++-- src/zr/spawnprotect.inc | 2 +- src/zr/teleport.inc | 4 +- src/zr/translation.inc | 2 +- src/zr/weapons/markethandler.inc | 2 +- src/zr/weapons/restrict.inc | 4 +- src/zr/zadmin.inc | 2 +- src/zr/zhp.inc | 2 +- src/zr/zombie.inc | 40 +------------ src/zr/zombiereloaded.inc | 12 ++-- 30 files changed, 158 insertions(+), 158 deletions(-) diff --git a/cstrike/addons/sourcemod/gamedata/plugin.zombiereloaded.txt b/cstrike/addons/sourcemod/gamedata/plugin.zombiereloaded.txt index e742e29..1289a0e 100644 --- a/cstrike/addons/sourcemod/gamedata/plugin.zombiereloaded.txt +++ b/cstrike/addons/sourcemod/gamedata/plugin.zombiereloaded.txt @@ -10,12 +10,6 @@ "Offsets" { - "EyePosition" - { - "windows" "117" - "linux" "118" - } - "EyeAngles" { "windows" "206" diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp index dd26bbf..08cf672 100644 --- a/src/zombiereloaded.sp +++ b/src/zombiereloaded.sp @@ -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(); } diff --git a/src/zr/anticamp.inc b/src/zr/anticamp.inc index 70b6a52..0c02fa5 100644 --- a/src/zr/anticamp.inc +++ b/src/zr/anticamp.inc @@ -348,7 +348,7 @@ HurtPlayersInVolume(volume_index) { if (IsClientInGame(x) && IsPlayerAlive(x) && - IsPlayerHuman(x)) + InfectIsClientHuman(x)) { if (IsPlayerInVolume(x, volume_index)) { diff --git a/src/zr/antistick.inc b/src/zr/antistick.inc index 96254f2..724e5bb 100644 --- a/src/zr/antistick.inc +++ b/src/zr/antistick.inc @@ -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; diff --git a/src/zr/commands.inc b/src/zr/commands.inc index 7662c21..c326a90 100644 --- a/src/zr/commands.inc +++ b/src/zr/commands.inc @@ -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); } diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index 1f3f7f0..9d9bd90 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -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", ""); diff --git a/src/zr/damage.inc b/src/zr/damage.inc index 1015dbe..ff3603f 100644 --- a/src/zr/damage.inc +++ b/src/zr/damage.inc @@ -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]); diff --git a/src/zr/event.inc b/src/zr/event.inc index 6d1647f..31b4757 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -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); diff --git a/src/zr/infect.inc b/src/zr/infect.inc index 038fd2e..2dd18eb 100644 --- a/src/zr/infect.inc +++ b/src/zr/infect.inc @@ -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]; } \ No newline at end of file diff --git a/src/zr/knockback.inc b/src/zr/knockback.inc index 9a1004d..3d9a703 100644 --- a/src/zr/knockback.inc +++ b/src/zr/knockback.inc @@ -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]; diff --git a/src/zr/log.inc b/src/zr/log.inc index 8aeb64c..6e3a36f 100644 --- a/src/zr/log.inc +++ b/src/zr/log.inc @@ -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); diff --git a/src/zr/napalm.inc b/src/zr/napalm.inc index 76187d3..fa0c851 100644 --- a/src/zr/napalm.inc +++ b/src/zr/napalm.inc @@ -23,7 +23,7 @@ NapalmOnClientHurt(client, const String:weapon[]) { // If player isn't a zombie, then stop. - if (!IsPlayerZombie(client)) + if (!InfectIsClientInfected(client)) { return; } diff --git a/src/zr/offsets.inc b/src/zr/offsets.inc index e3088d9..4544149 100644 --- a/src/zr/offsets.inc +++ b/src/zr/offsets.inc @@ -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); diff --git a/src/zr/playerclasses/classevents.inc b/src/zr/playerclasses/classevents.inc index 27e50e5..efcb9a4 100644 --- a/src/zr/playerclasses/classevents.inc +++ b/src/zr/playerclasses/classevents.inc @@ -22,7 +22,7 @@ */ ClassClientInit(client) { - if (ZRIsValidClient(client)) + if (ZRIsClientValid(client)) { // Set default class indexes on the player. ClassClientSetDefaultIndexes(client); diff --git a/src/zr/playerclasses/clientoverlays.inc b/src/zr/playerclasses/clientoverlays.inc index c02cf9c..1a55972 100644 --- a/src/zr/playerclasses/clientoverlays.inc +++ b/src/zr/playerclasses/clientoverlays.inc @@ -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; diff --git a/src/zr/playerclasses/filtertools.inc b/src/zr/playerclasses/filtertools.inc index 30f29c6..316780c 100644 --- a/src/zr/playerclasses/filtertools.inc +++ b/src/zr/playerclasses/filtertools.inc @@ -331,7 +331,7 @@ ClassGetActiveIndex(client) return -1; } - if (IsPlayerHuman(client)) + if (InfectIsClientHuman(client)) { teamid = ZR_CLASS_TEAM_HUMANS; } diff --git a/src/zr/playerclasses/playerclasses.inc b/src/zr/playerclasses/playerclasses.inc index 6b4d4d2..a126ada 100644 --- a/src/zr/playerclasses/playerclasses.inc +++ b/src/zr/playerclasses/playerclasses.inc @@ -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; } diff --git a/src/zr/respawn.inc b/src/zr/respawn.inc index 030ce1e..3cdb586 100644 --- a/src/zr/respawn.inc +++ b/src/zr/respawn.inc @@ -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; } } diff --git a/src/zr/soundeffects/ambientsounds.inc b/src/zr/soundeffects/ambientsounds.inc index 664271b..335a908 100644 --- a/src/zr/soundeffects/ambientsounds.inc +++ b/src/zr/soundeffects/ambientsounds.inc @@ -122,7 +122,7 @@ AmbientSoundsOnRoundStart() * * @param client The client index. */ -AmbientSoundsOnClientSpawn(client) +AmbientSoundsOnClientSpawnPost(client) { // If ambience is disabled, then stop. if (!g_bAmbientSounds) diff --git a/src/zr/soundeffects/soundeffects.inc b/src/zr/soundeffects/soundeffects.inc index 8982d77..c8ef11f 100644 --- a/src/zr/soundeffects/soundeffects.inc +++ b/src/zr/soundeffects/soundeffects.inc @@ -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); diff --git a/src/zr/soundeffects/zombiesounds.inc b/src/zr/soundeffects/zombiesounds.inc index c14b1c0..85bf4f3 100644 --- a/src/zr/soundeffects/zombiesounds.inc +++ b/src/zr/soundeffects/zombiesounds.inc @@ -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; diff --git a/src/zr/spawnprotect.inc b/src/zr/spawnprotect.inc index 042a67e..89e4929 100644 --- a/src/zr/spawnprotect.inc +++ b/src/zr/spawnprotect.inc @@ -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; } diff --git a/src/zr/teleport.inc b/src/zr/teleport.inc index ad1c2b9..158d0a1 100644 --- a/src/zr/teleport.inc +++ b/src/zr/teleport.inc @@ -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]); diff --git a/src/zr/translation.inc b/src/zr/translation.inc index 3717b01..5428305 100644 --- a/src/zr/translation.inc +++ b/src/zr/translation.inc @@ -19,7 +19,7 @@ stock ZR_PrintToChat(client, any:...) { decl String:phrase[192]; - if (ZRIsValidClient(client)) + if (ZRIsClientValid(client)) { SetGlobalTransTarget(client); diff --git a/src/zr/weapons/markethandler.inc b/src/zr/weapons/markethandler.inc index c6a83c7..83c119d 100644 --- a/src/zr/weapons/markethandler.inc +++ b/src/zr/weapons/markethandler.inc @@ -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"); diff --git a/src/zr/weapons/restrict.inc b/src/zr/weapons/restrict.inc index e8d7bf2..a2326a8 100644 --- a/src/zr/weapons/restrict.inc +++ b/src/zr/weapons/restrict.inc @@ -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; } diff --git a/src/zr/zadmin.inc b/src/zr/zadmin.inc index 8e9396e..5d51c43 100644 --- a/src/zr/zadmin.inc +++ b/src/zr/zadmin.inc @@ -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); } diff --git a/src/zr/zhp.inc b/src/zr/zhp.inc index 12fbfb8..9bf4d43 100644 --- a/src/zr/zhp.inc +++ b/src/zr/zhp.inc @@ -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; } diff --git a/src/zr/zombie.inc b/src/zr/zombie.inc index ec892db..24a6a04 100644 --- a/src/zr/zombie.inc +++ b/src/zr/zombie.inc @@ -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]; } \ No newline at end of file diff --git a/src/zr/zombiereloaded.inc b/src/zr/zombiereloaded.inc index bf04dc1..a6aa2ee 100644 --- a/src/zr/zombiereloaded.inc +++ b/src/zr/zombiereloaded.inc @@ -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; }