Module: Custom Entity Data
Description:
This module lets you bind custom user data to entities without dealing with fields like pev_iuser[1-4] or similar. The reason this module is created is that this way you are not limited by the amount of pev_* fields and plugins or the game dll won't interfere with each other (modifying the same pev_* fields). API: The API is pretty similar to the Trie API - you can retrieve or set cells, arrays and strings, which are identified by a string key. When an entity is destroyed, all data bound to it gets destroyed too - that means that you have to free any handles (like Trie, Array, Stack or others) bound to that entity or they will get lost/leaked.
customentdata.inc
Install instructions: Put customentdata_amxx.dll (Windows) or customentdata_amxx_i386.so (Linux) into $moddir/addons/amxmodx/modules. Todo:
Downloads: Source code on GitHub |
Re: Module: Custom Entity Data
Awesome
|
Re: Module: Custom Entity Data
One entity data module to rule them all.
Thank you master Klippy. |
Re: Module: Custom Entity Data
Good job, but you can hook OnFreeEntPrivateData from API instead of hooking ED_Free.
|
Re: Module: Custom Entity Data
Thank you peeps.
@PRoSToTeM@: I just took a look, that would be more proper, thanks, I'll fix that soon. |
Re: Module: Custom Entity Data
Updated per PRoSToTeM@'s suggestion.
|
Re: Module: Custom Entity Data
You misunderstood me. I mean hook OnFreeEntPrivateData via NewDLL API. You should uncomment
PHP Code:
PHP Code:
|
Re: Module: Custom Entity Data
I am aware of that it exists there, but calls to engine/game dll functions via Metamod plugins aren't propagated to other Metamod plugins IIRC. That's why for example you can't hook FM_PrecacheModel that other AMXX plugin executed. That's why I kept on using CHooker.
|
Re: Module: Custom Entity Data
There are two kinds of functions in API that you can call (they are located in engfuncs) and that you can hook (events) (I mean original API from engine, not metamod, they are located in EntityAPI(2) and NewDLLFunctions). PrecacheModel is that you can call, so basically you can hook it to customize gamedll behaviour only. FreeEntPrivateData has two versions FreeEntPrivateData that you can call (engfunc) and OnFreeEntPrivateData event (NewDllFunction). FreeEntPrivateData engfunc calls OnFreeEntPrivateData (you can see that in ReHLDS). So, you can hook OnFreeEntPrivateData via API without any problems. Emulating OnFreeEntPrivateData can break some code in gamedll, this is like undefined behaviour (I mean fakecall from some plugin).
|
Re: Module: Custom Entity Data
I was thinking on doing something like this, I complained because I thought it would be slow. Good job, this kind of addons will have a big impact if is integrated in the main AMXX package.
|
All times are GMT -4. The time now is 21:26. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.