Well I guess I can answer my own question here
Code:
int is_ent_valid(int iEnt)
{
if (iEnt < 1 || iEnt > gpGlobals->maxEntities) // <-- shot in the balls here
return 0;
if (iEnt <= gpGlobals->maxClients)
{
if (!MF_IsPlayerIngame(iEnt))
{
return 0;
}
} else {
if (FNullEnt(TypeConversion.id_to_edict(iEnt)))
{
return 0;
}
}
return 1;
}
It still seems weird that 0 is not a valid ent, at least in the scope of this implementation / issue. I'll let you decide on that.
Code:
pev(1, pev_classname, classname, charsmax(classname)); //works fine if player is valid
pev(0, pev_classname, classname, charsmax(classname)); //works fine
pev(-1, pev_classname, classname, charsmax(classname)); //run time error
pev_valid(1) //returns 2
pev_valid(0) //returns 0
pev_valid(-1) //returns 0
seems inconsistent to me
__________________