Raised This Month: $ Target: $400
 0% 

Why does this code give this error? Can you fix it please?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
cs1.7
Senior Member
Join Date: Oct 2008
Old 03-20-2010 , 23:48   Why does this code give this error? Can you fix it please?
Reply With Quote #1

Hi,

what is wrong in the below code?

It gives this error in console:

Quote:
PM Got a NaN velocity 0
PM Got a NaN velocity 1
PHP Code:
stock create_velocity_vector(victim,attacker,Float:velocity[3])
{
    if(!
is_user_alive(attacker) || is_user_bot(attacker))
        return 
0;

    new 
Float:vicorigin[3];
    new 
Float:attorigin[3];
    
pevvictimpev_originvicorigin);
    
pevattackerpev_originattorigin);
    
    new 
Float:cheese floatpower(vicorigin[0]-attorigin[0], 2.0) + floatpower(vicorigin[1]-attorigin[1] ,2.0) + floatpower(vicorigin[2]-attorigin[2], 2.0 );
    new 
distance floatroundfloatpowercheese0.5 ) );

    new 
Float:origin2[3]
    
origin2[0] = vicorigin[0] - attorigin[0];
    
origin2[1] = vicorigin[1] - attorigin[1];

    new 
Float:largestnum 0.0;

    if(
floatabs(origin2[0])>largestnumlargestnum floatabs(origin2[0]);
    if(
floatabs(origin2[1])>largestnumlargestnum floatabs(origin2[1]);

    
origin2[0] /= largestnum;
    
origin2[1] /= largestnum;

    
velocity[0] = ( origin2[0] * 200000 ) / (distance 50);
    
velocity[1] = ( origin2[1] * 200000 ) / (distance 50);
    if(
velocity[0] <= 20.0 || velocity[1] <= 20.0)
        
velocity[2] = random_float(275.0 300.0);

    return 
1;

__________________
_____________
/_____\
[° ||| °]
./..............\▓

Last edited by cs1.7; 04-15-2010 at 06:43.
cs1.7 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 08:38.


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