Raised This Month: $51 Target: $400
 12% 

[REQUEST] find_ent_by_keyvalue


  
 
 
Thread Tools Display Modes
Author Message
karlos
Veteran Member
Join Date: Apr 2004
Location: Germany/Poland
Old 08-11-2005 , 09:25   [REQUEST] find_ent_by_keyvalue
#1

currently there is only a func to find by classname, target and targeetname

why not a dynamic one ?
if im right this function should make it ( i cannot code C/++ but i think its correct)

Code:
static cell AMX_NATIVE_CALL find_ent_by_keyvalue(AMX *amx, cell *params)
{
	edict_t *pEnt = INDEXENT2(params[1]);

	int len, len2;
	char* sKeyName = MF_GetAmxString(amx, params[2], 0, &len);
	char* sValue = MF_GetAmxString(amx, params[3], 0, &len2);

	pEnt = FIND_ENTITY_BY_STRING(pEnt, sKeyName, sValue);

	if (FNullEnt(pEnt))
		return 0;

	return ENTINDEX(pEnt);
}
and would be called like this:
Code:
find_ent_by_keyvalue( ent , keyname , keyvalue )
or maybe even make one to find ents with given keyname without specifying keyvalue
__________________
alias White Panther
karlos is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 08-11-2005 , 15:30  
#2

like this

Code:
int len;
	char* sKeyName = MF_GetAmxString(amx, params[2], 0, &len);
	char* sValue = MF_GetAmxString(amx, params[3], 1, &len);
Freecode is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 08-11-2005 , 19:16  
#3

We don't need this, we have FakeMeta:
Code:
EngFunc_FindEntityByString, // edict)    (edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue);
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
 



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 19:33.


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