Raised This Month: $ Target: $400
 0% 

C++ metamod dll into amxx plugin?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-26-2009 , 15:24   Re: C++ metamod dll into amxx plugin?
Reply With Quote #10

Here. Tested and it works as expected :

Code:
    #include <amxmodx>     #include <engine>     #include <fakemeta>     #include <hamsandwich>         const MAX_CLIENTS = 32;     new bool:gHasPipeLauncher[ MAX_CLIENTS + 1 char ];         enum _:Coord_e { Float:x, Float:y, Float:z };         #define VectorMS(%1,%2,%3,%4)     ( %4[ x ] = %1[ x ] - %2 * %3[ x ], %4[ y ] = %1[ y ] - %2 * %3[ y ], %4[ z ] = %1[ z ] - %2 * %3[ z ] )     #define VectorLength(%1)          ( floatsqroot ( %1[ x ] * %1[ x ] + %1[ y ] * %1[ y ] + %1[ z ] * %1[ z ] ) )         #define message_begin_f(%1,%2,%3) ( engfunc ( EngFunc_MessageBegin, %1, %2, %3 ) )     #define write_coord_f(%1)         ( engfunc ( EngFunc_WriteCoord, %1 ) )         #define PlayerHasTech(%1)         ( is_user_alive( %1 ) && gHasPipeLauncher{ %1 } )         public plugin_init ()     {         register_plugin( "Sticky PipeBombs", "1.0.0", "Arkshine" );             register_touch( "tf_gl_pipebomb", "worldspawn", "CTech_TouchWorld" );         register_touch( "tf_gl_pipebomb", "func_wall",  "CTech_TouchWorld" );         register_touch( "tf_gl_pipebomb", "player"   ,  "CTech_TouchPlayer" );                 RegisterHam( Ham_Item_Deploy , "tf_weapon_pl", "CTech_DeployWeapon", 1 );         RegisterHam( Ham_Item_Holster, "tf_weapon_pl", "CTech_HolsterWeapon", 1 );     }     public client_disconnect( Player )     {         gHasPipeLauncher{ Player } = false;     }         public CTech_TouchWorld ( const PipeBomb, const Other )     {         if ( pev_valid( PipeBomb ) && pev( PipeBomb, pev_movetype ) != MOVETYPE_NONE && PlayerHasTech( pev( PipeBomb, pev_owner ) ) )         {             static Float:Velocity[ Coord_e ];             static Float:Origin  [ Coord_e ];                         pev( PipeBomb, pev_origin, Origin );             pev( PipeBomb, pev_velocity, Velocity );                         VectorNormalize( Velocity );             VectorMS( Origin, 4.0, Velocity, Origin );                     set_pev( PipeBomb, pev_movetype, MOVETYPE_NONE );             set_pev( PipeBomb, pev_origin, Origin );             set_pev( PipeBomb, pev_velocity , Float:{ 0.0, 0.0, 0.0 } );             set_pev( PipeBomb, pev_avelocity, Float:{ 0.0, 0.0, 0.0 } );                         FX_Sparks( Origin );         }     }         public CTech_TouchPlayer ( const PipeBomb, const Other )     {         if ( pev_valid( PipeBomb ) && is_user_alive( Other ) )         {             static Float:Origin[ Coord_e ];             pev( PipeBomb, pev_origin, Origin );                         set_pev( PipeBomb, pev_movetype, MOVETYPE_FOLLOW );             set_pev( PipeBomb, pev_aiment, Other );             set_pev( PipeBomb, pev_origin, Origin );             set_pev( PipeBomb, pev_velocity , Float:{ 0.0, 0.0, 0.0 } );             set_pev( PipeBomb, pev_avelocity, Float:{ 0.0, 0.0, 0.0 } );                         FX_Sparks( Origin );         }     }         public CTech_DeployWeapon ( const PipeLauncher )     {         gHasPipeLauncher{ pev( PipeLauncher, pev_owner ) } = true;     }         public CTech_HolsterWeapon ( const PipeLauncher )     {         gHasPipeLauncher{ pev( PipeLauncher, pev_owner ) } = false;     }         FX_Sparks ( const Float:Origin[ Coord_e ] )     {         message_begin_f( MSG_PVS, SVC_TEMPENTITY, Origin, 0 );         write_byte( TE_SPARKS );         write_coord_f( Origin[ x ] );         write_coord_f( Origin[ y ] );         write_coord_f( Origin[ z ] );         message_end ();     }         VectorNormalize ( Float:Source[ Coord_e ] )     {         new Float:Invlen = 1.0 / VectorLength( Source );         Source[ x ] *= Invlen         Source[ y ] *= Invlen;         Source[ z ] *= Invlen;     }
__________________

Last edited by Arkshine; 06-26-2009 at 15:27.
Arkshine 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 15:42.


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