Скриптер
Проверенный
Пользователь
- Сообщения
- 3,561
- Реакции
- 1,559
- Помог
- 131 раз(а)
Это уже deploy анимация сама начинается, всё норм.Просто во второй части всёравно проскакивает небольшая видимость ножа с левой рукой
Это уже deploy анимация сама начинается, всё норм.Просто во второй части всёравно проскакивает небольшая видимость ножа с левой рукой
#include <amxmodx>
#include <reapi>
public plugin_init() {
RegisterHookChain(RG_CBasePlayerWeapon_DefaultDeploy, "RG_CBasePlayerWeapon_DefaultDeploy_pre", false);
}
public RG_CBasePlayerWeapon_DefaultDeploy_pre(const id, szViewModel[], szWeaponModel[], iAnim, szAnimExt[], skiplocal) {
SetHookChainArg(6, ATYPE_INTEGER, 0);
}
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < reapi >
#define WEAPON_MODEL_VIEW_AK47 "models/v_ak47_test3.mdl"
#define WEAPON_MODEL_PLAYER_AK47 "models/p_ak47.mdl"
enum ak47_e
{
// AK47_DUMMY,
AK47_IDLE1,
AK47_RELOAD,
AK47_DRAW,
AK47_SHOOT1,
AK47_SHOOT2,
AK47_SHOOT3
};
new g_iCurBody[ MAX_CLIENTS +1 ];
public plugin_init( )
{
register_clcmd( "ak47", "Command_Ak47" );
register_clcmd( "body", "Command_Body" );
register_clcmd( "spec", "Command_Spectator" );
RegisterHam( Ham_Item_Deploy, "weapon_ak47", "CAk47_Deploy_Post", .Post = 1 );
RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_ak47", "CAk47_Attack_Post", .Post = 1 );
RegisterHam( Ham_Weapon_WeaponIdle, "weapon_ak47", "CAk47_Idle_Post", .Post = 1 );
RegisterHam( Ham_Weapon_Reload, "weapon_ak47", "CAk47_Reload_Post", .Post = 1 );
register_forward( FM_UpdateClientData, "FM_Hook_UpdateClientData_Post", ._post = 1 );
}
public Command_Spectator( iPlayer )
{
dllfunc( DLLFunc_ClientKill, iPlayer );
engclient_cmd( iPlayer, "jointeam", "6" );
return PLUGIN_HANDLED;
}
public plugin_precache( )
{
engfunc( EngFunc_PrecacheModel, WEAPON_MODEL_VIEW_AK47 );
engfunc( EngFunc_PrecacheModel, WEAPON_MODEL_PLAYER_AK47 );
}
public Command_Ak47( iPlayer )
{
rg_give_custom_item( iPlayer, "weapon_ak47", .uid = 1337);
rg_set_user_bpammo( iPlayer, WEAPON_AK47, 90 );
}
public Command_Body( iPlayer )
{
client_print( iPlayer, print_chat, "Вы поменяли руки на %s.", ( g_iCurBody[ iPlayer ] = !g_iCurBody[ iPlayer ] ) ? "женские" : "мужские" );
new iActiveItem = get_member( iPlayer, m_pActiveItem );
if( iActiveItem != NULLENT )
ExecuteHamB( Ham_Item_Deploy, iActiveItem );
}
public CAk47_Deploy_Post( iEntity )
{
if (get_entvar(iEntity, var_impulse) == 1337) {
new iPlayer = get_member( iEntity, m_pPlayer );
set_entvar( iPlayer, var_viewmodel, "" );
set_entvar( iPlayer, var_weaponmodel, WEAPON_MODEL_PLAYER_AK47 );
set_member( iEntity, m_flLastEventCheck, get_gametime( ) + 0.1 );
SendWeaponAnim( iPlayer, AK47_DRAW, g_iCurBody[ iPlayer ] );
}
}
public CAk47_Attack_Post( iEntity )
{
if (get_entvar(iEntity, var_impulse) == 1337) {
new iPlayer = get_member( iEntity, m_pPlayer );
SendWeaponAnim( iPlayer, AK47_SHOOT1, g_iCurBody[ iPlayer ] );
}
}
public CAk47_Idle_Post( iEntity )
{
if (get_entvar(iEntity, var_impulse) == 1337) {
if (get_member(iEntity, m_Weapon_flTimeWeaponIdle) > 0.0)
return;
new iPlayer = get_member( iEntity, m_pPlayer );
set_member(iEntity, m_Weapon_flTimeWeaponIdle, 0.3);
SendWeaponAnim( iPlayer, AK47_IDLE1, g_iCurBody[ iPlayer ] );
}
}
public CAk47_Reload_Post( iEntity )
{
if (get_entvar(iEntity, var_impulse) == 1337) {
new iPlayer = get_member( iEntity, m_pPlayer );
set_member(iEntity, m_Weapon_flTimeWeaponIdle, 0.3);
SendWeaponAnim( iPlayer, AK47_RELOAD, g_iCurBody[ iPlayer ] );
}
}
public FM_Hook_UpdateClientData_Post( iPlayer, SendWeapons, CD_Handle )
{
enum
{
SPEC_MODE,
SPEC_TARGET,
SPEC_END
}; static aSpecInfo[ 33 ][ SPEC_END ];
static Float: flGameTime;
static Float: flLastEventCheck;
static iTarget;
static iSpecMode;
static iActiveItem;
iTarget = ( iSpecMode = get_entvar( iPlayer, var_iuser1 ) ) ? get_entvar( iPlayer, var_iuser2 ) : iPlayer;
iActiveItem = get_member( iTarget, m_pActiveItem );
if( iActiveItem == NULLENT )
return FMRES_IGNORED;
flGameTime = get_gametime( );
flLastEventCheck = get_member( iActiveItem, m_flLastEventCheck );
if( get_entvar(iActiveItem, var_impulse) == 1337 )
{
if( iSpecMode )
{
if( aSpecInfo[ iPlayer ][ SPEC_MODE ] != iSpecMode )
{
aSpecInfo[ iPlayer ][ SPEC_MODE ] = iSpecMode;
aSpecInfo[ iPlayer ][ SPEC_TARGET ] = 0;
}
if( iSpecMode == OBS_IN_EYE && aSpecInfo[ iPlayer ][ SPEC_TARGET ] != iTarget )
{
aSpecInfo[ iPlayer ][ SPEC_TARGET ] = iTarget;
// SendWeaponAnim( iPlayer, AK47_DUMMY, g_iCurBody[ iTarget ] );
}
}
if( !flLastEventCheck )
{
set_cd( CD_Handle, CD_flNextAttack, flGameTime + 0.001 );
set_cd( CD_Handle, CD_WeaponAnim, AK47_DRAW );
return FMRES_HANDLED;
}
if( flLastEventCheck <= flGameTime )
{
client_print(0, print_chat, "%.2f Frame Deploy", get_gametime());
set_entvar( iTarget, var_viewmodel, WEAPON_MODEL_VIEW_AK47 );
SendWeaponAnim( iTarget, AK47_DRAW, g_iCurBody[ iTarget ] );
set_member( iActiveItem, m_flLastEventCheck, 0.0 );
}
}
return FMRES_IGNORED;
}
stock SendWeaponAnim( iPlayer, iAnim, iBody )
{
static i, iCount, iSpectator, iszSpectators[ MAX_PLAYERS ];
set_entvar( iPlayer, var_weaponanim, iAnim );
message_begin( MSG_ONE, SVC_WEAPONANIM, _, iPlayer );
write_byte( iAnim );
write_byte( iBody );
message_end( );
if( get_entvar( iPlayer, var_iuser1 ) )
return;
get_players( iszSpectators, iCount, "bch" );
for( i = 0; i < iCount; i++ )
{
iSpectator = iszSpectators[ i ];
if( get_entvar( iSpectator, var_iuser1 ) != OBS_IN_EYE )
continue;
if( get_entvar( iSpectator, var_iuser2 ) != iPlayer )
continue;
set_entvar( iSpectator, var_weaponanim, iAnim );
message_begin( MSG_ONE, SVC_WEAPONANIM, _, iSpectator );
write_byte( iAnim );
write_byte( iBody );
message_end( );
}
}
#include <amxmodx>
#include <reapi>
public plugin_init(){
register_plugin("View model deploy fix", "1.0.0", "laucerZ - edit. Speaker");
RegisterHookChain(RG_CBasePlayerWeapon_DefaultDeploy, "CBasePlayerWeapon_DefaultDeploy_Post", true);
}
public CBasePlayerWeapon_DefaultDeploy_Post(id, model[]){
new player = get_member(id, m_pPlayer);
set_entvar(player, var_viewmodel, "");
if(task_exists(player)) remove_task(player);
set_task(0.1, "change_model", player, model, 63);
}
public change_model(model[], player){
if(!is_nullent(get_member(player, m_pActiveItem)))
set_entvar(player, var_viewmodel, model);
}