Senior Member
Join Date: Mar 2017
Location: Palestine
|
05-11-2017
, 15:27
[REQ] CSGO taser (CS 1.6)
|
#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[ 6 ] = { 34, 35, ... };
public plugin_init( ) { register_plugin( "PLUG-IN", PLUGIN_VERSION, "AUTHOR" );
register_forward( FM_CmdStart, "forward_FM_CmdStart" );
register_clcmd( "say /taser", "command_BuyZeus" ); register_clcmd( "say_team /taser", "command_BuyZeus" );
register_clcmd( "drop", "block_ZeusDrop" );
RegisterHam( Ham_Item_AttachToPlayer, szZeusWeaponName, "bacon_AttachToPlayer" ); RegisterHam( Ham_Item_Deploy, szZeusWeaponName, "bacon_ZeusDeploy", 1 ); RegisterHam( Ham_Weapon_SecondaryAttack, szZeusWeaponName, "bacon_SecondaryAttack_Pre", false );
register_touch( "weaponbox", "player", "touch_OnPlayerTouchWeaponBox" ); gMaxPlayers = get_maxplayers( ); }
public plugin_precache( ) { gBoltSprite = precache_model( gBeamSprite );
precache_model( szZeusViewModel ); precache_model( szZeusPlayerModel ); precache_sound( gZeusDrawSound ); precache_sound( gZeusHitSound ); precache_sound( gZeusShootSound ); }
public bacon_ZeusDeploy( iWeaponEntity ) { new id = get_pdata_cbase( iWeaponEntity, m_pPlayer, m_LinuxDiff ); set_pev( id, pev_viewmodel2, szZeusViewModel ); set_pev( id, pev_weaponmodel2, szZeusPlayerModel ); set_pdata_float( iWeaponEntity, m_flNextSecondaryAttack, 999999.9, XO_CbasePlayerWeapon ); set_pdata_float( id, m_flNextAttack, 9999.0 );
UTIL_PlayWeaponAnimation( id, 3 ); emit_sound( iWeaponEntity, CHAN_WEAPON, gZeusDrawSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM ); }
public forward_FM_CmdStart( id, uc_handle, seed ) { new iTempTrash[ 2 ]; new iWeapon = get_user_weapon( id, iTempTrash[ 0 ], iTempTrash[ 1 ] ); if ( iWeapon != CSW_KNIFE ) { return FMRES_IGNORED; } new iButtons = get_uc( uc_handle, UC_Buttons ); new iOldButtons = pev( id, pev_oldbuttons );
if( iButtons & IN_ATTACK && !( iOldButtons & IN_ATTACK ) ) { new iTarget, iDistance = TASER_CSGO_DISTANCE_DEFAULT, iBody; get_user_aiming( id, iTarget, iBody, iDistance ); if( pev_valid( iTarget ) && get_user_team( id ) != get_user_team( iTarget ) && id != iTarget ) { new iOrigin[ 3 ], iTargetOrigin[ 3 ]; get_user_origin( id, iOrigin, 0 ); get_user_origin( iTarget, iTargetOrigin, 0 );
UTIL_PlayWeaponAnimation( id, 2 ); emit_sound( id, CHAN_WEAPON, gZeusHitSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
UTIL_CreateThunder( iOrigin, iTargetOrigin ); ExecuteHam( Ham_TakeDamage, iTarget, 0, id, 4000.0, DMG_SHOCK ); engclient_cmd( id, "drop", szZeusWeaponName );
return FMRES_IGNORED; }
UTIL_PlayWeaponAnimation( id, 2 ); emit_sound( id, CHAN_WEAPON, gZeusShootSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM ); iButtons &= ~IN_ATTACK; set_uc( uc_handle, UC_Buttons, iButtons ); } return FMRES_IGNORED; }
public bacon_SecondaryAttack_Pre( iWeaponEntity ) { return HAM_SUPERCEDE; }
public command_BuyZeus( id ) { if( !is_user_alive( id ) ) { return PLUGIN_HANDLED; } if( user_has_weapon( id, CSW_KNIFE ) ) { client_print( id, print_center, "You already have a Zeus Taser gun!" ); return PLUGIN_HANDLED; }
new iMoney = cs_get_user_money( id ); if( iMoney < TASER_COST ) { client_print( id, print_center, "You don't have enough money! You need $%d.", TASER_COST ); return PLUGIN_HANDLED; } client_print( id, print_chat, "[Zeus Taser] You have bought Zeus for $%d as your secondary weapon!", TASER_COST ); cs_set_user_money( id, iMoney - TASER_COST, 1 ); give_item( id, szZeusWeaponName ); return PLUGIN_CONTINUE; } public block_ZeusDrop( id ) { new iTempTrash[ 2 ]; new iWeapon = get_user_weapon( id, iTempTrash[ 0 ], iTempTrash[ 1 ] ); if( iWeapon == CSW_KNIFE ) { client_print( id, print_center, "You cannot drop the Zeus Taser gun!" );
return PLUGIN_HANDLED_MAIN; } return PLUGIN_CONTINUE; }
public touch_OnPlayerTouchWeaponBox( iEnt, id ) { new iId = UTIL_GetWeaponBoxWeaponType( iEnt ); if( is_user_alive( id ) &&is_player( id ) && pev_valid( iEnt ) ) { if( iId == CSW_KNIFE ) { return PLUGIN_HANDLED; } }
return PLUGIN_CONTINUE; }
public bacon_AttachToPlayer( iEnt, id ) { if( get_pdata_int( iEnt, m_fKnown, XO_CbasePlayerWeapon ) ) { return; } set_pdata_int( iEnt, m_iClip, 1, XO_CbasePlayerWeapon ); set_pdata_int( id, m_iClientClip, 0, m_LinuxDiff ); }
stock UTIL_PlayWeaponAnimation( const Player, const Sequence ) { set_pev( Player, pev_weaponanim, Sequence ); message_begin( MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = Player ); write_byte( Sequence ); write_byte( pev( Player, pev_body ) ); message_end( ); }
stock UTIL_CreateThunder( iStart[ 3 ], iEnd[ 3 ] ) { message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); write_byte( TE_BEAMPOINTS ); write_coord( iStart[ 0 ] ); write_coord( iStart[ 1 ] ); write_coord( iStart[ 2 ] ); write_coord( iEnd[ 0 ] ); write_coord( iEnd[ 1 ] ); write_coord( iEnd[ 2 ] ); write_short( gBoltSprite ); write_byte( 1 ); write_byte( 5 ); write_byte( 7 ); write_byte( 20 ); write_byte( 30 ); write_byte( 135 ); write_byte( 206 ); write_byte( 250 ); write_byte( 255 ); write_byte( 145 ); message_end( ); }
/* --| Connor */ stock UTIL_GetWeaponBoxWeaponType( iEntity ) { new iWeapon;
for( new i = 1; i <= 5; i++ ) { iWeapon = get_pdata_cbase( iEntity, m_rgpPlayerItems_CWeaponBox[ i ], XO_CbasePlayerWeapon ); if( iWeapon > 0 ) { return cs_get_weapon_id( iWeapon ); } }
return 0; }
__________________
Last edited by Ayman Khaled; 05-11-2017 at 15:34.
|
|