how to prevent registerhamfromentity being called for whole classname
RegisterHamFromEntity(Ham_Killed, ent, "fw_killed",1)
RegisterHamFromEntity(Ham_TakeDamage, ent, "fw_takedamage_ent",1) in ent create func when I do damage or kill ent forward(s) calls as many times as many entities in the world example there are two ents. 1 hit to ent makes two fwd calls 4 ents - 8 fwd calls. how to filter it to have 1 forward call per one entity ? I want to spawn entity again after kill . So now I have 2 ents instead of 1 than 4 instead of 2 and so on . engfunc(EngFunc_AllocString, "info_target")) I Know I can register it for info_target than filter for classname but not sure also I cant give weapon to ent entity_set_string(ent, EV_SZ_weaponmodel, knifemdl) doesnt work |
Re: how to prevent registerhamfromentity being called for whole classname
why do you register hamkilled? It's not necessary, hook damage pre and if damage > health, hook a death event for entities where you do all you need when the entity must be removed.
|
Re: how to prevent registerhamfromentity being called for whole classname
Ive already tried that
I have Two bots-entities. look at the log 1st hit produce TWO lines instead of ONE , for EACH entity in the world L 11/12/2014 - 13:28:09: [soccer.amxx] damage 65.00 victim health 35.00 L 11/12/2014 - 13:28:09: [soccer.amxx] damage 65.00 victim health 35.00 second hit also 2 lines L 11/12/2014 - 13:28:12: [soccer.amxx] damage 65.00 victim health -30.00 L 11/12/2014 - 13:28:12: [soccer.amxx] damage 65.00 victim health -30.00 So condition below makes TWO entities instead of "killed" one PHP Code:
2 calls of forward multiply 2 entities = 4 If I have 4 bots-entities. killing just ONE makes over 8 new bots.... I need to filter just one ent being damaged to prevent multiple fwd calls |
Re: how to prevent registerhamfromentity being called for whole classname
Man that must not be a real problem. Just check amount of entities that exists and return if already have the necessary ents.
|
Re: how to prevent registerhamfromentity being called for whole classname
Why do you need this forward? Why you don't register with classname? Explain better, give a context.
|
Re: how to prevent registerhamfromentity being called for whole classname
Quote:
|
Re: how to prevent registerhamfromentity being called for whole classname
Hamsandwich registers callbacks on entity classes, always. RegisterHamFromEntity gets the virtual table from an entity, but still registers the callback on the whole class of that entity. Registering a Ham callback on a single entity is not possible, and you have to do such filtering in your plugin code. Registering from two different entities that have the same class will register two callbacks onto that class, and as such the callback will be called twice. All of this is expected with the design of Hamsandwich.
|
Re: how to prevent registerhamfromentity being called for whole classname
thanks, I will make different classes for both ents . [solved]
|
| All times are GMT -4. The time now is 17:35. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.