Raised This Month: $51 Target: $400
 12% 

Module Parachute


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sOnick
Senior Member
Join Date: Aug 2007
Old 12-14-2011 , 06:31   Module Parachute
Reply With Quote #1

Hello, who can help me with a plugin? I want to turn the .sma in .dll, and i don't know how to do..

here is the code from jetpack_bz.cpp
Code:
// Header files
#include "amxxmodule.h"
#include "fakecommand.h"

// Some definitions
enum
{
    CurWeapon_Active = 1,
    CurWeapon_Weapon,
    CurWeapon_Clip
};

enum
{
    DeathMsg_Attacker = 1,
    DeathMsg_Victim,
    DeathMsg_HeadShot
};

enum
{
    HLTV_Client = 1,
    HLTV_Flags
};

// Knife weapon index
#define CSW_KNIFE    29

// Externs
FakeCommand g_FakeCmd;

void Func_Drop_Jetpack( int int_player );
void Func_Switch_To_Knife( int int_player );
void Func_Set_Jetpack_Models( edict_t *edict_player );
void Func_Reset_Knife_Models( edict_t *edict_player );

// Messages stuff
int g_int_curweapon_index;
int g_int_deathmsg_index;
int g_int_hltv_index;

bool g_bool_curweapon;
bool g_bool_deathmsg;
bool g_bool_hltv;

int g_int_variable;
int g_int_status;

edict_t *g_edict_player;

// Forwards
int g_int_forward_rocket_touch;
int g_int_forward_jetpack_touch;

// Players variables
bool g_bool_jetpack[ 33 ];
float g_float_fuel[ 33 ];
float g_float_rocket_time[ 33 ];
int g_int_current_weapon[ 33 ];

// Precached models indexes
int g_int_flame;
int g_int_trail;
int g_int_shockwave;
int g_int_explode;

// Natives
static cell AMX_NATIVE_CALL get_user_jetpack( AMX *amx_amx, cell *cell_parameters )
{
    return g_bool_jetpack[ cell_parameters[ 1 ] ];
}

static cell AMX_NATIVE_CALL get_user_fuel( AMX *amx_amx, cell *cell_parameters )
{
    return amx_ftoc( g_float_fuel[ cell_parameters[ 1 ] ] );
}

static cell AMX_NATIVE_CALL get_user_rocket_time( AMX *amx_amx, cell *cell_parameters )
{
    return amx_ftoc( g_float_rocket_time[ cell_parameters[ 1 ] ] );
}

static cell AMX_NATIVE_CALL set_user_jetpack( AMX *amx_amx, cell *cell_parameters )
{
    if( cell_parameters[ 2 ] )
    {
        if( g_bool_jetpack[ cell_parameters[ 1 ] ] )
            return 0;

        if( !MF_IsPlayerAlive( cell_parameters[ 1 ] ) )
        {
            g_bool_jetpack[ cell_parameters[ 1 ] ] = true;
        }

        else
        {
            g_bool_jetpack[ cell_parameters[ 1 ] ] = true;

            Func_Switch_To_Knife( cell_parameters[ 1 ] );

            Func_Set_Jetpack_Models( INDEXENT( cell_parameters[ 1 ] ) );
        }
    }

    else
    {
        if( !g_bool_jetpack[ cell_parameters[ 1 ] ] )
            return 0;

        g_bool_jetpack[ cell_parameters[ 1 ] ] = false;
    }

    return 1;
}

static cell AMX_NATIVE_CALL set_user_fuel( AMX *amx_amx, cell *cell_parameters )
{
    g_float_fuel[ cell_parameters[ 1 ] ] = amx_ctof( cell_parameters[ 2 ] );

    return 1;
}

static cell AMX_NATIVE_CALL set_user_rocket_time( AMX *amx_amx, cell *cell_parameters )
{
    g_float_rocket_time[ cell_parameters[ 1 ] ] = amx_ctof( cell_parameters[ 2 ] );

    return 1;
}

