From d466f06507c340fdc0212239ae0042f1965e2901 Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 8 Oct 2008 16:05:34 +0200 Subject: [PATCH] Fixed invalid client index errors. --- changelog.txt | 6 ++++++ src/zombiereloaded.sp | 3 ++- src/zr/damagecontrol.inc | 8 ++++---- src/zr/zombiereloaded.inc | 16 +++++++++++++++- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/changelog.txt b/changelog.txt index 8536c4d..d64c88a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +2008.10.08 - 2.5.1.5 + * Fixed invalid client index errors. + +2008.10.08 - 2.5.1.4 + * Fixed zombie moans not looping when interval is 0 (disabled). + 2008.10.08 - 2.5.1.3 * Made the console commands zr_set_class_knockback and zr_get_class_knockback. diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp index 213edd1..40b66e7 100644 --- a/src/zombiereloaded.sp +++ b/src/zombiereloaded.sp @@ -15,7 +15,7 @@ #undef REQUIRE_PLUGIN #include -#define VERSION "2.5.1.4" +#define VERSION "2.5.1.5" #include "zr/zombiereloaded" #include "zr/global" @@ -110,6 +110,7 @@ public OnLibraryAdded(const String:name[]) public OnMapStart() { + maxclients = GetMaxClients(); MapChangeCleanup(); LoadModelData(); diff --git a/src/zr/damagecontrol.inc b/src/zr/damagecontrol.inc index 1f537cd..1f14b0d 100644 --- a/src/zr/damagecontrol.inc +++ b/src/zr/damagecontrol.inc @@ -48,7 +48,7 @@ public TraceAttack(client, inflictor, attacker, damage, hitbox, hitgroup) { new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); - if (!attacker || !IsClientConnected(attacker) || !IsClientInGame(attacker) || !enabled) + if (!attacker || !IsClientPlayer(attacker) || !IsClientInGame(attacker) || !enabled) { return Hacks_Continue; } @@ -99,7 +99,7 @@ public OnTakeDamage(client, inflictor, attacker, damage, damagetype, ammotype) if (damagetype & DMG_BLAST) { - if (!IsPlayerHuman(client) || !IsClientInGame(attacker)) + if (!IsPlayerHuman(client) || !IsClientPlayer(attacker) || !IsClientInGame(attacker)) { return Hacks_Continue; } @@ -109,12 +109,12 @@ public OnTakeDamage(client, inflictor, attacker, damage, damagetype, ammotype) if (damagetype & DMG_BULLET) { - if (!client || !IsClientInGame(client)) + if (!client || !IsClientPlayer(client) || !IsClientInGame(client)) { return Hacks_Continue; } - if (!attacker || !IsClientInGame(attacker)) + if (!attacker || !IsClientPlayer(attacker) || !IsClientInGame(attacker)) { return Hacks_Continue; } diff --git a/src/zr/zombiereloaded.inc b/src/zr/zombiereloaded.inc index aae03b4..cd34c5d 100644 --- a/src/zr/zombiereloaded.inc +++ b/src/zr/zombiereloaded.inc @@ -53,6 +53,8 @@ new teleCount[MAXPLAYERS+1]; new protCount[MAXPLAYERS+1]; new Float:spawnLoc[MAXPLAYERS+1][3]; +new maxclients; + new Handle:tRound = INVALID_HANDLE; new Handle:tInfect = INVALID_HANDLE; @@ -187,4 +189,16 @@ bool:IntToBool(intval) { return true; } -} \ No newline at end of file +} + +bool:IsClientPlayer(client) +{ + if (client > 1 || client <= maxclients) + { + return true; + } + else + { + return false; + } +}