搜索
查看: 6166|回复: 13

[AMXX 带源码] R版主麻烦能帮我取消掉这个吗?

[复制链接]
发表于 2010-10-11 00:42:20 | 显示全部楼层 |阅读模式 来自 中国–广西–贺州
很郁闷的说 , Q切换武器时老是出现这个出来!!!
  1. /* 本插件由 AMXX-Studio 中文版自动生成*/
  2. /* UTF-8 func by www.DT-Club.net */

  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <cstrike>
  6. #include <fakemeta_util>
  7. #include <hamsandwich>

  8. #define PLUGIN_NAME        "New Plug-In"
  9. #define PLUGIN_VERSION        "1.0"
  10. #define PLUGIN_AUTHOR        "Love灬Weiwei"

  11. #define WEAPON_CSW CSW_M4A1
  12. #define WEAPON_ENT "weapon_m4a1"
  13. #define WEAPON_RELOAD_TIME 4.0
  14. #define WEAPON_DRAW_TIME 2.0
  15. #define WEAPON_ADDSIL_TIME 1.8
  16. #define WEAPON_SHOOT_TIME 2.2

  17. #define TASK_SHOOT 1234

  18. enum {
  19.         anim_idle,
  20.         anim_reload,
  21.         anim_draw,
  22.         anim_shoot1,
  23.         anim_shoot2,
  24.         anim_shoot3,
  25.         anim_add,
  26.         anim_idle_unsil,
  27. }

  28. new g_reloading[33],g_addsil[33],g_shooting[33],g_hasDoneCurWeap[33]

  29. const m_pPlayer = 41    //用于寻找实体主人
  30. const m_flNextPrimaryAttack = 46

  31. public plugin_init()
  32. {
  33.         register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
  34.         register_forward(FM_CmdStart, "forward_cmdstart")
  35.         register_forward(FM_UpdateClientData, "UpdateClientData_Post", 1)
  36.        
  37.         register_event("CurWeapon","Current_Weapon","be","1=1")
  38.        
  39.         RegisterHam(Ham_Weapon_PrimaryAttack, WEAPON_ENT, "fw_WeapPriAttack", 1)
  40.         RegisterHam(Ham_Weapon_Reload, WEAPON_ENT, "fw_WeaponReload",1);
  41.         RegisterHam(Ham_Item_Deploy, WEAPON_ENT, "fw_WeaponDeployPost", 1);
  42.        
  43.         //在此处添加您的代码...
  44. }

  45. public native_playanim(player,anim)
  46. {
  47.         set_pev(player, pev_weaponanim, anim)
  48.         message_begin(MSG_ONE, SVC_WEAPONANIM, {0, 0, 0}, player)
  49.         write_byte(anim)
  50.         write_byte(pev(player, pev_body))
  51.         message_end()
  52. }


  53. public forward_cmdstart(id, uc_handle, seed)
  54. {
  55.         if(!is_user_alive(id) || get_user_weapon(id) != WEAPON_CSW || !(get_user_flags(id) & ADMIN_LEVEL_C))
  56.                 return PLUGIN_HANDLED
  57.                
  58.         if((get_uc(uc_handle, UC_Buttons) & IN_ATTACK2) && !(pev(id, pev_oldbuttons) & IN_ATTACK2) )
  59.         {
  60.                 if(!g_reloading[id] && !g_addsil[id])
  61.                 {
  62.                         if(cs_get_user_zoom(id) == CS_SET_AUGSG552_ZOOM)
  63.                         {
  64.                                 cs_set_user_zoom(id,CS_RESET_ZOOM,1)
  65.                         }
  66.                         else
  67.                         {
  68.                                 cs_set_user_zoom(id,CS_SET_AUGSG552_ZOOM,1)
  69.                         }
  70.                        
  71.                         emit_sound(id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100)
  72.                 }

  73.         }
  74.        

  75.         if( get_uc(uc_handle, UC_Impulse) ==  201 && !g_reloading[id] && !g_addsil[id] && !g_shooting[id])
  76.         {

  77.                 cs_set_user_zoom(id, CS_RESET_ZOOM, 0)
  78.                
  79.                 remove_task(id)
  80.                 g_addsil[id] = true
  81.                 set_task(WEAPON_ADDSIL_TIME,"Finish_addSil",id)
  82.                
  83.                 new ent = fm_find_ent_by_owner(-1, WEAPON_ENT,id)
  84.                
  85.                 if(cs_get_weapon_silen(ent))
  86.                 {
  87.                         cs_set_weapon_silen(ent,0,1)
  88.                 }
  89.                        
  90.                 else
  91.                 {
  92.                         cs_set_weapon_silen(ent,1,1)       
  93.                 }
  94.                                
  95.         }

  96.         new cmd
  97.        
  98.         if(g_addsil[id])
  99.         {
  100.                 if((cmd = get_uc(uc_handle, UC_Buttons)) & IN_ATTACK )
  101.                 {
  102.                         cmd &= ~IN_ATTACK
  103.                         set_uc(uc_handle, UC_Buttons, cmd)
  104.                 }               
  105.                
  106.                 if((cmd = get_uc(uc_handle, UC_Buttons)) & IN_RELOAD )
  107.                 {
  108.                         cmd &= ~IN_RELOAD
  109.                         set_uc(uc_handle, UC_Buttons, cmd)
  110.                 }               
  111.         }
  112.        
  113.         if((cmd = get_uc(uc_handle, UC_Buttons)) & IN_ATTACK2 )
  114.         {
  115.                 cmd &= ~IN_ATTACK2
  116.                 set_uc(uc_handle, UC_Buttons, cmd)
  117.         }
  118.                                
  119.        
  120.         return PLUGIN_HANDLED
  121. }

  122. public Finish_WeapReload(id)
  123. {

  124.         g_reloading[id] = false
  125.        
  126. }

  127. public Finish_addSil(id)
  128. {
  129.         g_addsil[id] = false
  130.        
  131.         if(is_user_alive(id) && get_user_weapon(id) == WEAPON_CSW)
  132.         {
  133.                 new ent = fm_find_ent_by_owner(-1, WEAPON_ENT,id)
  134.                
  135.                 if(cs_get_weapon_silen(ent))
  136.                         native_playanim(id,anim_idle)
  137.                 else
  138.                         native_playanim(id,anim_idle_unsil)
  139.         }
  140. }

  141. public Finish_shoot(taskid)
  142. {
  143.         new id = taskid-TASK_SHOOT
  144.        
  145.         g_shooting[id] = false
  146. }

  147. public Current_Weapon(id)
  148. {
  149.         if(!g_hasDoneCurWeap[id] && get_user_weapon(id) != WEAPON_CSW)
  150.         {
  151.                 remove_task(id)
  152.                 remove_task(id+TASK_SHOOT)
  153.                 g_reloading[id] = false
  154.                 g_addsil[id] = false
  155.                 g_shooting[id] = false
  156.                 g_hasDoneCurWeap[id] = true
  157.         }

  158. }

  159. public UpdateClientData_Post( id, sendweapons, cd_handle )
  160. {
  161.         if(!is_user_alive(id) || !g_addsil[id] || get_user_weapon(id) != WEAPON_CSW)
  162.                 return PLUGIN_HANDLED
  163.        
  164.         set_cd(cd_handle, CD_ID, 1);
  165.        
  166.         return PLUGIN_CONTINUE
  167. }


  168. public fw_WeaponReload(weapon)
  169. {
  170.         static id;
  171.         id = get_pdata_cbase(weapon, m_pPlayer, 4);
  172.        
  173.         cs_set_user_zoom(id, CS_RESET_ZOOM, 0)       
  174.        
  175.         remove_task(id)
  176.         g_reloading[id] = true
  177.         set_task(WEAPON_RELOAD_TIME,"Finish_WeapReload",id)
  178. }

  179. public fw_WeaponDeployPost(weapon)
  180. {
  181.         static id;
  182.         id = get_pdata_cbase(weapon, m_pPlayer, 4);
  183.        
  184.         remove_task(id)
  185.         g_reloading[id] = true
  186.         set_task(WEAPON_DRAW_TIME,"Finish_WeapReload",id)
  187.        
  188.         g_hasDoneCurWeap[id] = false
  189.        
  190.         client_print(id,print_chat,"VIP超级M4专属武器,右键开镜,T键使用特殊功能。")
  191. }

  192. public fw_WeapPriAttack(weapon)
  193. {
  194.         static id;
  195.         id = get_pdata_cbase(weapon, m_pPlayer, 4);
  196.        
  197.         if(cs_get_user_zoom(id) == CS_SET_AUGSG552_ZOOM)
  198.         {
  199.                 static Float:weap_delay
  200.                 weap_delay = get_pdata_float(weapon, 46, 4) * 1.5
  201.                
  202.                 set_pdata_float(weapon, m_flNextPrimaryAttack, weap_delay, 4)
  203.         }
  204.        
  205.         remove_task(id+TASK_SHOOT)
  206.         g_shooting[id] = true
  207.         set_task(WEAPON_SHOOT_TIME,"Finish_shoot",id+TASK_SHOOT)
  208. }
  209. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  210. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset134 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2052\\ f0\\ fs16 \n\\ par }
  211. */
