Raised This Month: $ Target: $400
 0% 

[TFCX-REQ] bool:is_user_infected(id)


  
 
 
Thread Tools Display Modes
Author Message
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 12-06-2006 , 16:58   [TFCX-REQ] bool:is_user_infected(id)
#1

hi, another little request for the tfc module.
is_user_infected, here is an example that i found in the foxbot sourcecode (bot_combat.cpp)

Code:
bool BotIsInfected(edict_t *pEntity)  
{  
	edict_t *pent = NULL;  
	while ((pent = FIND_ENTITY_BY_CLASSNAME( pent, "timer" )) != NULL && (!FNullEnt(pent))) 
	{ 
		//UTIL_SavePent(pent);
		if((pent->v.owner == pEntity) && pent->v.enemy)  
		{  			
			if ((pent->v.enemy->v.playerclass == TFC_CLASS_MEDIC))
				return true;
		} 
	}
	return FALSE;  
}
__________________
Um, hi.

Last edited by Ramono; 12-06-2006 at 17:01.
Ramono is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 12-06-2006 , 19:09   Re: [TFCX-REQ] bool:is_user_infected(id)
#2

Should be renamed to is_user_medic()...
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-06-2006 , 23:37   Re: [TFCX-REQ] bool:is_user_infected(id)
#3

No. It finds an entity that tracks if a player is infected (among, probably, other things), and compares that entity's owner to the player in question. If it's a match, then it checks that special entity's enemy, which is the player that caused the effect. And, if they're a medic, then the effect must be medic poisoning.

Viola.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
BAILOPAN
Join Date: Jan 2004
Old 12-07-2006 , 03:25   Re: [TFCX-REQ] bool:is_user_infected(id)
#4

Viola? Did you mean voilá? ;]

Nonetheless, this looks like a native that could be implemented fairly easily with native scripting. If you need help doing that, reply and we can assist you. Unless you have a specific reason for wanting a native version, it's easier for both of us not to have it (since you have to a)wait for a potentially far away release and b)I have to implement+test it), and it doesn't add anything that can't be done with native code.
__________________
egg
BAILOPAN is offline
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 12-07-2006 , 05:00   Re: [TFCX-REQ] bool:is_user_infected(id)
#5

I dont understand c++/c so i could use some help with this,

I think this doesnt work because i cant get a grip on this line.
if((pent->v.owner == pEntity) && pent->v.enemy)
Code:
#include <engine>
#include <amxmodx>
bool:is_user_infected(id) {
	new ent = -1
	new owner
	while(find_ent_by_classname(ent,"timer") {
		owner = entity_get_edict(ent,EV_ENT_owner)
		if(entity_get_int(entity_get_int(owner, EV_INT_playerclass) == 5) // medic
		{
			return true
		}
	}
	return false
}
__________________
Um, hi.
Ramono is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 12-07-2006 , 07:06   Re: [TFCX-REQ] bool:is_user_infected(id)
#6

A direct port of the original code:
Code:
bool:BotIsInfected(pEntity) {         new pent = -1;         while ((pent = find_ent_by_class( pent, "timer" )) && (is_valid_ent(pent)))         {                 //UTIL_SavePent(pent);                 if((entity_get_edict(pent, EV_ENT_owner) == pEntity) && entity_get_edict(pent, EV_ENT_enemy))                 {                                               if ((entity_get_int(entity_get_edict(pent, EV_ENT_enemy), EV_INT_playerclass) == TFC_CLASS_MEDIC))                                 return true;                 }         }         return false; }
VEN is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-07-2006 , 15:42   Re: [TFCX-REQ] bool:is_user_infected(id)
#7

Quote:
Originally Posted by BAILOPAN View Post
Viola? Did you mean voilá? ;]
:(
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 01-22-2007 , 07:42   Re: [TFCX-REQ] bool:is_user_infected(id)
#8

Alternative provided + no response; closing.
__________________
fyren sucks
sawce is offline
 



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 16:53.


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