搜索
楼主: 点通粉丝

己解决主题-在此感谢kk阿郎的帮忙

[复制链接]
发表于 2011-3-7 23:55:53 | 显示全部楼层 来自 中国–广东–东莞
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <fakemeta>

  4. new const g_szVmodels[ CsTeams ][] = {
  5.         "",
  6.         "models/v_hgun.mdl",
  7.         "models/v_crowbar.mdl",
  8.         ""
  9. };

  10. new const g_szPmodels[ CsTeams ][] = {
  11.         "",
  12.         "models/p_hgun.mdl",
  13.         "models/p_crowbar.mdl",
  14.         ""
  15. };

  16. new const g_szWmodels[ CsTeams ][] = {
  17.         "",
  18.         "models/w_hgun.mdl",
  19.         "models/w_crowbar.mdl",
  20.         ""
  21. };

  22. new const g_szOldSound[][] = {
  23.         "sound/weapons/knife_deploy1.wav",
  24.         "sound/weapons/knife_slash1.wav" ,
  25.         "sound/weapons/knife_slash2.wav",
  26.         "sound/weapons/knife_hit1.wav" ,
  27.         "sound/weapons/knife_hit2.wav",
  28.         "sound/weapons/knife_hit3.wav",
  29.         "sound/weapons/knife_hit4.wav",
  30.         "sound/weapons/knife_stab.wav",
  31.         "sound/weapons/knife_hitwall1.wav"
  32. };

  33. new const g_szNewSound[][] = {
  34.         "sound/weapons/fiveseven_clipin.wav",
  35.         "sound/FeNgGe/FeNgGe_7.wav",
  36.         "sound/FeNgGe/FeNgGe_7.wav",
  37.         "sound/FeNgGe/FeNgGe_8.wav",
  38.         "sound/FeNgGe/FeNgGe_8.wav",
  39.         "sound/FeNgGe/FeNgGe_8.wav",
  40.         "sound/FeNgGe/FeNgGe_9.wav",
  41.         "sound/debris/concrete3.wav",
  42.         "这里再加一个音效"
  43. };

  44. new const g_szOldWmodel[] = "models/w_knife.mdl";

  45. new const PLUGIN_NAME[]                = "";
  46. new const PLUGIN_AUTHOR[]        = "";
  47. new const PLUGIN_VERSION[]        = "";

  48. #define IsPlayer(%1) (1<=%1<=g_iMaxPlayers)

  49. new g_iMaxPlayers;

  50. public plugin_init()
  51. {
  52.         register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR );
  53.         register_event( "CurWeapon", "Event_CurWeapon", "be","1=1" );
  54.         register_forward( FM_SetModel, "fw_SetModel" );
  55.        
  56.         g_iMaxPlayers = get_maxplayers();
  57.        
  58.         //Hook Sound
  59.         register_forward( FM_EmitSound, "fw_EmitSound" );
  60. }

  61. public plugin_precache()
  62. {
  63.         for ( new CsTeams:i = CS_TEAM_T; i <= CS_TEAM_CT; i++ )
  64.         {
  65.                 engfunc( EngFunc_PrecacheModel, g_szVmodels[ i ] );
  66.                 engfunc( EngFunc_PrecacheModel, g_szWmodels[ i ] );
  67.                 engfunc( EngFunc_PrecacheModel, g_szPmodels[ i ] );
  68.         }
  69.        
  70.         for ( new i = 0; i < sizeof g_szNewSound; i++ )
  71.                 engfunc( EngFunc_PrecacheSound, g_szNewSound[ i ] );
  72. }

  73. public Event_CurWeapon( id )
  74. {     
  75.         new iWeapon = read_data( 2 );
  76.         new CsTeams:iUserTeam = cs_get_user_team( id );
  77.        
  78.         if( iWeapon != CSW_KNIFE )
  79.                 return PLUGIN_CONTINUE;
  80.        
  81.         set_pev( id, pev_viewmodel2, g_szVmodels[ iUserTeam ] );
  82.         set_pev( id, pev_weaponmodel2, g_szWmodels[ iUserTeam ] );
  83.        
  84.         return PLUGIN_CONTINUE;
  85. }

  86. public fw_SetModel( iEnt, const szModel[ ] )
  87. {
  88.         if( !pev_valid( iEnt ) )
  89.                 return FMRES_IGNORED;
  90.        
  91.         if( !equali(szModel, g_szOldWmodel ) )
  92.                 return FMRES_IGNORED;
  93.        
  94.         new szClassName[ 33 ];
  95.         pev( iEnt, pev_classname, szClassName, charsmax( szClassName ) );
  96.        
  97.         new id = pev( iEnt, pev_owner );
  98.         new CsTeams:iUserTeam = cs_get_user_team( id );
  99.        
  100.         if( equal( szClassName, "weaponbox" ) || equal( szClassName, "armoury_entity" ) || equal( szClassName, "grenade" ) )
  101.         {
  102.                 engfunc( EngFunc_SetModel, iEnt, g_szWmodels[ iUserTeam ] );
  103.                 return FMRES_SUPERCEDE;
  104.         }
  105.         return FMRES_IGNORED;
  106. }

  107. public fw_EmitSound( id, iChannel, const szSample[], Float:fVolume, Float:fAttenuation, iFlags, iPitch )
  108. {
  109.         if ( !IsPlayer( id ) || !is_user_alive(id) || !is_user_connected( id ) )
  110.                 return FMRES_IGNORED;
  111.        
  112.         if ( iChannel != CHAN_WEAPON && iChannel != CHAN_ITEM )
  113.                 return FMRES_IGNORED;
  114.        
  115.         if ( cs_get_user_team( id ) != CS_TEAM_T )
  116.                 return FMRES_IGNORED;
  117.        
  118.         for ( new i = 0; i < sizeof g_szOldSound; i++ )
  119.         {
  120.                 if ( equali( szSample, g_szOldSound[ i ] ) )
  121.                 {
  122.                         engfunc( EngFunc_EmitSound, id, CHAN_WEAPON, g_szNewSound[ i ], VOL_NORM, ATTN_NORM, CHAN_AUTO, PITCH_NORM );
  123.                         return FMRES_SUPERCEDE;
  124.                 }
  125.         }
  126.         return FMRES_IGNORED;
  127. }
复制代码
小疏忽哈,已经修正错误和警告
回复

使用道具 举报

 楼主| 发表于 2011-3-8 02:26:31 | 显示全部楼层 来自 中国–广东–佛山–三水区
11# kk阿朗

可以编绎了..但是开图不足两分钟死机..提示是

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
回复

使用道具 举报

发表于 2011-3-8 10:33:14 | 显示全部楼层 来自 中国–江西–南昌
缺少模型  arcticT.mdl
回复

使用道具 举报

发表于 2011-3-8 11:33:00 | 显示全部楼层 来自 中国–广东–东莞
这个是你模型的问题,与代码无关!请确认所需模型全部具有!
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表