复制代码

本帖子中包含更多资源

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

×
 楼主| 发表于 2010-10-11 00:43:19 | 显示全部楼层 来自 中国–广西–贺州
能帮我 改一下吗???老是出现这个 很烦的
回复

使用道具 举报

 楼主| 发表于 2010-10-11 00:44:42 | 显示全部楼层 来自 中国–广西–贺州
还有在麻烦你 能帮我加入个权限吗??R我知道你在线的:loveliness:
  1. /* AMX MOD Script
  2. *  Hydralisk
  3. *  2005.7.16
  4. *  For RonyDick
  5. *  Admin Command:
  6. *    hy_sun_wear <nick> <0/1> :   1-make someone have sunglasses, 1-make someone haven't sunglasses
  7. *  User Command:
  8. *    buyglasses               :   buy sun glasses
  9. *    say sunglasses           :   buy sun glasses
  10. *  Cvar:
  11. *    hy_sun_cost <money>      :   the price of sun glasses
  12. *    hy_sun_times <number>    :   set how many times can a sunglasses be used up.
  13. *  Info:
  14. *    Sun glasses can keep one from flashbang.
  15. *    Sun glasses will lost if the player dead.
  16. */

  17. #include <amxmod>
  18. #include <amxmisc>


  19. #define ICON_HIDE 0
  20. #define ICON_SHOW 1
  21. #define ICON_FLASH 2
  22. #define ICON_S "suithelmet_full"


  23. new wear_sun[33]
  24. new bool:in_buyzone[33]

  25. public plugin_init(){
  26.         register_plugin("Sun Glasses","0.1","Hydralisk")
  27.         register_clcmd("buyglasses","buyglasses",ADMIN_RESERVATION,"buy sun glasses")
  28.         register_clcmd("say sunglasses","buyglasses",ADMIN_RESERVATION,"buy sun glasses")
  29.         register_concmd("hy_sun_wear","wearglasses",ADMIN_RESERVATION|ADMIN_LEVEL_B,"<nick> <0/1>")
  30.         register_cvar("hy_sun_cost","800")
  31.         register_cvar("hy_sun_times","8")
  32.         register_event("ScreenFade","det_fade","be","1!0","2!0","7!0")
  33.         register_event("TextMsg", "end_round", "a", "2&#Game_C", "2&#Game_w")
  34.         register_event("DeathMsg","death","a")
  35.         register_event("ResetHUD","reset","b")
  36.         register_event("StatusIcon","detBuy","be","2=buyzone")
  37.         return PLUGIN_CONTINUE
  38. }

  39. public detBuy(id){
  40.         if (read_data(1))
  41.                 in_buyzone[id] = true
  42.         else
  43.                 in_buyzone[id] = false

  44.         return PLUGIN_CONTINUE

  45. }

  46. public death(){
  47.         new id = read_data(2)
  48.         wear_sun[id] = 0
  49.         screen_icon(id,ICON_S,0,0,0,ICON_HIDE)
  50.         return PLUGIN_CONTINUE
  51. }

  52. public reset(id){
  53.         if (wear_sun[id]>1){
  54.                 new full = get_cvar_num("hy_sun_times")
  55.                 full = floatround(255.0 * float(wear_sun[id])/float(full))
  56.                 screen_icon(id,ICON_S,0,full,255-full,ICON_SHOW)
  57.         }
  58.         if (wear_sun[id] == 1){
  59.                 screen_icon(id,ICON_S,0,0,255,ICON_FLASH)
  60.         }
  61.         return PLUGIN_CONTINUE
  62. }

  63. public end_round(){
  64.         for (new i = 1; i<=32;i++)
  65.                 wear_sun[i] = 0
  66. }

  67. public det_fade(id){
  68.         if (wear_sun[id]){
  69.                 wear_sun[id] --
  70.                 screen_fade(id,0,0,0,0,0)
  71.                 set_hudmessage(255,0,0,-1.0,-0.45,1,6.0,10.0,1.3,0.7,9)
  72.                 show_hudmessage(id,"Your sunglasses have just keep you from a flashbang, %d times left.",wear_sun[id])
  73.                 if (wear_sun[id]>1){
  74.                         new full = get_cvar_num("hy_sun_times")
  75.                         full = floatround(255.0 * float(wear_sun[id])/float(full))
  76.                         screen_icon(id,ICON_S,255-full,full,0,ICON_SHOW)
  77.                 }
  78.                 if (wear_sun[id] == 1){
  79.                         screen_icon(id,ICON_S,0,255,0,ICON_FLASH)
  80.                 }
  81.                 if (wear_sun[id] == 0){
  82.                         screen_icon(id,ICON_S,0,0,0,ICON_HIDE)
  83.                 }
  84.         }
  85. }

  86. public buyglasses(id){
  87.         new cmd[33],bool:rtn
  88.         read_argv(0,cmd,32)
  89.         if (equal(cmd,"buyglasses"))
  90.           rtn = true
  91.         else
  92.           rtn = false
  93.         if (!is_user_alive(id)) return rtn?PLUGIN_HANDLED:PLUGIN_CONTINUE
  94.         if (!in_buyzone[id]) return rtn?PLUGIN_HANDLED:PLUGIN_CONTINUE
  95.         new full = get_cvar_num("hy_sun_times")
  96.         if (wear_sun[id] >= full){
  97.                 client_print(id,print_center,"You have already got the sun glasses")
  98.                 return rtn?PLUGIN_HANDLED:PLUGIN_CONTINUE
  99.         }
  100.         new moneycost = get_cvar_num("hy_sun_cost")
  101.         new pmoney = get_user_money(id)
  102.         if (moneycost > pmoney){
  103.                 client_print(id,print_center,"You have not enough money")
  104.                 return rtn?PLUGIN_HANDLED:PLUGIN_CONTINUE
  105.         }
  106.         set_user_money(id,pmoney - moneycost)
  107.         wear_sun[id] = full
  108.         if (wear_sun[id]>1){
  109.                 full = floatround(255.0 * float(wear_sun[id])/float(full))
  110.                 screen_icon(id,ICON_S,255-full,full,0,ICON_SHOW)
  111.         }
  112.         if (wear_sun[id] == 1){
  113.                 screen_icon(id,ICON_S,0,255,0,ICON_FLASH)
  114.         }       
  115.         return rtn?PLUGIN_HANDLED:PLUGIN_CONTINUE
  116. }

  117. public wearglasses(id,level,cid){
  118.         if (!cmd_access(id,level,cid,3)) return PLUGIN_HANDLED
  119.         new arg[33],arg2[8]
  120.         read_argv(1,arg,32)
  121.         read_argv(2,arg2,7)
  122.         new player = cmd_target(id,arg,4)
  123.         if (!player) return PLUGIN_HANDLED
  124.         new name[33]
  125.         get_user_name(player,name,32)
  126.         if (equal(arg2,"1")){
  127.                 wear_sun[player] = get_cvar_num("hy_sun_times")
  128.                 if (wear_sun[player]>1){
  129.                         new full = get_cvar_num("hy_sun_times")
  130.                         full = floatround(255.0 * float(wear_sun[player])/float(full))
  131.                         screen_icon(player,ICON_S,255-full,full,0,ICON_SHOW)
  132.                 }
  133.                 if (wear_sun[player] == 1){
  134.                         screen_icon(player,ICON_S,0,255,0,ICON_FLASH)
  135.                 }
  136.                 console_print(id,"%s has been armed",name)
  137.         } else if (equal(arg2,"0")){
  138.                 wear_sun[player] = 0
  139.                 screen_icon(player,ICON_S,0,0,0,ICON_HIDE)
  140.                 console_print(id,"%s has been disarmed",name)
  141.         } else {
  142.                 console_print(id,"the 3rd parm must be 0 or 1")
  143.         }
  144.         return PLUGIN_HANDLED
  145. }

  146. public client_connect(id){
  147.         wear_sun[id] = 0
  148. }

  149. stock screen_icon(id,icon[],r,g,b,type){
  150. //        new string [8][32] = {"dmg_rad","item_longjump","dmg_shock","item_healthkit","dmg_heat","suit_full","cross","dmg_gas"}
  151.         message_begin( MSG_ONE, get_user_msgid("StatusIcon"), {0,0,0}, id )
  152.         write_byte( type ) // status
  153.         write_string( icon ) // sprite name
  154.         write_byte( r ) // red
  155.         write_byte( g ) // green
  156.         write_byte( b ) // blue
  157.         message_end()
  158. }

  159. stock screen_fade(id,r,g,b,alpha,tm){
  160.         message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id)
  161.         write_short( 1<<tm ) // fade lasts this long duration
  162.         write_short( 1<<tm ) // fade lasts this long hold time
  163.         write_short( 1<<12 ) // fade type (in / out)
  164.         write_byte( r ) // fade red
  165.         write_byte( g ) // fade green
  166.         write_byte( b ) // fade blue
  167.         write_byte( alpha ) // fade alpha
  168.         message_end()
  169. }
