Store data for each or non entity ( Like pev )
Hello alliedmodders!
What i want to do is hold data for each or non entity. This means i may need to hold data for some entity or for no entity or for all entities. Using those pevs that engine dont use well there is problem. I dont know for sure what engine uses and what dont. I know for now some but this is not enough. I want x number of avable data store places for each entity. ( x, since i dont know yet how many i need and i like to keep thing dynamic ) First thought of mine was global arrays like this: entity_something[1300] But since i can not do x arrays like that this is bad. Then second idea was cellarray or dynamic array. Since we can not hook when entity is created i can not make a data store space for that entity. I have to make that data space for my costom entities and also for those entities what already exists in game like for example player(1-32), map entities, entities what ohter plugin create etc... What im really doing then its like entity data api like pev in fakemeta and that thing in engine but you can also create those things what hold data... sorry im not very good at explaining. Does anyone have any idea how should i do it? Thanks! |
Re: Store data for each or non entity ( Like pev )
You can hook when entities are created (but I'm not sure it will work with plugin-created entites). Also, use a dynamic array if you need to have an array with unknown length.
If you are trying to store info about EVERY entity then there is probably something wrong with the approach to your goal. It seems that this may be yet another XY problem. Please explain what your end goal is without saying how you are trying to accomplish it. |
Re: Store data for each or non entity ( Like pev )
Youre right! It is XY problem.
If i write here everything then i dont think you can reach the end of my text and i will just waste so much time writing it. ( It is not something what i want to hide, i can handle criticism... ) Anyway, when i can hook when every entity is create ( including the one what are creating while map is already loaded ) then i can create dynamic array inside of dynamic array what hold data space for that entity and by classname i know what type or how many data space i should create to this entity. Doing some search some weeks ago i found that there is no way to check when entity is created. You can hook most entities what are created according to the text and by testing my self i did found something what i didint like. Cant remember what but something that make my idea impossible. |
Re: Store data for each or non entity ( Like pev )
You didn't fix the XY problem. You basically said the same thing.
Why don't you try hooking when the entity spawns? |
Re: Store data for each or non entity ( Like pev )
Use pev_iuser1..4 and pev_fuser1..4.
i for integer. and f for float values. Code:
pev_iuser2 and pev_iuser3 are already in use on player entity, they hold information about last spectated and current spectating player. |
Re: Store data for each or non entity ( Like pev )
With any plugin you can hook FM_CreateNamedEntity, FM_CreateEntity
With orpheu you can hook engfunc() then filter EngFunc_CreateEntity and EngFunc_CreateNamedEntity. You can't hook create_entity for now because there is a problem between engine (hlds) and engine (amxx module) library names, unless Arkshine has fixed it but i don't think so. So yes, you can hook entities creations, and you should be able to hook entities removal as well. Anyway, such an api seems to be a waste of cpu/memory if it is done in a plugin, and should be done in a module. Also, i don't see how such an api would be usefull, could you explain what you have in mind ? |
| All times are GMT -4. The time now is 10:11. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.