cs插件吧 关注:8,262贴子:88,639
  • 10回复贴,共1

求一个完整的开局随机得武器插件

只看楼主收藏回复

我一直用的这个开局随机武器插件(randomweapon.amxx)除了t的galil步枪,其他枪都可以随机得到,纠结~


IP属地:广西来自Android客户端1楼2024-06-18 19:54回复
    xp不是自帶嗎?


    IP属地:湖北来自Android客户端2楼2024-10-15 03:05
    收起回复
      通过网盘分享的文件:wp.amxx
      链接: https://pan.baidu.com/s/11Is0LtOJu32b3aZRJBquEw?pwd=n397 提取码: n397
      使用说明:
      amx_wpmenu 1/0 开启或关闭插件
      / 斜杆打开武器菜单,可以选择任意指定武器
      mp_wprand 1/0 随机武器模式 或 指定武器模式开关
      mp_wpchange X 随机武器模式下,X表示几局更换武器
      内含 黑夜模式。黑夜模式有强光手电及夜视仪


      IP属地:浙江3楼2024-10-19 23:31
      回复
        #include <amxmodx>
        #include <fakemeta>
        #include <fun>
        #define MAX_WEAPONS 39
        // Define weapons pool (所有武器)
        const String:weapons[MAX_WEAPONS] = {
        "weapon_ak47", "weapon_awp", "weapon_deagle", "weapon_famas", "weapon_m4a1",
        "weapon_p90", "weapon_usp", "weapon_knife", "weapon_scout", "weapon_xm1014",
        "weapon_mac10", "weapon_ump45", "weapon_glock18", "weapon_fiveseven", "weapon_p250",
        "weapon_tec9", "weapon_m3", "weapon_m249", "weapon_aug", "weapon_elite",
        "weapon_sg550", "weapon_sg552", "weapon_galil", "weapon_flamer", "weapon_c4",
        "weapon_shield", "weapon_nova", "weapon_scout", "weapon_m249", "weapon_m3",
        "weapon_flamer", "weapon_mach", "weapon_hkp2000", "weapon_ump45", "weapon_knife",
        "weapon_mp5navy", "weapon_g3sg1", "weapon_sg552", "weapon_cz75auto"
        };
        public plugin_init() {
        register_plugin("Random Weapon on Round Start", "1.0", "kakke");
        // Register the event for round start
        register_event("HLTV", "round_start", "a", "1=0", "2=1");
        // Check if the plugin is enabled through the cvar
        if (get_cvar_num("sv_random_weapon_enabled") == 0) {
        return; // If the plugin is disabled in the config, exit the plugin initialization
        }
        }
        public round_start() {
        // Check if the plugin is enabled through the cvar
        if (get_cvar_num("sv_random_weapon_enabled") == 0) {
        return; // If the plugin is disabled in the config, don't execute the weapon assignment
        }
        // Loop through all players to assign them a random weapon
        for (new i = 1; i <= get_maxplayers(); i++) {
        if (is_user_connected(i)) {
        // Pick a random weapon
        new random_weapon = get_random_int(0, MAX_WEAPONS - 1);
        give_player_weapon(i, random_weapon);
        }
        }
        }
        public give_player_weapon(player, random_weapon) {
        // Get the weapon name from the array
        new weapon[32];
        strcopy(weapon, sizeof(weapon), weapons[random_weapon]);
        // Give the player the weapon
        client_cmd(player, "use %s", weapon);
        }
        sv_random_weapon_enabled 1 // 启用插件,设置为 0 禁用插件


        IP属地:湖北4楼2025-01-22 12:46
        收起回复
          #include <amxmodx>
          #include <fakemeta>
          #include <fun>
          #define MAX_WEAPONS 39
          // 定义武器池 (所有武器)
          new String:weapons[MAX_WEAPONS][32] = {
          "weapon_ak47", "weapon_awp", "weapon_deagle", "weapon_famas", "weapon_m4a1",
          "weapon_p90", "weapon_usp", "weapon_knife", "weapon_scout", "weapon_xm1014",
          "weapon_mac10", "weapon_ump45", "weapon_glock18", "weapon_fiveseven", "weapon_p250",
          "weapon_tec9", "weapon_m3", "weapon_m249", "weapon_aug", "weapon_elite",
          "weapon_sg550", "weapon_sg552", "weapon_galil", "weapon_flamer", "weapon_c4",
          "weapon_shield", "weapon_nova", "weapon_scout", "weapon_m249", "weapon_m3",
          "weapon_flamer", "weapon_mach", "weapon_hkp2000", "weapon_ump45", "weapon_knife",
          "weapon_mp5navy", "weapon_g3sg1", "weapon_sg552", "weapon_cz75auto"
          };
          public plugin_init() {
          register_plugin("Random Weapon on Round Start", "1.0", "kakke");
          // 注册回合开始事件
          register_event("Round_Start", "round_start", "a");
          // 检查插件是否启用
          if (get_cvar_num("sv_random_weapon_enabled") == 0) {
          return; // 如果插件在配置中被禁用,则退出插件初始化
          }
          }
          public round_start() {
          // 检查插件是否启用
          if (get_cvar_num("sv_random_weapon_enabled") == 0) {
          return; // 如果插件在配置中被禁用,则不执行武器分配
          }
          // 遍历所有玩家,给他们分配随机武器
          for (new i = 1; i <= get_maxplayers(); i++) {
          if (is_user_connected(i)) {
          // 随机选择一个武器
          new random_weapon = get_random_int(0, MAX_WEAPONS - 1);
          give_player_weapon(i, random_weapon);
          }
          }
          }
          public give_player_weapon(player, random_weapon) {
          // 从数组中获取武器名称
          new weapon[32];
          strcopy(weapon, sizeof(weapon), weapons[random_weapon]);
          // 给玩家分配武器
          give_item(player, weapon);
          }
          sv_random_weapon_enabled 1 // 启用插件,设置为 0 禁用


          IP属地:湖北来自iPhone客户端5楼2025-01-31 10:06
          收起回复