搜索
查看: 22585|回复: 66

高手帮我把这个插件加个权限

[复制链接]
发表于 2010-2-27 12:49:55 | 显示全部楼层 |阅读模式 来自 黑龙江齐齐哈尔
可以买3颗手雷的插件
加上只有p - custom level D权限才能购买
  1. /*
  2.         Plugin author { DT.Sakulekingz \ KIN \ KzFun.wUgu1 \ k1nader }
  3.                      __....__                                                        1. DT.Sakulekingz is KIN,
  4.                 .-~~/  \__/  \~~-.                                                2. KIN is KzFun.wUgu1,
  5.                /_/``\__/  \__/``\_\.--.                                        3. KzFun.wUgu1 is k1nader,
  6.               /  \__/  \__/  \__/  \   o`.                                4. k1nader is DT.Sakulekingz,
  7.           `==/\__/__\__/__\__/__\__/\`'--'                                5. so..DT.Sakulekingz = KIN = KzFun.wUgu1 = k1nader
  8.              ~/__/__/^^^^^^^^\__\__\~                                        6. DT.Sakuleking, KIN, KzFun.wUgu1, k1nader (the 4 names is me).

  9. */
  10.        
  11.         #include <amxmodx>
  12.         #include <cstrike>
  13.         #include <fun>
  14.        
  15.         #define PLUGIN        "buy 3 hegrenade"
  16.         #define VERSION        "1.0"
  17.         #define AUTHOR        "k1nader"
  18.        
  19.         new g_hegrenademoney;
  20.         new bool:buyswitch;
  21.        
  22.         public plugin_init()
  23.         {
  24.                 register_plugin(PLUGIN, VERSION, AUTHOR);
  25.                 register_menucmd(register_menuid("BuyItem", 1), 511, "menuItem");
  26.                 register_event("HLTV", "roundstart", "a", "1=0", "2=0");
  27.                 g_hegrenademoney = register_cvar("amx_buygrenade", "300");
  28.         }
  29.        
  30.         public client_command(id)
  31.         {
  32.                 new arg[13];
  33.                 if(read_argv(0, arg, 12) > 11) return PLUGIN_CONTINUE;
  34.                
  35.                 if(equali(arg, "hegren"))
  36.                 {
  37.                         if(!cs_get_user_buyzone(id)) return PLUGIN_HANDLED;
  38.                         if(!buyswitch)
  39.                         {
  40.                                 client_print(id, print_center, "%d 秒已经过去了,你不能再买任何东西了。",floatround(get_cvar_float("mp_buytime")*60,floatround_round));
  41.                                 return PLUGIN_HANDLED;
  42.                         }
  43.                         new g_money = cs_get_user_money(id);
  44.                         if(g_money < get_pcvar_num(g_hegrenademoney))
  45.                         {
  46.                                 client_print(id, print_center, "你没有足够的资金!");
  47.                                 return PLUGIN_HANDLED;
  48.                         }
  49.                         new g_currentHE = cs_get_user_bpammo(id, CSW_HEGRENADE);
  50.                         if(g_currentHE == 0)
  51.                         {
  52.                                 give_item(id, "weapon_hegrenade");
  53.                                 cs_set_user_money(id, g_money - get_pcvar_num(g_hegrenademoney));
  54.                         }
  55.                         else
  56.                         {
  57.                                 if(g_currentHE <= 2)
  58.                                 {
  59.                                         cs_set_user_money(id, g_money - get_pcvar_num(g_hegrenademoney));
  60.                                         cs_set_user_bpammo(id, CSW_HEGRENADE, g_currentHE+1);
  61.                                 }
  62.                                 else
  63.                                         client_print(id, print_center, "你不能再携带任何东西了。");
  64.                         }
  65.                         return PLUGIN_HANDLED;
  66.                 }
  67.                 return PLUGIN_CONTINUE;
  68.         }
  69.        
  70.         public menuItem(id, key)
  71.         {
  72.                 if(key == 3)
  73.                 {
  74.                         if(!cs_get_user_buyzone(id)) return PLUGIN_HANDLED;
  75.                         if(!buyswitch)
  76.                         {
  77.                                 client_print(id, print_center, "%d 秒已经过去了,你不能再买任何东西了。",floatround(get_cvar_float("mp_buytime")*60,floatround_round));
  78.                                 return PLUGIN_HANDLED;
  79.                         }
  80.                         new g_money = cs_get_user_money(id);
  81.                         if(g_money < get_pcvar_num(g_hegrenademoney))
  82.                         {
  83.                                 client_print(id, print_center, "你没有足够的资金!");
  84.                                 return PLUGIN_HANDLED;
  85.                         }
  86.                         new g_currentHE = cs_get_user_bpammo(id, CSW_HEGRENADE);
  87.                         if(g_currentHE == 0)
  88.                         {
  89.                                 cs_set_user_money(id, g_money - get_pcvar_num(g_hegrenademoney));
  90.                                 give_item(id, "weapon_hegrenade");
  91.                         }
  92.                         else
  93.                         {
  94.                                 if(g_currentHE <= 2)
  95.                                 {
  96.                                         cs_set_user_money(id, g_money - get_pcvar_num(g_hegrenademoney));
  97.                                         cs_set_user_bpammo(id, CSW_HEGRENADE, g_currentHE+1);
  98.                                 }
  99.                                 else
  100.                                         client_print(id, print_center, "你不能再携带任何东西了。");
  101.                         }
  102.                         return PLUGIN_HANDLED;
  103.                 }
  104.                 return PLUGIN_CONTINUE;
  105.         }
  106.        
  107.         public roundstart()
  108.         {
  109.                 new Float:buytime = get_cvar_float("mp_buytime") * 60;
  110.                 buyswitch = true;
  111.                 set_task(buytime, "canntbuy");
  112.         }
  113.        
  114.         public canntbuy()
  115.                 buyswitch = false;
