银闪闪 发表于 2009-5-3 23:28:32

50点通币求个AWP限制插件(不要awplimit.amxx)

本帖最后由 银闪闪 于 2009-5-15 16:52 编辑

求个CT和T双方各只能买两把AWP,如果别人还要买,中间文字提示:不好意思,AWP已经被抢购完了

不要awplimit.amxx(因这个插件只要赢对方三局以上赢方就不能买AWP了)



谢谢高手 给个吧!

银闪闪 发表于 2009-5-9 18:50:13

mei ren you ma ?

心静如水 发表于 2009-5-13 09:35:50

mei ren you ma ?
银闪闪 发表于 2009-5-9 18:50 http://www.dt-club.net/forum/images/common/back.gif
支持你,打仗哪里有那么多AWP给你用啊?

银闪闪 发表于 2009-5-13 19:40:41


支持你,打仗哪里有那么多AWP给你用啊?
心静如水 发表于 2009-5-13 09:35 http://www.dt-club.net/forum/images/common/back.gif
恩,就是就是,求高手写一个吧?带上源码,谢谢了·!

银闪闪 发表于 2009-5-15 20:29:00

顶上来,50点通币跪求源码

点通粉丝 发表于 2009-5-15 22:14:24

限制每队的awp数量插件
{:3_59:} 50点通币你点比我啊{:3_51:}#include <amxmod>

#define MAXAWPS 2 // number of awps a team can have
#define WINSPREAD 3 // the difference when it starts restricting awps for winning team

new plist = { 0, ... }   // 0 = no awp; 1 = carrying awp
new awp_count         // 1 = T; 2 = CT
new ctscore = 0
new tscore = 0

/* handles restricting the menu */
public menu_awp(id,key) {
   if (get_cvar_num("awplimit")!=1) return PLUGIN_CONTINUE
   new team = get_user_team(id)
   
   if((team == 2 && ctscore-tscore >= WINSPREAD) || (team == 1 && tscore-ctscore >= WINSPREAD))
   {
      engclient_cmd(id,"menuselect","10")
      client_print(id,print_center,"You are on the winning team and cannot use AWP's")
      return PLUGIN_HANDLED
   }
   
   if(awp_count >= MAXAWPS)
   {
      
      engclient_cmd(id,"menuselect","10")
      client_print(id,print_center,"Too many people on your team have AWP's")
      return PLUGIN_HANDLED
   }
   return PLUGIN_CONTINUE
}

/* handles if they script the AWP buy*/
public cmdawp(id)
{
   if (get_cvar_num("awplimit")!=1) return PLUGIN_CONTINUE
   new team = get_user_team(id)
   
   if((team == 2 && ctscore-tscore >= WINSPREAD) || (team == 1 && tscore-ctscore >= WINSPREAD))
   {
      client_print(id,print_center,"You are on the winning team and cannot use AWP's")
      return PLUGIN_HANDLED
   }
   
   if(awp_count >= MAXAWPS)
   {
      client_print(id,print_center,"Too many people on your team have AWP's")
      return PLUGIN_HANDLED
   }
   return PLUGIN_CONTINUE
}

/* handles when a player drops their weapon */
public handle_drop(id) {
   if (get_cvar_num("awplimit")!=1) return PLUGIN_CONTINUE
   if (plist == 1)
   {
      new tmp1,tmp2
      new curweapon = get_user_weapon(id,tmp1,tmp2)

      if (curweapon == 18)
      {
         plist = 0
         new team = get_user_team(id)
         awp_count--
      }
   }
   return PLUGIN_CONTINUE
}

/* handles when a player picks up an awp */
public handle_pickup(id) {

   if (get_cvar_num("awplimit")!=1) return PLUGIN_CONTINUE
   new team = get_user_team(id)

   if((team == 2 && ctscore-tscore >= WINSPREAD) || (team == 1 && tscore-ctscore >= WINSPREAD))
   {
      client_print(id,print_center,"You are on the winning team and cannot use AWP's")
      client_cmd(id,"weapon_awp;wait;wait;wait;drop")
      return PLUGIN_CONTINUE      
   }

   if (awp_count >= MAXAWPS)
   {
      client_print(id,print_center,"Too many people on your team have AWP's")
      client_cmd(id,"weapon_awp;wait;wait;wait;drop")
      return PLUGIN_CONTINUE      
   }
   else
   {
      plist = 1
      awp_count++
   }
   return PLUGIN_CONTINUE
}

