Skip to content

API: Add hooks ED_Alloc() and ED_Free()#227

Merged
wopox1337 merged 9 commits intorehlds:masterfrom
DarthMan:HOOK-ED_Alloc-and-ED_Free
Oct 24, 2021
Merged

API: Add hooks ED_Alloc() and ED_Free()#227
wopox1337 merged 9 commits intorehlds:masterfrom
DarthMan:HOOK-ED_Alloc-and-ED_Free

Conversation

@DarthMan
Copy link
Contributor

Since people do not seem to care, I tried to add the hook myself, I am not sure if all is good but this should be.
So please control my work and merge it to the repository as soon as possible, because I need in emergency those hooks for some plugins I'm coding.
Also, if possible please:

  • Merge "Con_Printf" hook on ReHLDS repo.
  • Merge the other reapi hooks on reapi repo.
  • Make a public release for the two updated binaries.

Thanks!

@DarthMan
Copy link
Contributor Author

DarthMan commented Oct 22, 2021

EDIT: I removed the lines that I believe caused compilation errors from rehlds_api.h.

@wopox1337 wopox1337 changed the title API: Add hooks ED_Alloc and ED_Free API: Add hooks ED_Alloc() and ED_Free() Oct 23, 2021
@wopox1337 wopox1337 self-requested a review October 23, 2021 10:58
@wopox1337 wopox1337 added the Type: 🚀 enhancement Improvement or addition of a new feature. label Oct 23, 2021
@wopox1337
Copy link
Member

@DarthMan resolve conflicts please

@DarthMan
Copy link
Contributor Author

DarthMan commented Oct 23, 2021

@DarthMan resolve conflicts please

Sorry, I am not home for a few days, can't do anything about it now. But it's all about the SV_EmitPings and the SV_Connect whatever additions to the files, I guess.

@wopox1337
Copy link
Member

@DarthMan I got you. No problem, I'll update it myself.

@DarthMan
Copy link
Contributor Author

@DarthMan I got you. No problem, I'll update it myself.

Sure, sounds good.

@wopox1337 wopox1337 force-pushed the HOOK-ED_Alloc-and-ED_Free branch from 85b29dc to 8e421a1 Compare October 24, 2021 11:57
@wopox1337 wopox1337 merged commit 866295f into rehlds:master Oct 24, 2021
@wopox1337
Copy link
Member

Can someone explain to me what is the practical meaning of the ED_Alloc hook for AMXX? We can't prevent the call, and we can't influence the entity at the moment of creation.

@DarthMan
Copy link
Contributor Author

@wopox1337 it's called when an entity is created. I use it in a plugin as post to add entity to array list, then on ED_Free post I check if it's in the array list, then I remove it from there if so. It's very usefull, as this way I can make sure that the entity id was valid before the entity got removed, and is not just a random number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: 🚀 enhancement Improvement or addition of a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants