Raised This Month: $ Target: $400
 0% 

[INC] Beam Entities


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 07-19-2017 , 18:41   Re: [INC] Beam Entities
Reply With Quote #37

This might be a helpful alternative:
PHP Code:
 stock get_distance_to_line(Float:pos_start[3], Float:pos_end[3], Float:pos_object[3])  
 {  
//credits to KoST
    
new Float:vec_start_end[3], Float:vec_start_object[3], Float:vec_end_object[3], Float:vec_end_start[3]
    
xs_vec_sub(pos_endpos_startvec_start_end)         // vector from start to end 
    
xs_vec_sub(pos_objectpos_startvec_start_object)     // vector from end to object 
    
xs_vec_sub(pos_startpos_endvec_end_start)         // vector from end to start 
    
xs_vec_sub(pos_endpos_objectvec_end_object)         // vector object to end 

    
new Float:len_start_object getVecLen(vec_start_object
    new 
Float:angle_start floatacos(xs_vec_dot(vec_start_endvec_start_object) / (getVecLen(vec_start_end) * len_start_object), degrees)  
    new 
Float:angle_end floatacos(xs_vec_dot(vec_end_startvec_end_object) / (getVecLen(vec_end_start) * getVecLen(vec_end_object)), degrees)  

    if(
angle_start <= 90.0 && angle_end <= 90.0
        return 
floatround(len_start_object floatsin(angle_startdegrees)) 
    return -
1  
 

SourcePawn version


Instead of using touch, use a loop to check if players are within distance.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
 



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 09:14.


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