static cell AMX_NATIVE_CALL user_drop_jetpack( AMX *amx_amx, cell *cell_parameters )
{
    if( !g_bool_jetpack[ cell_parameters[ 1 ] ] || !MF_IsPlayerAlive( cell_parameters[ 1 ] ) )
        return 0;

    Func_Drop_Jetpack( cell_parameters[ 1 ] );

    return 1;
}

// Natives exports
AMX_NATIVE_INFO JetpackBazookaExports[ ] =
{
    { "get_user_jetpack", get_user_jetpack },
    { "get_user_fuel", get_user_fuel },
    { "get_user_rocket_time", get_user_rocket_time },

    { "set_user_jetpack", set_user_jetpack },
    { "set_user_fuel", set_user_fuel },
    { "set_user_rocket_time", set_user_rocket_time },

    { "user_drop_jetpack", user_drop_jetpack },

    { NULL, NULL }
};

void OnAmxxAttach( )
{
    // Register the natives when this module get attached at the amxmodx parent plugin
    MF_AddNatives( JetpackBazookaExports );
}

void OnPluginsLoaded( )
{
    // Register the forwards while the plugins get loaded
    g_int_forward_rocket_touch =    MF_RegisterForward( "Rocket_Touch", ET_IGNORE, FP_CELL, FP_CELL, FP_DONE );
    g_int_forward_jetpack_touch =    MF_RegisterForward( "Jetpack_Touch", ET_STOP, FP_CELL, FP_DONE );
}

// Metamod forwards
void DispatchTouch( edict_t *edict_touched, edict_t *edict_toucher )
{
    // Get the classnames at the touched entity
    const char *char_touched_class_name = STRING( edict_touched -> v.classname );

    // If the touched entity is the bazooka's projectile
    if( strcmp( char_touched_class_name, "BazookaRocket" ) == 0 )
    {
        // The dates
        int int_variable;

        // Execute the forward
        MF_ExecuteForward( g_int_forward_rocket_touch, static_cast <   cell > ( ENTINDEX( edict_touched -> v.owner ) ), static_cast <   cell > ( ENTINDEX( edict_touched ) ) );

        if( strcmp( "func_breakable", STRING( edict_toucher -> v.classname ) ) == 0 )
            MDLL_Use( edict_toucher, edict_touched );

        // Create the explosion
        for( int_variable = 0; int_variable < 5; int_variable++ )
        {
            g_engfuncs.pfnMessageBegin( MSG_BROADCAST, SVC_TEMPENTITY, NULL, NULL );
            g_engfuncs.pfnWriteByte( TE_EXPLOSION );
            g_engfuncs.pfnWriteCoord( edict_touched -> v.origin.x + g_engfuncs.pfnRandomLong( -22, 22 ) );
            g_engfuncs.pfnWriteCoord( edict_touched -> v.origin.y + g_engfuncs.pfnRandomLong( -22, 22 ) );
            g_engfuncs.pfnWriteCoord( edict_touched -> v.origin.z + g_engfuncs.pfnRandomLong( -22, 22 ) );
            g_engfuncs.pfnWriteShort( g_int_explode );
            g_engfuncs.pfnWriteByte( g_engfuncs.pfnRandomLong( 15, 25 ) );
            g_engfuncs.pfnWriteByte( 15 );
            g_engfuncs.pfnWriteByte( 0 );
            g_engfuncs.pfnMessageEnd( );
        }

        for( int_variable = 0; int_variable < 5; int_variable++ )
        {
            g_engfuncs.pfnMessageBegin( MSG_BROADCAST, SVC_TEMPENTITY, NULL, NULL );
            g_engfuncs.pfnWriteByte( TE_BEAMCYLINDER );
            g_engfuncs.pfnWriteCoord( edict_touched -> v.origin.x );
            g_engfuncs.pfnWriteCoord( edict_touched -> v.origin.y );
            g_engfuncs.pfnWriteCoord( edict_touched -> v.origin.z );
            g_engfuncs.pfnWriteCoord( edict_touched -> v.origin.x );
            g_engfuncs.pfnWriteCoord( edict_touched -> v.origin.y );
            g_engfuncs.pfnWriteCoord( edict_touched -> v.origin.z + ( 450 + ( int_variable * 100 ) ) );
            g_engfuncs.pfnWriteShort( g_int_shockwave );
            g_engfuncs.pfnWriteByte( 0 );
            g_engfuncs.pfnWriteByte( 0 );
            g_engfuncs.pfnWriteByte( 4 );
            g_engfuncs.pfnWriteByte( int_variable * 40 );
            g_engfuncs.pfnWriteByte( 0 );
            g_engfuncs.pfnWriteByte( 121 );
            g_engfuncs.pfnWriteByte( 121 );
            g_engfuncs.pfnWriteByte( 121 );
            g_engfuncs.pfnWriteByte( g_engfuncs.pfnRandomLong( 150, 240 ) );
            g_engfuncs.pfnWriteByte( 0 );
            g_engfuncs.pfnMessageEnd( );
        }

        // Remove the rocket from map
        g_engfuncs.pfnRemoveEntity( edict_touched );
    }

    // Else if the touched is jetpack and the toucher is player
    else if( strcmp( char_touched_class_name, "Jetpack" ) == 0 )
    {
        // Get the player's index
        int int_player = ENTINDEX( edict_toucher );

        if( int_player < 1 || int_player > 32 )
            RETURN_META( MRES_IGNORED );

        // Verify if he already has jetpack
        if( !MF_IsPlayerAlive( int_player ) || g_bool_jetpack[ int_player ] )
            RETURN_META( MRES_SUPERCEDE );

        // Execute the forward
        int int_result = MF_ExecuteForward( g_int_forward_jetpack_touch, static_cast < cell > ( int_player ) );

        // If it returns PLUGIN_HANDLED we have to block the player to touch the jetpack
        if( int_result )
            RETURN_META( MRES_SUPERCEDE );

        // The player has now jetpack
        g_bool_jetpack[ int_player ] = true;

        // If he is a new player who didn't has any jetpack before, set his fuel to full
        if( g_float_fuel[ int_player ] < 2 )
            g_float_fuel[ int_player ] = 250;

        // Change the current weapon to knife
        Func_Switch_To_Knife( int_player );
        Func_Set_Jetpack_Models( edict_toucher );

        // Emit a sound
        g_engfuncs.pfnEmitSound( edict_toucher, CHAN_VOICE, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );

        // Remove the jetpack from the map
        g_engfuncs.pfnRemoveEntity( edict_touched );
    }

    RETURN_META( MRES_IGNORED );
}

void ClientDisconnect( edict_t *edict_player )
{
    int int_player = ENTINDEX( edict_player );

    // When the client is disconnecting and he is owning a jetpack it should get dropped to floor in that moment
    if( g_bool_jetpack[ int_player ] )
        Func_Drop_Jetpack( int_player );

    RETURN_META( MRES_IGNORED );
}

void ClientPutInServer( edict_t *edict_player )
{
    int int_player = ENTINDEX( edict_player );

    // Reset the variables for he because he is a new player
    g_bool_jetpack[ int_player ] = false;
    g_float_fuel[ int_player ] = 0.0;
    g_float_rocket_time[ int_player ] = 0.0;

    RETURN_META( MRES_IGNORED );
}

void ClientCommand( edict_t *edict_player )
{
    // Get the command
    const char *char_command = CMD_ARGV( 0 );

    if( !char_command )
        RETURN_META( MRES_IGNORED );

    // Check if the command is drop
    if( stricmp( char_command, "drop" ) == 0 )
    {
        int int_player = ENTINDEX( edict_player );

        if( MF_IsPlayerAlive( int_player ) && g_bool_jetpack[   int_player ] && g_int_current_weapon[ int_player ] == CSW_KNIFE  )
        {
            Func_Drop_Jetpack( int_player );

            // Block the message who sais: "This weapon can't be dropped!"
            RETURN_META( MRES_SUPERCEDE );
        }
    }

    RETURN_META( MRES_IGNORED );
}

// Be carefull with this forward, it is executed at each FPS at player per second
// From 30 to 100 executions per second
void PlayerPreThink( edict_t *edict_player )
{
    // Get the player's index
    int int_player = ENTINDEX( edict_player );

    // Verify if he has jetpack
    if( g_bool_jetpack[ int_player ] )
    {
        // Get his buttons, flags and the current time counted in seconds, miliseconds and etc: ...
        int int_button = edict_player -> v.button;
        int int_flags = edict_player -> v.flags;
        float float_game_time = gpGlobals -> time;

        // Verify if he is pressing the IN_ATTACK2 button and if he can shoot with bazooka
        if( int_button & IN_ATTACK2 && g_float_rocket_time[ int_player ] < float_game_time )
        {
            // Create the rocket entity
            edict_t *edict_entity = g_engfuncs.pfnCreateNamedEntity( g_engfuncs.pfnAllocString( "info_target" ) );

            // Set the model
            g_engfuncs.pfnSetModel( edict_entity, STRING( g_engfuncs.pfnAllocString( "models/rpgrocket.mdl" ) ) );

            // Set the size
            g_engfuncs.pfnSetSize( edict_entity, Vector( 0.0, 0.0, 0.0 ), Vector( 0.0, 0.0, 0.0 ) );

            // Manage the variables
            edict_entity -> v.classname = g_engfuncs.pfnAllocString( "BazookaRocket" );
            edict_entity -> v.movetype = MOVETYPE_FLY;
            edict_entity -> v.solid = SOLID_BBOX;
            edict_entity -> v.takedamage = 1.0;

            // Get the front position of player
            Vector vector_vector = Vector( 0.0, 0.0, 0.0 );
            g_engfuncs.pfnMakeVectors( edict_player -> v.v_angle );
            vector_vector = gpGlobals -> v_forward * 64;

            // Get the player's origin
            Vector vector_origin = edict_player -> v.origin;

            // Change the origin to the front of the player
            vector_origin.x += vector_vector.x;
            vector_origin.y += vector_vector.y;

            // Set the size
            g_engfuncs.pfnSetSize( edict_entity, edict_entity -> v.mins, edict_entity -> v.maxs );

            // Set the entity's origin to that position we made
            g_engfuncs.pfnSetOrigin( edict_entity, vector_origin );

            // Set the projectile's velocity
            Vector vector_velocity = Vector( 0.0, 0.0, 0.0 );
            g_engfuncs.pfnMakeVectors( edict_player -> v.v_angle );
            vector_velocity = gpGlobals -> v_forward * 1750;

            // Apply it
            edict_entity -> v.velocity = vector_velocity;

            // Make the angles
            Vector vector_angles = Vector( 0.0, 0.0, 0.0 );
            g_engfuncs.pfnVecToAngles( vector_velocity, vector_angles );

            // Set the angles and the owner at the projectile
            edict_entity -> v.angles = vector_angles;
            edict_entity -> v.owner = edict_player;

            // Attach a beam at that projectile we made
            g_engfuncs.pfnMessageBegin( MSG_BROADCAST, SVC_TEMPENTITY, NULL, NULL );
            g_engfuncs.pfnWriteByte( TE_BEAMFOLLOW );
            g_engfuncs.pfnWriteShort( ENTINDEX( edict_entity ) );
            g_engfuncs.pfnWriteShort( g_int_trail );
            g_engfuncs.pfnWriteByte( 25 );
            g_engfuncs.pfnWriteByte( 5 );
            g_engfuncs.pfnWriteByte( 191 );
            g_engfuncs.pfnWriteByte( 191 );
            g_engfuncs.pfnWriteByte( 191 );
            g_engfuncs.pfnWriteByte( g_engfuncs.pfnRandomLong( 150, 240 ) );
            g_engfuncs.pfnMessageEnd( );

            // Emit a sound
            g_engfuncs.pfnEmitSound( edict_player, CHAN_VOICE, "weapons/rocketfire1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );

            // The rocket time should be increased
            g_float_rocket_time[ int_player ] = float_game_time + 15;
        }

        // The player is pressing the IN_DUCK and the IN_JUMP button, he isn't on the floor and has he some fuel?
        if( int_button & IN_DUCK && int_button & IN_JUMP   && !( int_flags & FL_ONGROUND ) && g_float_fuel[   int_player ] > 0 )
        {
            // Get his velocity and his angles
            Vector vector_velocity, vector_angles, vector_forward;
            vector_velocity = edict_player -> v.velocity;
            vector_angles = edict_player -> v.angles;

            // Remove the vertical angles
            vector_angles.z = 0.0;

            // Prepare the angles
            g_engfuncs.pfnAngleVectors( vector_angles, vector_forward, NULL, NULL );

            // The angles should be changed in the forward
            vector_angles = vector_forward;

            // Multiplying that angles
            vector_angles.x *= 300.0;
            vector_angles.y *= 300.0;

            // Change the velocity with a forwarded one
            vector_velocity.x = vector_angles.x;
            vector_velocity.y = vector_angles.y;

            // Prepare the vertical velocity
            if( vector_velocity.z < 300 )
                vector_velocity.z += 35;

            // Apply it
            edict_player -> v.velocity = vector_velocity;

            // Create the jetpack engine's flames effects
            g_engfuncs.pfnMessageBegin( MSG_BROADCAST, SVC_TEMPENTITY, NULL, NULL );
            g_engfuncs.pfnWriteByte( TE_SPRITE );
            g_engfuncs.pfnWriteCoord( edict_player -> v.origin.x );
            g_engfuncs.pfnWriteCoord( edict_player -> v.origin.y );
            g_engfuncs.pfnWriteCoord( edict_player -> v.origin.z );
            g_engfuncs.pfnWriteShort( g_int_flame );
            g_engfuncs.pfnWriteByte( 8 );
            g_engfuncs.pfnWriteByte( 200 );
            g_engfuncs.pfnMessageEnd( );

            // Emit a sound
            if( g_float_fuel[ int_player ] > 80 )
                g_engfuncs.pfnEmitSound( edict_player, CHAN_VOICE, "jetpack.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );

            else
                g_engfuncs.pfnEmitSound( edict_player, CHAN_VOICE, "jp_blow.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );

            // Decrease his fuel
            g_float_fuel[ int_player ] -= 1;
        }

        // Else, if the player isn't keeping the IN_DUCK button and the   IN_JUMP one pressed on and his fuel is smaller than the limit we have  to  increase his fuel
        else if( !( int_button & IN_DUCK ) && !( int_button   & IN_JUMP ) && g_float_fuel[ int_player ] < 250 )
            g_float_fuel[ int_player ] += 0.5;
    }

    RETURN_META( MRES_IGNORED );
}

int PrecacheModel( char *char_model )
{
    // Precache the models
    g_engfuncs.pfnPrecacheModel( "models/rpgrocket.mdl" );
    g_engfuncs.pfnPrecacheModel( "models/p_egon.mdl" );
    g_engfuncs.pfnPrecacheModel( "models/v_egon.mdl" );
    g_engfuncs.pfnPrecacheModel( "models/w_egon.mdl" );

    g_int_flame =        g_engfuncs.pfnPrecacheModel( "sprites/xfireball3.spr" );
    g_int_trail =        g_engfuncs.pfnPrecacheModel( "sprites/laserbeam.spr" );
    g_int_shockwave =    g_engfuncs.pfnPrecacheModel( "sprites/shockwave.spr" );
    g_int_explode =        g_engfuncs.pfnPrecacheModel( "sprites/zerogxplode.spr" );

    RETURN_META_VALUE( MRES_IGNORED, 0 );
}

int PrecacheSound( char *char_sound )
{
    // Precache the sounds
    g_engfuncs.pfnPrecacheSound( "items/gunpickup2.wav" );
    g_engfuncs.pfnPrecacheSound( "weapons/rocketfire1.wav" );
    g_engfuncs.pfnPrecacheSound( "jetpack.wav" );
    g_engfuncs.pfnPrecacheSound( "jp_blow.wav" );

    RETURN_META_VALUE( MRES_IGNORED, 0 );
}

void EmitSound( edict_t *edict_entity, int int_channel, const char   *char_sound, float float_volume, float float_attenuation, int  int_flags,  int int_pitch )
{
    // Block the knife models at player while using jetpack
    int int_entity = ENTINDEX( edict_entity );

    if( 0 < int_entity && int_entity < 33 &&   g_bool_jetpack[ int_entity ] && char_sound[ 0 ] == 'w'   && char_sound[ 8 ] == 'k' )
        RETURN_META( MRES_SUPERCEDE );

    RETURN_META( MRES_IGNORED );
}

void MessageBegin_Post( int int_destination, int int_type, const float *float_origin, edict_t *edict_entity )
{
    // Check for the messages indexes
    if( int_type == g_int_curweapon_index )
    {
        // If there's CurWeapon and the player has not a jetpack do nothing
        if( !g_bool_jetpack[ ENTINDEX( edict_entity ) ] )
            RETURN_META( MRES_IGNORED );

        g_bool_curweapon = true;

        g_edict_player = edict_entity;

        g_int_variable = 0;
    }

    else if( int_type == g_int_deathmsg_index )
    {
        g_bool_deathmsg = true;

        g_int_variable = 0;
    }

    else if( int_type == g_int_hltv_index )
    {
        g_bool_hltv = true;

        g_int_variable = 0;
    }

    RETURN_META( MRES_IGNORED );
}

void MessageEnd_Post( void )
{
    // End the messages
    if( g_bool_curweapon )
        g_bool_curweapon = false;

    else if( g_bool_deathmsg )
        g_bool_deathmsg = false;

    else if( g_bool_hltv )
        g_bool_hltv = false;

    RETURN_META( MRES_IGNORED );
}

void WriteByte_Post( int iValue )
{
    if( g_bool_curweapon )
    {
        g_int_variable++;

        if( g_int_variable == CurWeapon_Active )
            g_int_status = iValue;

        else if( g_int_variable == CurWeapon_Weapon )
        {
            if( !g_int_status )
                RETURN_META( MRES_IGNORED );

            int int_player = ENTINDEX( g_edict_player );

            g_int_current_weapon[ int_player ] = iValue;

            if( g_int_current_weapon[ int_player ] == CSW_KNIFE )
            {
                g_edict_player -> v.viewmodel = g_engfuncs.pfnAllocString( "models/v_egon.mdl" );
                g_edict_player -> v.weaponmodel = g_engfuncs.pfnAllocString( "models/p_egon.mdl" );
            }
        }
    }

    else if( g_bool_deathmsg )
    {
        g_int_variable++;

        if( g_int_variable == DeathMsg_Victim )
            if( g_bool_jetpack[ iValue ] )
                Func_Drop_Jetpack( iValue );
    }

    else if( g_bool_hltv )
    {
        g_int_variable++;

        if( g_int_variable == HLTV_Client )
        {
            g_int_status = iValue;
        }

        else if( g_int_variable == HLTV_Flags )
        {
            if( g_int_status == 0 && iValue == 0 )
            {
                edict_t *edict_entity = NULL;

                while( !FNullEnt( ( edict_entity =   g_engfuncs.pfnFindEntityByString( edict_entity, "classname",   "BazookaRocket" ) ) ) )
                    g_engfuncs.pfnRemoveEntity( edict_entity );

                edict_entity = NULL;

                while( !FNullEnt( ( edict_entity =   g_engfuncs.pfnFindEntityByString( edict_entity, "classname", "Jetpack" )   ) ) )
                    g_engfuncs.pfnRemoveEntity( edict_entity );
            }
        }
    }

    RETURN_META( MRES_IGNORED );
}

int RegUserMsg_Post( const char *char_name, int int_size )
{
    // Get the messages indexes and remember them
    if( strcmp( char_name, "CurWeapon" ) == 0 )
        g_int_curweapon_index = META_RESULT_ORIG_RET( int );

    else if( strcmp( char_name, "DeathMsg" ) == 0 )
        g_int_deathmsg_index = META_RESULT_ORIG_RET( int );

    else if( strcmp( char_name, "HLTV" ) == 0 )
        g_int_hltv_index = META_RESULT_ORIG_RET( int );

    RETURN_META_VALUE( MRES_IGNORED, 0 );
}

// Customized functions
void Func_Drop_Jetpack( int int_player )
{
    // Configure the entities
    edict_t *edict_player = INDEXENT( int_player );
    edict_t *edict_entity = g_engfuncs.pfnCreateNamedEntity( g_engfuncs.pfnAllocString( "info_target" ) );

    // Set the model at jetpack
    g_engfuncs.pfnSetModel( edict_entity, STRING( g_engfuncs.pfnAllocString( "models/w_egon.mdl" ) ) );

    // Set the size
    g_engfuncs.pfnSetSize( edict_entity, Vector( -16.0, -16.0, -16.0 ), Vector( 16.0, 16.0, 16.0 ) );

    // Configure the classname, movetype and the solid status
    edict_entity -> v.classname = g_engfuncs.pfnAllocString( "Jetpack" );
    edict_entity -> v.movetype = MOVETYPE_TOSS;
    edict_entity -> v.solid = SOLID_TRIGGER;

    // Get the front position at the player who dropped the jetpack
    Vector vector_vector = Vector( 0.0, 0.0, 0.0 );
    g_engfuncs.pfnMakeVectors( edict_player -> v.v_angle );
    vector_vector = gpGlobals -> v_forward * 75;

    // Get the player origin
    Vector vector_origin = edict_player -> v.origin;

    // Change the origin to be in the front of the player who dropped the jetpack
    vector_origin.x += vector_vector.x;
    vector_origin.y += vector_vector.y;

    // Set the size
    g_engfuncs.pfnSetSize( edict_entity, edict_entity -> v.mins, edict_entity -> v.maxs );

    // Set the entity's origin
    g_engfuncs.pfnSetOrigin( edict_entity, vector_origin );

    // The player don't have jetpack anymore
    g_bool_jetpack[ int_player ] = false;

    // Change the current weapon to knife
    if( MF_IsPlayerAlive( int_player ) )
    {
        Func_Switch_To_Knife( int_player );
        Func_Reset_Knife_Models( edict_player );
    }
}

void Func_Switch_To_Knife( int int_player )
{
    // Switch the player's weapon to knife
    g_FakeCmd.AddArg( "weapon_knife" );
    g_FakeCmd.SetFullString( "weapon_knife" );
    
    MDLL_ClientCommand( INDEXENT( int_player ) );
    
    g_FakeCmd.Reset( );
}

void Func_Set_Jetpack_Models( edict_t *edict_player )
{
    // Apply the jetpack models at player
    edict_player -> v.viewmodel = g_engfuncs.pfnAllocString( "models/v_egon.mdl" );
    edict_player -> v.weaponmodel = g_engfuncs.pfnAllocString( "models/p_egon.mdl" );
}

void Func_Reset_Knife_Models( edict_t *edict_player )
{
    // Change the player's weapons models to the default knife
    edict_player -> v.viewmodel = g_engfuncs.pfnAllocString( "models/v_knife.mdl" );
    edict_player -> v.weaponmodel = g_engfuncs.pfnAllocString( "models/p_knife.mdl" );
}
__________________
I love zm servers

Last edited by sOnick; 12-14-2011 at 06:32.
sOnick is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 12-14-2011 , 15:45   Re: Module Parachute
Reply With Quote #2

What ".sma" are you speaking about?
By the way, no one has fakecommand.h file, don't you think someone can resolve this extension...

Use [ php ] [ /php ] instead of [ code ] [ /code ].
__________________

Last edited by claudiuhks; 12-14-2011 at 15:45.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
ezio_auditore
Senior Member
Join Date: May 2013
Old 05-08-2014 , 03:42   Re: Module Parachute
Reply With Quote #3

Quote:
Originally Posted by claudiuhks View Post
What ".sma" are you speaking about?
By the way, no one has fakecommand.h file, don't you think someone can resolve this extension...

Use [ php ] [ /php ] instead of [ code ] [ /code ].
It increases code readability to some extent
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 05-08-2014 , 19:53   Re: Module Parachute
Reply With Quote #4

Quote:
Originally Posted by ezio_auditore View Post
It increases code readability to some extent

3 year old post. Just saying.
__________________
DruGzOG is offline
Send a message via AIM to DruGzOG
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 10:21.


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