pev_valid is needed here?

Сообщения
219
Реакции
42
Well, I saw on ZP when doing things with pdata offsets.
It checks befores if entity is safe with pev_valid native.

For example:
Код:
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage_Post", 1)

public fw_TakeDamage_Post(victim)
{
    // Prevent server crash if entity's private data not initalized
    if (pev_valid(victim) != 2) return;

    set_pdata_float(victim, OFFSET_PAINSHOCK, 1.0, OFFSET_LINUX)
}

Entity always be a player and if he receives damage should be valid ent...
Why is the reason to check this?
Is needed nowadays?

Where is needed to check pev_valid entity?
 
Последнее редактирование:
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
First argument that link on entity is always valid in ham, if not immediately deleted in pre hook.
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу