чтобы плагин работал только для админов пожалуйста.
Тему не удаляйте плиз уже второй раз открываю.
Код:
/**
*
* Fast Sniper Switch (Awp Fast Switch)
* by Numb
*
*
* Description:
* This plugins brings back the old feature from CS1.5 times.
* You were able to shoot a bullet with awp or scout, switch to
* knife or any other weapon really fast, and then switch back again.
* In result you get that you can fire your next bullet faster than
* if you would have waited for original bullet 'reload'.
*
*
* Requires:
* FakeMeta
* HamSandWich
*
*
* Additional Info:
* Tested in Counter-Strike 1.6 with amxmodx 1.8.1
*
*
* Notes:
* WARNING!!! If you are using "Quake Style Switch" plugin (link:
* http://forums.alliedmods.net/showthread.ph...942#post1193942 ) than
* you should use "fast_sniper_switch_quake.amxx" instead of original one.
*
*
* ChangeLog:
*
* + 1.0
* - First release.
*
*
* Downloads:
* Amx Mod X forums: http://forums.alliedmods.net/showthread.ph...990#post1193990
*
**/
// ----------------------------------------- CONFIG START -----------------------------------------
// delay for awp fast switch (in cs1.5 it was 0.75 like any other weapon)
#define AWP_SWITCH_DELAY 0.1 // default: 0.75
// delay for scout fast switch (in cs1.5 it was 0.75 like any other weapon)
#define SCOUT_SWITCH_DELAY 0.1 // default: 0.75
//#define QUAKE_STYLE_SWITCH // uncomment this line if you are using quake-style-switch plugin
// ------------------------------------------ CONFIG END ------------------------------------------
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN_NAME "Fast Sniper Switch"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "Numb"
#define PDWeaponType 43
#define WPNNextPrimAttack 46
#define WPNNextSecAttack 47
#define WPNSwitchedAt 76
#define PDNextAttack 83
#define PDActiveItem 373
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
RegisterHam(Ham_Item_Deploy, "weapon_awp", "Ham_Item_Deploy_Post", 1);
RegisterHam(Ham_Item_Deploy, "weapon_scout", "Ham_Item_Deploy_Post", 1);
RegisterHam(Ham_AddPlayerItem, "player", "Ham_AddPlayerItem_Post", 1);
}
public Ham_AddPlayerItem_Post(iPlrId, iEnt)
{
if( !is_user_alive(iPlrId) )
return HAM_IGNORED;
if( !pev_valid(iEnt) )
return HAM_IGNORED;
if( iEnt!=get_pdata_cbase(iPlrId, PDActiveItem, 5) )
return HAM_IGNORED;
new iWpnType = get_pdata_int(iEnt, PDWeaponType, 4);
if( iWpnType!=CSW_AWP && iWpnType!=CSW_SCOUT )
return HAM_IGNORED;
if( get_pdata_float(iEnt, WPNNextSecAttack, 4)==1.0 && get_pdata_float(iEnt, WPNSwitchedAt, 4)==get_gametime() )
{
#if !defined QUAKE_STYLE_SWITCH
new iAnimationId = pev(iPlrId, pev_weaponanim);
#endif
new Float:fPlrNextAttack = get_pdata_float(iPlrId, PDNextAttack, 5);
new Float:fGunNextPAttack = get_pdata_float(iEnt, WPNNextPrimAttack, 4);
#if defined QUAKE_STYLE_SWITCH
if( iWpnType==CSW_AWP && fPlrNextAttack==1.45 && fGunNextPAttack==1.45 ) {
#else
if( iWpnType==CSW_AWP && iAnimationId==5 && fPlrNextAttack==1.45 && fGunNextPAttack==1.45 ) {
#endif
set_pdata_float(iEnt, WPNNextPrimAttack, AWP_SWITCH_DELAY, 4);
set_pdata_float(iEnt, WPNNextSecAttack, AWP_SWITCH_DELAY, 4);
set_pdata_float(iPlrId, PDNextAttack, AWP_SWITCH_DELAY, 5);
}
#if defined QUAKE_STYLE_SWITCH
else if( iWpnType==CSW_SCOUT && fPlrNextAttack==1.25 && fGunNextPAttack==1.25 ) {
#else
else if( iWpnType==CSW_SCOUT && iAnimationId==4 && fPlrNextAttack==1.25 && fGunNextPAttack==1.25 ) {
#endif
set_pdata_float(iEnt, WPNNextPrimAttack, SCOUT_SWITCH_DELAY, 4);
set_pdata_float(iEnt, WPNNextSecAttack, SCOUT_SWITCH_DELAY, 4);
set_pdata_float(iPlrId, PDNextAttack, SCOUT_SWITCH_DELAY, 5);
}
}
return HAM_IGNORED;
}
public Ham_Item_Deploy_Post(iEnt)
{
if( !pev_valid(iEnt) )
return HAM_IGNORED;
new iPlrId = pev(iEnt, pev_owner);
if( !is_user_alive(iPlrId) )
return HAM_IGNORED;
if( iEnt!=get_pdata_cbase(iPlrId, PDActiveItem, 5) )
return HAM_IGNORED;
switch( get_pdata_int(iEnt, PDWeaponType, 4) )
{
case CSW_AWP:
{
set_pdata_float(iEnt, WPNNextPrimAttack, AWP_SWITCH_DELAY, 4);
set_pdata_float(iEnt, WPNNextSecAttack, AWP_SWITCH_DELAY, 4);
set_pdata_float(iPlrId, PDNextAttack, AWP_SWITCH_DELAY, 5);
}
case CSW_SCOUT:
{
set_pdata_float(iEnt, WPNNextPrimAttack, SCOUT_SWITCH_DELAY, 4);
set_pdata_float(iEnt, WPNNextSecAttack, SCOUT_SWITCH_DELAY, 4);
set_pdata_float(iPlrId, PDNextAttack, SCOUT_SWITCH_DELAY, 5);
}
}
return HAM_IGNORED;
}
Отредактировал: STOMPER, - 20.12.2014, 22:49