|
发表于 2011-3-7 23:55:53
|
显示全部楼层
来自 中国–广东–东莞
- #include <amxmodx>
- #include <cstrike>
- #include <fakemeta>
- new const g_szVmodels[ CsTeams ][] = {
- "",
- "models/v_hgun.mdl",
- "models/v_crowbar.mdl",
- ""
- };
- new const g_szPmodels[ CsTeams ][] = {
- "",
- "models/p_hgun.mdl",
- "models/p_crowbar.mdl",
- ""
- };
- new const g_szWmodels[ CsTeams ][] = {
- "",
- "models/w_hgun.mdl",
- "models/w_crowbar.mdl",
- ""
- };
- new const g_szOldSound[][] = {
- "sound/weapons/knife_deploy1.wav",
- "sound/weapons/knife_slash1.wav" ,
- "sound/weapons/knife_slash2.wav",
- "sound/weapons/knife_hit1.wav" ,
- "sound/weapons/knife_hit2.wav",
- "sound/weapons/knife_hit3.wav",
- "sound/weapons/knife_hit4.wav",
- "sound/weapons/knife_stab.wav",
- "sound/weapons/knife_hitwall1.wav"
- };
- new const g_szNewSound[][] = {
- "sound/weapons/fiveseven_clipin.wav",
- "sound/FeNgGe/FeNgGe_7.wav",
- "sound/FeNgGe/FeNgGe_7.wav",
- "sound/FeNgGe/FeNgGe_8.wav",
- "sound/FeNgGe/FeNgGe_8.wav",
- "sound/FeNgGe/FeNgGe_8.wav",
- "sound/FeNgGe/FeNgGe_9.wav",
- "sound/debris/concrete3.wav",
- "这里再加一个音效"
- };
- new const g_szOldWmodel[] = "models/w_knife.mdl";
- new const PLUGIN_NAME[] = "";
- new const PLUGIN_AUTHOR[] = "";
- new const PLUGIN_VERSION[] = "";
- #define IsPlayer(%1) (1<=%1<=g_iMaxPlayers)
- new g_iMaxPlayers;
- public plugin_init()
- {
- register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );
- register_event( "CurWeapon", "Event_CurWeapon", "be","1=1" );
- register_forward( FM_SetModel, "fw_SetModel" );
-
- g_iMaxPlayers = get_maxplayers();
-
- //Hook Sound
- register_forward( FM_EmitSound, "fw_EmitSound" );
- }
- public plugin_precache()
- {
- for ( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
- {
- engfunc( EngFunc_PrecacheModel, g_szVmodels[ i ] );
- engfunc( EngFunc_PrecacheModel, g_szWmodels[ i ] );
- engfunc( EngFunc_PrecacheModel, g_szPmodels[ i ] );
- }
-
- for ( new i = 0; i < sizeof g_szNewSound; i++ )
- engfunc( EngFunc_PrecacheSound, g_szNewSound[ i ] );
- }
- public Event_CurWeapon( id )
- {
- new iWeapon = read_data( 2 );
- new CsTeams:iUserTeam = cs_get_user_team( id );
-
- if( iWeapon != CSW_KNIFE )
- return PLUGIN_CONTINUE;
-
- set_pev( id, pev_viewmodel2, g_szVmodels[ iUserTeam ] );
- set_pev( id, pev_weaponmodel2, g_szWmodels[ iUserTeam ] );
-
- return PLUGIN_CONTINUE;
- }
- public fw_SetModel( iEnt, const szModel[ ] )
- {
- if( !pev_valid( iEnt ) )
- return FMRES_IGNORED;
-
- if( !equali(szModel, g_szOldWmodel ) )
- return FMRES_IGNORED;
-
- new szClassName[ 33 ];
- pev( iEnt, pev_classname, szClassName, charsmax( szClassName ) );
-
- new id = pev( iEnt, pev_owner );
- new CsTeams:iUserTeam = cs_get_user_team( id );
-
- if( equal( szClassName, "weaponbox" ) || equal( szClassName, "armoury_entity" ) || equal( szClassName, "grenade" ) )
- {
- engfunc( EngFunc_SetModel, iEnt, g_szWmodels[ iUserTeam ] );
- return FMRES_SUPERCEDE;
- }
- return FMRES_IGNORED;
- }
- public fw_EmitSound( id, iChannel, const szSample[], Float:fVolume, Float:fAttenuation, iFlags, iPitch )
- {
- if ( !IsPlayer( id ) || !is_user_alive(id) || !is_user_connected( id ) )
- return FMRES_IGNORED;
-
- if ( iChannel != CHAN_WEAPON && iChannel != CHAN_ITEM )
- return FMRES_IGNORED;
-
- if ( cs_get_user_team( id ) != CS_TEAM_T )
- return FMRES_IGNORED;
-
- for ( new i = 0; i < sizeof g_szOldSound; i++ )
- {
- if ( equali( szSample, g_szOldSound[ i ] ) )
- {
- engfunc( EngFunc_EmitSound, id, CHAN_WEAPON, g_szNewSound[ i ], VOL_NORM, ATTN_NORM, CHAN_AUTO, PITCH_NORM );
- return FMRES_SUPERCEDE;
- }
- }
- return FMRES_IGNORED;
- }
复制代码 小疏忽哈,已经修正错误和警告 |
|