找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 579|回复: 5

[已解决] 哪位大侠帮我看看我的这段源码问题出在哪里???

[复制链接]

该用户从未签到

发表于 2011-11-4 18:54:58 | 显示全部楼层 |阅读模式

  1. #include <amxmod>
  2. #include <amxmisc>

  3. new gMsgScreenFade
  4. public admin_flash(id,level,cid)
  5. {
  6.     if (!cmd_access(id,level,cid,3)) {
  7.        return PLUGIN_HANDLED
  8.     }

  9.    new victim[32]
  10.    read_argv(1,victim,31)
  11.     new arg2[32]
  12.     read_argv(2,arg2,31)
  13.     new number=strtonum(arg2)
  14.     if (number==0) number=1

  15.    if (victim[0]=='@') {
  16.       new team[32], inum
  17.        get_players(team,inum,"e",victim[1])
  18.        if (inum==0) {
  19.           console_print(id,"[AMX] No clients found on such team.")
  20.          return PLUGIN_HANDLED
  21.       }
  22.       for (new i=0;i<inum;++i) {
  23.           new ids[1]
  24.           ids[0] = team        
  25.           Flash(ids)
  26.           if(number > 1)
  27.              set_task(1.0, "Flash", 5145102+team, ids, 1, "a", number-2)
  28.           emit_sound(team,CHAN_BODY, "weapons/flashbang-2.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH)
  29.           //client_print(id,print_chat,"[AMX] You Flashed all %s's.",victim[1])
  30.          client_print(id,print_chat,"[OGYAi] A{u{FH %s's `@ %i .",victim[1],number)
  31.       }
  32.     }
  33.     else if (victim[0]=='*') {
  34.       new all[32], inum
  35.        get_players(all,inum)
  36.        for (new i=0;i<inum;++i) {
  37.          new ids[1]
  38.           ids[0] = all
  39.           Flash(ids)
  40.           if(number > 1)
  41.              set_task(1.0, "Flash", 2422141+all, ids, 1, "a", number-2)
  42.           emit_sound(all,CHAN_BODY, "weapons/flashbang-2.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH)
  43.           //client_print(id,print_chat,"[AMX] You Flashed everyone.")
  44.           client_print(id,print_chat,"[OGYAi] [url=mailto:A%7Bu%7BFC@H]A{u{FC@H[/url] %i .",number)
  45.       }
  46.     }
  47.    else {
  48.       new player = cmd_target(id,victim,0)
  49.       new playername[32]
  50.       get_user_name(player,playername,31)
  51.        if (!player) {  
  52.           return PLUGIN_HANDLED
  53.        }
  54.       new ids[1]
  55.        ids[0] = player
  56.        Flash(ids)
  57.        if(number > 1)
  58.         set_task(1.0, "Flash", 34571124+player, ids, 1, "a", number-2)
  59.         emit_sound(player,CHAN_BODY, "weapons/flashbang-2.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH)
  60.        //client_print(id,print_chat,"[AMX] You Flashed %s.",playername)
  61.        client_print(id,print_chat,"[OGYAi] A{u{F %s `@ %i .",playername,number)
  62.     }
  63.     return PLUGIN_HANDLED
  64. }

  65. public Flash(ids[])
  66. {
  67.          new id = ids[0]
  68.          message_begin(MSG_ONE,gMsgScreenFade,{0,0,0},id)
  69.          write_short( 1<<15 )
  70.          write_short( 3600 )
  71.          write_short( 1<<12 )
  72.          write_byte( 255 )
  73.          write_byte( 255 )
  74.          write_byte( 255 )
  75.          write_byte( 255 )
  76.          message_end()
  77. }

  78. public plugin_init()
  79. {
  80.     register_plugin("Admin Flash","1.1","AssKicR")
  81.     register_concmd("amx_flash","admin_flash",ADMIN_LEVEL_A,"< Wr, #s, @,  *  > <time in sec> flashes selected client(s)")
  82.     gMsgScreenFade = get_user_msgid("ScreenFade")
  83.     return PLUGIN_CONTINUE
  84. }
  85.    
  86. public plugin_precache()
  87. {
  88.      // FLASHBANG SOUND
  89.      precache_sound( "weapons/flashbang-2.wav" )
  90. }
复制代码


该用户从未签到

发表于 2011-11-4 21:39:37 | 显示全部楼层
这语言没有怎么看过,所以无法帮LZ了。

不过提醒一个地方:Flash(ids[]) 这个函数的参数从方法体上看完全不需要使用数组,只需传递一个id即可

该用户从未签到

发表于 2011-11-4 23:03:08 | 显示全部楼层
这是什么? PHP? JAVA? JS? 为什么一个分号都没有?

点评

插件,是pawn语言  详情 回复 发表于 2011-11-6 02:17

该用户从未签到

发表于 2011-11-6 02:17:46 | 显示全部楼层
咚咚咚 发表于 2011-11-4 07:03
这是什么? PHP? JAVA? JS? 为什么一个分号都没有?

插件,是pawn语言

该用户从未签到

发表于 2011-11-6 02:29:04 | 显示全部楼层
你数组都没加下标。。
改一下后能编译了,能不能用是不知道的。。

  1. #include <amxmod>
  2. #include <amxmisc>

  3. new gMsgScreenFade
  4. public admin_flash(id,level,cid)
  5. {
  6.     if (!cmd_access(id,level,cid,3)) {
  7.        return PLUGIN_HANDLED
  8.     }

  9.    new victim[32]
  10.    read_argv(1,victim,31)
  11.     new arg2[32]
  12.     read_argv(2,arg2,31)
  13.     new number=strtonum(arg2)
  14.     if (number==0) number=1

  15.    if (victim[0]=='@') {
  16.       new team[32], inum
  17.        get_players(team,inum,"e",victim[1])
  18.        if (inum==0) {
  19.           console_print(id,"[AMX] No clients found on such team.")
  20.          return PLUGIN_HANDLED
  21.       }
  22.       for (new i=0;i<inum;++i) {
  23.           new ids[1]
  24.           ids[0] = team[i]
  25.           Flash(ids)
  26.           if(number > 1)
  27.              set_task(1.0, "Flash", 5145102+team[i], ids, 1, "a", number-2)
  28.           emit_sound(team[i], CHAN_BODY, "weapons/flashbang-2.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH)
  29.           //client_print(id,print_chat,"[AMX] You Flashed all %s's.",victim[1])
  30.          client_print(id, print_chat,"[OGYAi] A{u{FH %s's `@ %i .",victim[1],number)
  31.       }
  32.     }
  33.     else if (victim[0]=='*') {
  34.       new all[32], inum
  35.        get_players(all,inum)
  36.        for (new i=0;i<inum;++i) {
  37.          new ids[1]
  38.           ids[0] = all[i]
  39.           Flash(ids)
  40.           if(number > 1)
  41.              set_task(1.0, "Flash", 2422141+all[i], ids, 1, "a", number-2)
  42.           emit_sound(all[i], CHAN_BODY, "weapons/flashbang-2.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH)
  43.           //client_print(id,print_chat,"[AMX] You Flashed everyone.")
  44.           client_print(id,print_chat,"[OGYAi] A{u{FC@H %i .",number)
  45.       }
  46.     }
  47.    else {
  48.       new player = cmd_target(id,victim,0)
  49.       new playername[32]
  50.       get_user_name(player,playername,31)
  51.        if (!player) {  
  52.           return PLUGIN_HANDLED
  53.        }
  54.       new ids[1]
  55.        ids[0] = player
  56.        Flash(ids)
  57.        if(number > 1)
  58.         set_task(1.0, "Flash", 34571124+player, ids, 1, "a", number-2)
  59.         emit_sound(player,CHAN_BODY, "weapons/flashbang-2.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH)
  60.        //client_print(id,print_chat,"[AMX] You Flashed %s.",playername)
  61.        client_print(id,print_chat,"[OGYAi] A{u{F %s `@ %i .",playername,number)
  62.     }
  63.     return PLUGIN_HANDLED
  64. }

  65. public Flash(ids[])
  66. {
  67.          new id = ids[0]
  68.          message_begin(MSG_ONE,gMsgScreenFade,{0,0,0},id)
  69.          write_short( 1<<15 )
  70.          write_short( 3600 )
  71.          write_short( 1<<12 )
  72.          write_byte( 255 )
  73.          write_byte( 255 )
  74.          write_byte( 255 )
  75.          write_byte( 255 )
  76.          message_end()
  77. }

  78. public plugin_init()
  79. {
  80.     register_plugin("Admin Flash","1.1","AssKicR")
  81.     register_concmd("amx_flash","admin_flash",ADMIN_LEVEL_A,"< Wr, #s, @,  *  > <time in sec> flashes selected client(s)")
  82.     gMsgScreenFade = get_user_msgid("ScreenFade")
  83.     return PLUGIN_CONTINUE
  84. }
  85.    
  86. public plugin_precache()
  87. {
  88.      // FLASHBANG SOUND
  89.      precache_sound( "weapons/flashbang-2.wav" )
  90. }
复制代码

该用户从未签到

 楼主| 发表于 2011-11-7 13:05:13 | 显示全部楼层
大哥,万分感谢了!!!!!{:soso_e178:}
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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