/* removes awp when player dies */
public handle_death() {
   if (get_cvar_num("awplimit")!=1) return PLUGIN_CONTINUE
   new idx = read_data(2)

   if(plist == 1)
   {
      new team = get_user_team(idx)
      awp_count--

      plist = 0
   }
   return PLUGIN_CONTINUE
}

/* clear vars when player connects */
public client_connect(id) {
   if (get_cvar_num("awplimit")!=1) return PLUGIN_CONTINUE
   plist = 0 // just to make sure
   return PLUGIN_CONTINUE
}

/* clear vars when player disconnects */
public client_disconnect(id) {

   if (get_cvar_num("awplimit")!=1) return PLUGIN_CONTINUE
   if (plist == 1)
   {
      new team = get_user_team(id)
      awp_count--
   }
   plist = 0
   return PLUGIN_CONTINUE
}

public team_score()
{
   if (get_cvar_num("awplimit")!=1) return PLUGIN_CONTINUE
   new team
   read_data(1,team,32)

   if (equal(team,"CT")){
      ctscore = read_data(2)
   }
   else if (equal(team,"TERRORIST")){
      tscore = read_data(2)
   }
   return PLUGIN_CONTINUE
}

public check_winning_team(id)
{
   if (get_cvar_num("awplimit")!=1) return PLUGIN_CONTINUE
   if (plist == 1)
   {
      new team = get_user_team(id)
   
      if((team == 2 && ctscore-tscore >= WINSPREAD) || (team == 1 && tscore-ctscore >= WINSPREAD))
      {
         client_print(id,print_center,"You are on the winning team and cannot use AWP's")
         client_cmd(id,"weapon_awp;wait;wait;wait;drop")
         return PLUGIN_CONTINUE
      }
   }
   return PLUGIN_CONTINUE
}

public check_rebuy(id)
{
        if (get_cvar_num("checkrebuy")!=1) return PLUGIN_CONTINUE
        client_print(id,print_center,"Sorry Rebuy command is blocked on this server")

        return PLUGIN_HANDLED
}

public plugin_init(){
    register_plugin("AWP Limit (Team/Win)","0.4","SuicideDog")
    register_menucmd(-31,1<<5,"menu_awp")
    register_clcmd("drop","handle_drop")
    register_clcmd("awp","cmdawp")
    register_clcmd("rebuy","check_rebuy")
    register_cvar("awplimit","1")
    register_cvar("checkrebuy","1")
    register_event("TeamScore", "team_score", "a")
    register_event("WeapPickup","handle_pickup","b","1=18")
    register_event("DeathMsg","handle_death","a")
    register_event("ResetHUD","check_winning_team","b")
    return PLUGIN_CONTINUE
} 5# 银闪闪

心静如水 发表于 2009-5-15 22:19:33

顶上来,50点通币跪求源码
银闪闪 发表于 2009-5-15 20:29 http://www.dt-club.net/forum/images/common/back.gif
点通高手虽多,但除了jim_yang/Rulzy/zwfgdlc........几位老师大公无私以外,.........假设没有这几位...也许论坛已关闭了........所以说很担心论坛后继无人啊...........

银闪闪 发表于 2009-5-16 19:10:35

限制每队的awp数量插件
{:3_59:} 50点通币你点比我啊{:3_51:}#include

#define MAXAWPS 2 // number of awps a team can have
#define WINSPREAD 3 // the difference when it starts restricting awps for winn ...
点通粉丝 发表于 2009-5-15 22:14 http://www.dt-club.net/forum/images/common/back.gif
大哥,请问在哪改中间的文字提示呢?

这个源码好像是awplimit.sma呀
我不要awplimit,因为这个插件有双方比分差3局以上赢方就买不了AWP了,我不要这功能!

能再帮忙修改简单点不?

就是CT和T各队只能各买两把AWP,如果其它玩家还要用B45或B46买:屏幕中间就提示:不好意思,AWP已经被抢购完了


帮忙一下啦,谢谢了

心静如水 发表于 2009-5-16 21:59:13

本帖最后由 心静如水 于 2009-5-17 12:50 编辑

#define WINSPREAD 30
第四行你这样改看.....................

或用这个试几天看看........有问题就回电...........

银闪闪 发表于 2009-5-17 18:26:57

#define WINSPREAD 30
第四行你这样改看.....................

或用这个试几天看看........有问题就回电...........
心静如水 发表于 2009-5-16 21:59 http://www.dt-club.net/forum/images/common/back.gif
能给个源码吗?我想修改提示
页: [1] 2
查看完整版本: 50点通币求个AWP限制插件(不要awplimit.amxx)