Raised This Month: $ Target: $400
 0% 

CodeSnippet : Aiming @ Entities


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Lord of Destruction
Member
Join Date: Sep 2004
Old 09-07-2004 , 20:24   CodeSnippet : Aiming @ Entities
Reply With Quote #1

First of all I don't need scripting help, I want to provide something helpfull.

I developed and coded a function that allows Small Scripters to set the aiming of a Player to another one or an Object in the world in actualy any HL MOD.
Testet on Earth's Special Forces and The Specialists.
If you are not familiar with amx scripting just close this topic.

And yes it is absolutly possible to write a Aimbot with it.
I did it, with autosho... but it only works "nice" if you are a listenserver.

So this Function can be used for focusing weapons on ground, next enemy ermmm... etc.

I released this Function, because I think it can't be missused on dedicated Servers.
>> ServerFrames are to low
>> the TimeDelay( Ping depending ) between Aimset and a FireCommand allows no accuratly shooting // yes I tested it ^^

The Function should actualy be clear how it works.

With Admin / MoD permission I may release the rest of my AimingDaemon


>> Update v2 untested but should work ^^

Code:
/** *    (c)        core | Lord of Destruction        2004 * *        >> <a href="mailto:[email protected]">[email protected]</a> * *   CoreID          =   Index of Player/Entity  << Yes, you can adjust Entitys with it *   TargetID        =   Index of Player/Entity * *   I'm not 100% sure with the prechars * *   AimOffset[0]    =   Adds an AimOffset in Degree to horizontal Aim   ( right = - | left = + ) *   AimOffset[1]    =   Adds an AimOffset in Degree to vertical Aim     (    up = - | down = + ) * *   TargetOffset[0] =   Adds a TargetOffset in Units on X-Axis          ( right = + | left = - ) *   TargetOffset[1] =   Adds a TargetOffset in Units on Y-Axis          ( front = + | back = - ) *   TargetOffset[2] =   Adds a TargetOffset in Units on Z-Axis          (    up = + | down = - ) * *   With TargetOffset you can describe points on/around the Target *       for example the nose of a player should be { 0.0, 5.0, 15.0 } << I know I'm evil */ #include <amxmodx> #include <engine> #define inline stock #define x 0 #define y 1 #define z 2 inline Float:Distance2D( Float:X, Float:Y )     return floatsqroot( (X*X) + (Y*Y) ); inline Float:Distance3D( Float:X, Float:Y, Float:Z  )     return floatsqroot( (X*X) + (Y*Y) + (Z*Z) ); inline Float:Degree2Radian( Float:Degree )     return Degree / 360.0 * ( 2 * 3.141592653589793 ); inline Float:Radian2Degree( Float:Radian )     return Radian * 360.0 / ( 2 * 3.141592653589793 ); setClientAIMING( CoreID, TargetID, Float:AimOffset[2] = { 0.0, 0.0 }, Float:TargetOffset[3] = { 0.0, 0.0, 0.0 } ) {     new Float:CoreAngles[3] = { 0.0, 0.0, 0.0 };     new Float:CoreOrigin[3];     entity_get_vector( CoreID, EV_VEC_origin, CoreOrigin );     new Float:TargetOrigin[3];     entity_get_vector( TargetID, EV_VEC_origin, TargetOrigin );     // >> [ TargetOrigin Modifieres ]     new Float:TargetAngles[3];     entity_get_vector( TargetID, EV_VEC_angles, TargetAngles );     // >> [ should work ^^ ]     new anglemode:Mode = degrees;     TargetOrigin[x] += TargetOffset[x] * floatsin( TargetAngles[y], Mode );     TargetOrigin[y] += TargetOffset[y] * floatcos( TargetAngles[y], Mode );     TargetOrigin[z] += TargetOffset[z];     // >> [ calculate Delta ]     new Float:DeltaOrigin[3];     for ( new i = 0; i < 3; i++ )         DeltaOrigin[i] = CoreOrigin[i] - TargetOrigin[i];     // >> [ calculate Vertical-AIM ]     CoreAngles[x] = Radian2Degree( floatatan( DeltaOrigin[z] / Distance2D( DeltaOrigin[x], DeltaOrigin[y] ), 0 ) );     CoreAngles[x] += AimOffset[y];     // >> [ calculate Horizontal-AIM }     CoreAngles[y] = Radian2Degree( floatatan( DeltaOrigin[y] / DeltaOrigin[x], 0 ) ) + AimOffset[x];     CoreAngles[y] += AimOffset[x];     ( DeltaOrigin[x] >= 0.0 ) ? ( CoreAngles[y] += 180.0 )/* Q1 & Q2 */ : ( CoreAngles[y] += 0.0 )/* Q3 & Q4 */;     // >> [ set AimVector ]     entity_set_vector( CoreID, EV_VEC_angles, CoreAngles );     entity_set_int( CoreID, EV_INT_fixangle, 1 );     return 1; }
Lord of Destruction is offline
 


Thread Tools
Display Modes

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


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