AddEntityHasValue mod func
As you may already know custom entities(created by amxx) are not taken into account by the dll, because it cache the ent list. So, if you create a weaponbox ent during a round and you want it to be deleted by the game it won't.
A solution my be to redo the WeaponBoxKill function, and to do the things as the game: PHP Code:
But I don't like to reinvent the wheel and by searching a bit I found that we can call with okapi/orpheu AddEntityHasValue for our custom entity so the game will take it into account. From here the problem starts, I think that this function use some unsuported param by okapi/orpheu. Here is my code: Code:
The function header is: Code:
AddEntityHashValue(entvars_s *,char const *,hash_types_e)My question is: it's possible to register that function with okapi/orpheu so I can call it on my custom entity and solve the problem ? If not, do you have another alternative( without re-doing the c++ code ), which is here if anyone needs it: Code:
|
Re: AddEntityHasValue mod func
Yeah, you're right, each new entity created, you see a hash is created from its class name, for performance reason.
About the entity creation, I'm talking about pfnCreateNamedEntity, but in the mod, it basically uses a custom function, which calls pfnCreateNamedEntity and AddEntityHashValue, that's why, using AMXX it doesn't work because it calls directly the engine function. Also, the game is using a custom function UTIL_FindEntityByString to find an entity, which basically loops over the hash table. Right now it supports only the classname. "hash_types_e" is just an enum (has only one item defined for classname and it's 0 as value), so you can replace by "int". The same. You can actually see the actual hash map using the server command print_ent. And you can see the difference in performance using without and with hash using this command : perf_test You can use arg_int for last param for okapi. You could also use CREATE_NAMED_ENTITY() from the mod, the custom function I'm talking about. This could be a good idea to add it to cstrike module since specific to CS, maybe either cs_create_entity or natives to add/remove hash item, don't know. |
Re: AddEntityHasValue mod func
Code:
Time in old search loop 3.8373I've already looked at CreateNamedEntity and I saw exactly what you wrote, that it calls AddEntityHasValue. Thx for the info, will try to replace it by arg_int. One more thing, can you please check if the windows signature is correct ? Yes, it would be very good to a native for alterating hash items. So, another way is to create the weaponbox with CREATE_NAMED_ENTITY ? |
Re: AddEntityHasValue mod func
This seems the wrong signature, mine is:
Code:
8B ? ? ? 83 ? ? 85 ? 53 55 56 57 0F ? ? ? ? ? 8B |
Re: AddEntityHasValue mod func
Can you tell me how you find it ? AddEntityHasValue doesn't have strings so we can't search in the swds.dll by strings, I'm a bit confused.
|
Re: AddEntityHasValue mod func
It's used in several places, just picked up one randomly. Here ServerActivate, it contains a reference to AddEntityHashValue and a string "Can't instance %s\n".
Code:
if (pClass && !(pClass->pev->flags & FL_DORMANT)) |
Re: AddEntityHasValue mod func
Thx for all the info. Some suggestion for amxx, idc where to post them, since I can't create the c++ code:
1. Add the native for hash values. 2. Add a forward that will catch all cvar changes, this is very useful, we won't need to cache cvars on new round or so. Like cvar index( the one returned by register_cvar ), old value, new value. 3. Add a native so we can calculate the velocity considering punch angle and view angle, this is very used and it's becoming annoing to see the same code in 50% of the plugins. |
Re: AddEntityHasValue mod func
So, instead of hooking AddEntityHashValue, just hook CREATE_NAMED_ENTITY and that would be enough
|
| All times are GMT -4. The time now is 17:34. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.