复制代码
回复

使用道具 举报

发表于 2010-10-11 08:15:22 | 显示全部楼层 来自 中国–广东–清远
是不是你绑定了 Q键为购买超级M4啊?
回复

使用道具 举报

 楼主| 发表于 2010-10-11 13:22:08 | 显示全部楼层 来自 中国–广西–贵港
4# starekr


不是购买!!! 麻烦能看一下源码吗?吗?
回复

使用道具 举报

发表于 2010-10-11 20:15:29 | 显示全部楼层 来自 中国–广东–广州
{:2_38:}
//client_print(id,print_chat,"VIP超级M4专属武器,右键开镜,T键使用特殊功能。")
回复

使用道具 举报

 楼主| 发表于 2010-10-11 20:37:02 | 显示全部楼层 来自 中国–广西–贵港
6# rsdtt


我取消过了,编辑总是错误的
回复

使用道具 举报

 楼主| 发表于 2010-10-11 20:39:40 | 显示全部楼层 来自 中国–广西–贵港
很郁闷啊 !!!

本帖子中包含更多资源

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

×
回复

使用道具 举报

发表于 2010-10-11 21:04:32 | 显示全部楼层 来自 中国–广东–揭阳
<fakemeta_util
你自己缺这个,本来就编译不了
回复

使用道具 举报

 楼主| 发表于 2010-10-11 21:30:36 | 显示全部楼层 来自 中国–广西–贵港
9# rsdtt


版主,那能帮我加入个权限吗? 下面的源码 拜托了
回复

使用道具 举报

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

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