Fixed invalid client index errors.

This commit is contained in:
richard 2008-10-08 16:05:34 +02:00
parent f26ad4d82e
commit d466f06507
4 changed files with 27 additions and 6 deletions

View File

@ -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 2008.10.08 - 2.5.1.3
* Made the console commands zr_set_class_knockback and zr_get_class_knockback. * Made the console commands zr_set_class_knockback and zr_get_class_knockback.

View File

@ -15,7 +15,7 @@
#undef REQUIRE_PLUGIN #undef REQUIRE_PLUGIN
#include <market> #include <market>
#define VERSION "2.5.1.4" #define VERSION "2.5.1.5"
#include "zr/zombiereloaded" #include "zr/zombiereloaded"
#include "zr/global" #include "zr/global"
@ -110,6 +110,7 @@ public OnLibraryAdded(const String:name[])
public OnMapStart() public OnMapStart()
{ {
maxclients = GetMaxClients();
MapChangeCleanup(); MapChangeCleanup();
LoadModelData(); LoadModelData();

View File

@ -48,7 +48,7 @@ public TraceAttack(client, inflictor, attacker, damage, hitbox, hitgroup)
{ {
new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]); new bool:enabled = GetConVarBool(gCvars[CVAR_ENABLE]);
if (!attacker || !IsClientConnected(attacker) || !IsClientInGame(attacker) || !enabled) if (!attacker || !IsClientPlayer(attacker) || !IsClientInGame(attacker) || !enabled)
{ {
return Hacks_Continue; return Hacks_Continue;
} }
@ -99,7 +99,7 @@ public OnTakeDamage(client, inflictor, attacker, damage, damagetype, ammotype)
if (damagetype & DMG_BLAST) if (damagetype & DMG_BLAST)
{ {
if (!IsPlayerHuman(client) || !IsClientInGame(attacker)) if (!IsPlayerHuman(client) || !IsClientPlayer(attacker) || !IsClientInGame(attacker))
{ {
return Hacks_Continue; return Hacks_Continue;
} }
@ -109,12 +109,12 @@ public OnTakeDamage(client, inflictor, attacker, damage, damagetype, ammotype)
if (damagetype & DMG_BULLET) if (damagetype & DMG_BULLET)
{ {
if (!client || !IsClientInGame(client)) if (!client || !IsClientPlayer(client) || !IsClientInGame(client))
{ {
return Hacks_Continue; return Hacks_Continue;
} }
if (!attacker || !IsClientInGame(attacker)) if (!attacker || !IsClientPlayer(attacker) || !IsClientInGame(attacker))
{ {
return Hacks_Continue; return Hacks_Continue;
} }

View File

@ -53,6 +53,8 @@ new teleCount[MAXPLAYERS+1];
new protCount[MAXPLAYERS+1]; new protCount[MAXPLAYERS+1];
new Float:spawnLoc[MAXPLAYERS+1][3]; new Float:spawnLoc[MAXPLAYERS+1][3];
new maxclients;
new Handle:tRound = INVALID_HANDLE; new Handle:tRound = INVALID_HANDLE;
new Handle:tInfect = INVALID_HANDLE; new Handle:tInfect = INVALID_HANDLE;
@ -187,4 +189,16 @@ bool:IntToBool(intval)
{ {
return true; return true;
} }
} }
bool:IsClientPlayer(client)
{
if (client > 1 || client <= maxclients)
{
return true;
}
else
{
return false;
}
}