复制代码
发表于 2010-3-19 15:58:01 | 显示全部楼层 来自 江西萍乡
不错 这个插件好
回复 0 1

使用道具 举报

发表于 2010-3-1 10:50:18 | 显示全部楼层 来自 河南洛阳
帮你、顶下帖子   那个积分
回复

使用道具 举报

 楼主| 发表于 2010-3-4 14:30:29 | 显示全部楼层 来自 黑龙江哈尔滨
ding !!!!!!!!!
回复

使用道具 举报

发表于 2010-3-5 07:58:03 | 显示全部楼层 来自 四川
本帖最后由 sakulekingz 于 2010-3-5 08:00 编辑

  1. /*
  2. --------------------------------------------------------------------------------
  3. Web URL:  http://Lunatic.org.cn//
  4. E-M@IL: mailto:k1nmaill@sina.com
  5. --------------------------------------------------------------------------------
  6. */

  7. #include <amxmodx>
  8. #include <amxmisc>
  9. #include <cstrike>
  10. #include <fun>

  11. #define PLUGIN        "buy 3 hegrenades"
  12. #define VERSION        "2.0"
  13. #define AUTHOR        "k1nader"
  14. #define LOADING        "^n^t%s v%s, Copyright (C) 2010 by %s^n"

  15. new g_hegrenademoney, g_grenade_access;
  16. new Float:g_gameTime;

  17. public plugin_init()
  18. {
  19.         register_plugin(PLUGIN, VERSION, AUTHOR);
  20.         server_print(LOADING,PLUGIN,VERSION,AUTHOR);
  21.         register_menucmd(register_menuid("BuyItem", 1), 511, "menuItem");
  22.         register_event("HLTV", "roundstart", "a", "1=0", "2=0");
  23.         g_hegrenademoney = register_cvar("amx_buygrenade", "300");
  24.         g_grenade_access = register_cvar("amx_grenade_access", "p");
  25. }

  26. public client_command(id)
  27. {
  28.         new arg[13];
  29.         if(read_argv(0, arg, 12) > 11) return PLUGIN_CONTINUE;
  30.        
  31.         if(equali(arg, "hegren"))
  32.                 set_user_hegrenade(id);
  33.         return PLUGIN_CONTINUE;
  34. }

  35. public menuItem(id, key)
  36. {
  37.         if(key == 3)
  38.                 set_user_hegrenade(id);
  39.         return PLUGIN_CONTINUE;
  40. }

  41. public roundstart()
  42.         g_gameTime = get_gametime();

  43. stock set_user_hegrenade(id)
  44. {
  45.         new Float:buytime = get_cvar_float("mp_buytime") * 60.0;
  46.         new Float:timepassed = get_gametime() - g_gameTime;
  47.        
  48.         if(!cs_get_user_buyzone(id)) return PLUGIN_HANDLED;
  49.        
  50.         if(floatcmp(timepassed , buytime) == 1)
  51.         {
  52.                 client_print(id, print_center, "%d秒已经过去了。你不能再买任何东西了。",floatround(get_cvar_float("mp_buytime")*60,floatround_round));
  53.                 return PLUGIN_HANDLED;
  54.         }
  55.        
  56.         new g_money = cs_get_user_money(id);
  57.        
  58.         if(g_money < get_pcvar_num(g_hegrenademoney))
  59.         {
  60.                 client_print(id, print_center, "你没有足够的资金!");
  61.                 return PLUGIN_HANDLED;
  62.         }
  63.         new g_currentHE = cs_get_user_bpammo(id, CSW_HEGRENADE);
  64.         if(g_currentHE == 0)
  65.         {
  66.                 give_item(id, "weapon_hegrenade");
  67.                 cs_set_user_money(id, g_money - get_pcvar_num(g_hegrenademoney));
  68.         }
  69.         else
  70.         {
  71.                 new iAccess[32];
  72.                 get_pcvar_string(g_grenade_access, iAccess, 31);
  73.                 if(get_user_flags(id) & read_flags(iAccess) == 0)
  74.                 {
  75.                         client_print(id, print_center, "你没有手雷卡,无法购买多颗手雷。");
  76.                         return PLUGIN_HANDLED;
  77.                 }
  78.                
  79.                 if(g_currentHE <= 2)
  80.                 {
  81.                         cs_set_user_bpammo(id, CSW_HEGRENADE, 0);
  82.                         give_item (id, "weapon_hegrenade");
  83.                         cs_set_user_bpammo(id, CSW_HEGRENADE, g_currentHE + 1);
  84.                         cs_set_user_money(id, g_money - get_pcvar_num(g_hegrenademoney));
  85.                 }
  86.                 else
  87.                         client_print(id, print_center, "你不能再携带任何东西了。");
  88.         }
  89.         return PLUGIN_HANDLED;
  90. }
复制代码


amx_buygrenade <需要多少金钱购买:默认 300>
amx_grenade_access <需要购买的权限:默认 p>

本帖子中包含更多资源

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

×
回复

使用道具 举报

发表于 2010-3-19 16:43:04 | 显示全部楼层 来自 广东中山
看看什么插件
回复

使用道具 举报

发表于 2010-3-22 09:37:56 | 显示全部楼层 来自 广东佛山
如果是DOD游戏的插件,我可以帮你加,但CS,我不玩。
回复

使用道具 举报

发表于 2010-6-7 00:10:19 | 显示全部楼层 来自 山东淄博
4# sakulekingz


看看龟仙人的东西
回复

使用道具 举报

发表于 2010-6-24 09:40:37 | 显示全部楼层 来自 新疆乌鲁木齐
看  要技术 还是龟仙人。
回复

使用道具 举报

发表于 2010-6-24 11:39:12 | 显示全部楼层 来自 安徽合肥
LOOK 1 LOOK ````````````
回复

使用道具 举报

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

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