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

How to retrieve edict_t* from entvars_t


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bos93
Veteran Member
Join Date: Jul 2010
Old 01-21-2013 , 16:55   How to retrieve edict_t* from entvars_t
Reply With Quote #1

PHP Code:
inline edict_t *EntvarToEdict(entvars_t *pev)
{
    if (
pev==NULL)
    {
        return 
NULL;
    }
    
    return 
pev->pContainingEntity;
}; 
PHP Code:
#ifdef _WIN32
    
int __fastcall TakeDamage_Pre(void *pevVictimint ientvars_t *pevInflictorentvars_t *pevAttackerfloat flDamageint bitsDamage)
#elif __linux__
    
int TakeDamage_Pre(void *pevVictimentvars_t *pevInflictorentvars_t *pevAttackerfloat flDamageint bitsDamage)
#endif
{
    
edict_t Attacker EntvarToEdictpevAttacker );

    
UTIL_ColorChatAttacker"Called TakeDamage_Pre\n");

    return 
1;

Param not a client
__________________

Last edited by Bos93; 11-03-2013 at 06:10.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 01-21-2013 , 17:54   Re: How to retrieve edict_t* from entvars_t
Reply With Quote #2

what
__________________
micapat is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 01-21-2013 , 18:26   Re: How to retrieve edict_t* from entvars_t
Reply With Quote #3

edict_t * Attacker = EntvarToEdict( pevAttacker ); // get edict_t * Attacker

UTIL_ColorChat( Attacker, "Called TakeDamage_Pre\n"); // void UTIL_ColorChat(edict_t *pEntity, const char *pMessage, ...)

result: server crash,why ? I incorrectly retrieved edict_t ?
__________________

Last edited by Bos93; 01-21-2013 at 18:26.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
jim_yang
Veteran Member
Join Date: Aug 2006
Old 01-21-2013 , 18:50   Re: How to retrieve edict_t* from entvars_t
Reply With Quote #4

why you add RETURN_META_VALUE(MRES_IGNORED,*0); ? Is TakeDamage_Pre a meta api ?
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 01-21-2013 , 20:00   Re: How to retrieve edict_t* from entvars_t
Reply With Quote #5

You know that pevAttacker can be an entity which is not a client, right ?

Show us UTIL_ColorChat ?

"RETURN_META_VALUE(MRES_IGNORED,*0);" is useless.
__________________

Last edited by micapat; 01-21-2013 at 20:07.
micapat is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 01-22-2013 , 06:08   Re: How to retrieve edict_t* from entvars_t
Reply With Quote #6

solved
__________________

Last edited by Bos93; 01-22-2013 at 10:32.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 01-22-2013 , 06:31   Re: How to retrieve edict_t* from entvars_t
Reply With Quote #7

TakeDamage_Pre doesn't need to be done twice ( Windows & Linux Version ), mainly when you use some functions which are specific to Windows
__________________
micapat is offline
Reply



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:44.


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