Raised This Month: $ Target: $400
 0% 

Store data for each or non entity ( Like pev )


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 01-14-2014 , 18:33   Store data for each or non entity ( Like pev )
Reply With Quote #1

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!
.Dare Devil. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-14-2014 , 19:36   Re: Store data for each or non entity ( Like pev )
Reply With Quote #2

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.
__________________
fysiks is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 01-14-2014 , 21:09   Re: Store data for each or non entity ( Like pev )
Reply With Quote #3

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.
.Dare Devil. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-14-2014 , 22:03   Re: Store data for each or non entity ( Like pev )
Reply With Quote #4

You didn't fix the XY problem. You basically said the same thing.

Why don't you try hooking when the entity spawns?
__________________

Last edited by fysiks; 01-14-2014 at 22:06.
fysiks is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 01-14-2014 , 22:11   Re: Store data for each or non entity ( Like pev )
Reply With Quote #5

Use pev_iuser1..4 and pev_fuser1..4.

i for integer.
and f for float values.

Code:
set_pev(ent,pev_iuser1,31337) pev(ent,pev_iuser1)

pev_iuser2 and pev_iuser3 are already in use on player entity, they hold information about last spectated and current spectating player.
__________________
The functional way is the right way

Last edited by GordonFreeman (RU); 01-14-2014 at 22:12.
GordonFreeman (RU) is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-14-2014 , 23:36   Re: Store data for each or non entity ( Like pev )
Reply With Quote #6

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 ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode