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

[REQ] CSGO taser (CS 1.6)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 05-11-2017 , 15:27   [REQ] CSGO taser (CS 1.6)
Reply With Quote #1

Hi guys
i need this plugin when you write /taser you have only '1 bullet'
and i won't to replace it with any weapon like knife or glock, i mean when you buy glock or get it in spawn it's replaced automatic with taser, i need only to replace it when you write /taser
is it possible ?
and thx.
PHP Code:
#include < amxmodx >

#include < fakemeta >
#include < hamsandwich >
#include < engine >
#include < cstrike >
#include < fun >

#pragma semicolon 1

#define PLUGIN_VERSION            "1.0.1"

#define TASER_COST            200 
#define TASER_CSGO_DISTANCE_DEFAULT    230
#define is_player(%1)            ( 1 <= %1 <= gMaxPlayers ) 

/* --| Weapon replacement */
new const szZeusWeaponName[ ] = "weapon_glock18";

new const 
gBeamSprite[ ] = "sprites/bolt1.spr";
new const 
szZeusViewModel[ ] = "models/v_taser.mdl";
new const 
szZeusPlayerModel[ ] = "models/p_taser.mdl";

new const 
gZeusDrawSound[ ] = "taser/taser_draw.wav";
new const 
gZeusHitSound[ ] = "taser/taser_hit.wav";
new const 
gZeusShootSound[ ] = "taser/taser_shoot.wav";

new 
gBoltSprite;
new 
gMaxPlayers;

const 
m_LinuxDiff 5;
const 
XO_CbasePlayerWeapon 4;

const 
m_pPlayer 41;
const 
m_flNextSecondaryAttack 47
const 
m_flNextAttack  83;
const 
m_rgpPlayerItems 269;
const 
m_fKnown 44;
const 
m_iClip 51;
const 
m_iClientClip 52;

new const 
m_rgpPlayerItems_CWeaponBox] = { 3435, ... }; 

public 
plugin_init( )
{
    
register_plugin"PLUG-IN"PLUGIN_VERSION"AUTHOR" );

    
register_forwardFM_CmdStart"forward_FM_CmdStart" );

    
register_clcmd"say /taser""command_BuyZeus" );
    
register_clcmd"say_team /taser""command_BuyZeus" );

    
register_clcmd"drop""block_ZeusDrop" );

    
RegisterHamHam_Item_AttachToPlayerszZeusWeaponName"bacon_AttachToPlayer" );
    
RegisterHamHam_Item_DeployszZeusWeaponName"bacon_ZeusDeploy");
    
RegisterHamHam_Weapon_SecondaryAttackszZeusWeaponName"bacon_SecondaryAttack_Pre"false );

    
register_touch"weaponbox""player""touch_OnPlayerTouchWeaponBox" ); 
    
    
gMaxPlayers get_maxplayers( );
}

public 
plugin_precache( )
{
    
gBoltSprite precache_modelgBeamSprite );

    
precache_modelszZeusViewModel );
    
precache_modelszZeusPlayerModel );
    
    
precache_soundgZeusDrawSound );
    
precache_soundgZeusHitSound );
    
precache_soundgZeusShootSound );
}

public 
bacon_ZeusDeployiWeaponEntity )
{
        new 
id get_pdata_cbaseiWeaponEntitym_pPlayerm_LinuxDiff );
    
    
set_pevidpev_viewmodel2szZeusViewModel );
    
set_pevidpev_weaponmodel2szZeusPlayerModel );
    
    
set_pdata_floatiWeaponEntitym_flNextSecondaryAttack999999.9XO_CbasePlayerWeapon );
    
set_pdata_floatidm_flNextAttack9999.0 );

    
UTIL_PlayWeaponAnimationid);
    
emit_soundiWeaponEntityCHAN_WEAPONgZeusDrawSoundVOL_NORMATTN_NORM0PITCH_NORM );
}

public 
forward_FM_CmdStartiduc_handleseed )
{
    new 
iTempTrash];
    new 
iWeapon get_user_weaponidiTempTrash], iTempTrash] );
    
    if ( 
iWeapon != CSW_KNIFE )
    {
        return 
FMRES_IGNORED;
    }
            
    new 
iButtons get_ucuc_handleUC_Buttons );
    new 
iOldButtons pevidpev_oldbuttons );

    if( 
iButtons IN_ATTACK && !( iOldButtons IN_ATTACK ) )
    {
        new 
iTargetiDistance TASER_CSGO_DISTANCE_DEFAULTiBody;
        
get_user_aimingidiTargetiBodyiDistance );
            
        if( 
pev_validiTarget 
        && 
get_user_teamid ) != get_user_teamiTarget 
        && 
id != iTarget )
        {        
            new 
iOrigin], iTargetOrigin];
            
get_user_originidiOrigin);
            
get_user_originiTargetiTargetOrigin);

            
UTIL_PlayWeaponAnimationid);
            
emit_soundidCHAN_WEAPONgZeusHitSoundVOL_NORMATTN_NORM0PITCH_NORM );

            
UTIL_CreateThunderiOriginiTargetOrigin );
            
ExecuteHamHam_TakeDamageiTarget0id4000.0DMG_SHOCK );
            
engclient_cmdid"drop"szZeusWeaponName );

            return 
FMRES_IGNORED;
        }

        
UTIL_PlayWeaponAnimationid);
        
emit_soundidCHAN_WEAPONgZeusShootSoundVOL_NORMATTN_NORM0PITCH_NORM );
        
        
iButtons &= ~IN_ATTACK;
        
set_ucuc_handleUC_ButtonsiButtons );
    }
    
    return 
FMRES_IGNORED;
}

public 
bacon_SecondaryAttack_PreiWeaponEntity )
{
    return 
HAM_SUPERCEDE;
}

public 
command_BuyZeusid )
{
    if( !
is_user_aliveid ) )
    {
        return 
PLUGIN_HANDLED;
    }
    
    if( 
user_has_weaponidCSW_KNIFE ) )
    {
        
client_printidprint_center"You already have a Zeus Taser gun!" );
        
        return 
PLUGIN_HANDLED;
    }

    new 
iMoney cs_get_user_moneyid );
    
    if( 
iMoney TASER_COST )
    {
        
client_printidprint_center"You don't have enough money! You need $%d."TASER_COST );
        
        return 
PLUGIN_HANDLED;
    }
    
    
client_printidprint_chat"[Zeus Taser] You have bought Zeus for $%d as your secondary weapon!"TASER_COST );
    
    
cs_set_user_moneyidiMoney TASER_COST);
    
give_itemidszZeusWeaponName );
    
    return 
PLUGIN_CONTINUE;
}
    
public 
block_ZeusDropid )
{
    new 
iTempTrash];
    new 
iWeapon get_user_weaponidiTempTrash], iTempTrash] );
    
    if( 
iWeapon == CSW_KNIFE )
    {
        
client_printidprint_center"You cannot drop the Zeus Taser gun!" );

        return 
PLUGIN_HANDLED_MAIN;
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
touch_OnPlayerTouchWeaponBoxiEntid )
{
    new 
iId UTIL_GetWeaponBoxWeaponTypeiEnt );
    
    if( 
is_user_aliveid 
    &&
is_playerid 
    && 
pev_validiEnt ) )
    {
        if( 
iId == CSW_KNIFE )
        {
            return 
PLUGIN_HANDLED;
        }
    }

    return 
PLUGIN_CONTINUE;
}

public 
bacon_AttachToPlayeriEntid )
{
    if( 
get_pdata_intiEntm_fKnownXO_CbasePlayerWeapon ) )
    {
        return;
    }
    
    
set_pdata_intiEntm_iClip1XO_CbasePlayerWeapon );
    
set_pdata_intidm_iClientClip0m_LinuxDiff );
}

stock UTIL_PlayWeaponAnimation( const Player, const Sequence )
{
    
set_pevPlayerpev_weaponanimSequence );
    
    
message_beginMSG_ONE_UNRELIABLESVC_WEAPONANIM, .player Player );
    
write_byteSequence );
    
write_bytepevPlayerpev_body ) );
    
message_end( );
}

stock UTIL_CreateThunderiStart], iEnd] )
{
    
message_beginMSG_BROADCASTSVC_TEMPENTITY ); 
    
write_byteTE_BEAMPOINTS ); 
    
write_coordiStart] ); 
    
write_coordiStart] ); 
    
write_coordiStart] ); 
    
write_coordiEnd] ); 
    
write_coordiEnd] ); 
    
write_coordiEnd] ); 
    
write_shortgBoltSprite ); 
    
write_byte);
    
write_byte);
    
write_byte);
    
write_byte20 );
    
write_byte30 );
    
write_byte135 ); 
    
write_byte206 );
    
write_byte250 );
    
write_byte255 );
    
write_byte145 );
    
message_end( );
}

/* --| Connor */
stock UTIL_GetWeaponBoxWeaponTypeiEntity 

    new 
iWeapon

    for( new 
1<= 5i++ ) 
    { 
        
iWeapon get_pdata_cbaseiEntitym_rgpPlayerItems_CWeaponBox], XO_CbasePlayerWeapon );
 
        if( 
iWeapon 
        { 
            return 
cs_get_weapon_idiWeapon ); 
        } 
    } 

    return 
0

__________________

Last edited by Ayman Khaled; 05-11-2017 at 15:34.
Ayman Khaled is offline
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 12:45.


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