This thread is to talk about when is a must to check if entity is valid.
For example, I see on many plugins that check if entity is valid inside:
Is this check necessary?
I'm trying to achieve remove unnecessary calls to pev_valid or similars like is_nullent introduced on ReAPI.
I'm talking about this:
For example, I see on many plugins that check if entity is valid inside:
- Fakemeta hooks like FM_ShouldCollide.
- Hamsandwich hooks like Ham_Item_AddToPlayer.
- Engine hooks like register_touch.
Is this check necessary?
I'm trying to achieve remove unnecessary calls to pev_valid or similars like is_nullent introduced on ReAPI.
I'm talking about this:
Код:
register_forward(FM_ShouldCollide, "fw_ShouldCollide");
public fw_ShouldCollide(playerindex, entindex) {
if( !pev_valid(playerindex) || !pev_valid(entindex) )
return FMRES_IGNORED;
// continue code....
}