Raised This Month: $ Target: $400
 0% 

Code doenst work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
UchihaSkills
Senior Member
Join Date: May 2013
Location: Germany
Old 07-16-2013 , 14:24   Code doenst work
Reply With Quote #1

PHP Code:
    new bool:bFindHull;
    
    if( 
flFraction >= ) {
        
engfuncEngFunc_TraceHullvStartvEndDONT_IGNORE_MONSTERSHULL_HEADiZombieiTr );
        
        
get_tr2iTrTR_flFractionflFraction );
        
        if( 
flFraction ) {
            
pHit get_tr2iTrTR_pHit );
            
            if( !
pHit ) {
                
bFindHull true
Why my code doesnt work?

Last edited by UchihaSkills; 07-16-2013 at 14:27.
UchihaSkills is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-16-2013 , 15:25   Re: Code doenst work
Reply With Quote #2

You should show more code, also, trace_hull may be better for what you need.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
UchihaSkills
Senior Member
Join Date: May 2013
Location: Germany
Old 07-16-2013 , 15:31   Re: Code doenst work
Reply With Quote #3

PHP Code:
 ZombieAttack( const iZombie ) {
    new 
Float:flFractionFloat:vStart], Float:vEnd], Float:vForward], iTr create_tr2( );
    new 
Float:vEndPos], pHit;
    
    
entity_get_vectoriZombieEV_VEC_originvStart );
    
    
entity_get_vectoriZombieEV_VEC_anglesvForward );
    
engfuncEngFunc_MakeVectorsvForward );
    
get_tr2iTrTR_flFractionflFraction ); 
I want to set it a target
UchihaSkills is offline
UchihaSkills
Senior Member
Join Date: May 2013
Location: Germany
Old 07-16-2013 , 15:35   Re: Code doenst work
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod View Post
You should show more code, also, trace_hull may be better for what you need.
Why is it better to use trace_hull?

Last edited by UchihaSkills; 07-16-2013 at 15:36.
UchihaSkills is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-16-2013 , 16:29   Re: Code doenst work
Reply With Quote #5

Could you post the full ZombieAttack code please ?

trace_hull integrates some trace results in its return, so you can gain some native calls using it, dunno if it is the case in your situation.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
UchihaSkills
Senior Member
Join Date: May 2013
Location: Germany
Old 07-16-2013 , 17:52   Re: Code doenst work
Reply With Quote #6

PHP Code:
 ZombieAttack( const iZombie ) {
    new 
Float:flFractionFloat:vStart], Float:vEnd], Float:vForward], iTr create_tr2( );
    new 
Float:vEndPos], pHit;
    
    
entity_get_vectoriZombieEV_VEC_originvStart );
    
    
entity_get_vectoriZombieEV_VEC_anglesvForward );
    
engfuncEngFunc_MakeVectorsvForward );
    
get_tr2iTrTR_flFractionflFraction );
    
    
vStart] += 28.0;
    
vEnd]    = vStart] + vForward] * 32.0;
    
vEnd]    = vStart] + vForward] * 32.0;
    
vEnd]    = vStart];
    
    
engfuncEngFunc_TraceLinevStartvEndDONT_IGNORE_MONSTERSiZombieiTr );
    
get_tr2iTrTR_flFractionflFraction );
    
    new 
bool:bFindHull;
    
    if( 
flFraction >= ) {
        
engfuncEngFunc_TraceHullvStartvEndDONT_IGNORE_MONSTERSHULL_HEADiZombieiTr );
        
        
get_tr2iTrTR_flFractionflFraction );
        
        if( 
flFraction ) {
            
pHit get_tr2iTrTR_pHit );
            
            if( !
pHit ) {
                
bFindHull true;
            }
        }
    } else
        
pHit get_tr2iTrTR_pHit );
    
    
get_tr2iTrTR_vecEndPosvEndPos );
    
    
free_tr2iTr );
    
    if( 
flFraction >= 1.0 || !IsPlayerpHit ) ) {
        
client_print0print_chat"[ Zombie: %i ] Missed. %s"iZombiebFindHull "FindHullIntersection!" "" ); 
UchihaSkills is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-16-2013 , 18:08   Re: Code doenst work
Reply With Quote #7

Something like this ?

PHP Code:
ZombieAttack( const iZombie )
{
    new 
Float:flFractionFloat:vStart], Float:vEnd], Float:vForward], iTr create_tr2( );
    new 
Float:vEndPos], pHit;
    
    
entity_get_vectoriZombieEV_VEC_originvStart );
    
    
entity_get_vectoriZombieEV_VEC_anglesvForward );
    
engfuncEngFunc_MakeVectorsvForward );
    
// get_tr2( iTr, TR_flFraction, flFraction ); // there is no trace yet
    
    
vStart] += 28.0;
    
vEnd]    = vStart] + vForward] * 32.0;
    
vEnd]    = vStart] + vForward] * 32.0;
    
vEnd]    = vStart];
    
    
// engfunc( EngFunc_TraceLine, vStart, vEnd, DONT_IGNORE_MONSTERS, iZombie, iTr );
    // get_tr2( iTr, TR_flFraction, flFraction );
    
pHit trace_line(iZombien vStartvEndvEndPos);
    if( !
pHit )
    {
        
engfuncEngFunc_TraceHullvStartvEndDONT_IGNORE_MONSTERSHULL_HEADiZombieiTr );
        
get_tr2iTrTR_flFractionflFraction );
        if( 
flFraction 1.0 )
        {
            
pHit get_tr2iTrTR_pHit );
            
get_tr2iTrTR_vecEndPosvEndPos );
        }
        else
        {
            
pHit FM_NULLENT;
        }
    }

    if( !
IsPlayer(pHit) )
    {
        
client_print0print_chat"[ Zombie: %i ] Missed. %s"iZombiepHit == FM_NULLENT "FindHullIntersection!" "" );  
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
UchihaSkills
Senior Member
Join Date: May 2013
Location: Germany
Old 07-16-2013 , 18:20   Re: Code doenst work
Reply With Quote #8

so i need this on line 10 of your code? instead of the trace
PHP Code:
 global_getglb_v_forwardvForward ); 
UchihaSkills is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-16-2013 , 19:59   Re: Code doenst work
Reply With Quote #9

Yes, and you were needing it in your code to.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
UchihaSkills
Senior Member
Join Date: May 2013
Location: Germany
Old 07-16-2013 , 20:02   Re: Code doenst work
Reply With Quote #10

Ok thank you it works
UchihaSkills 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 06:20.


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