设为首页收藏本站新闻投稿

MOD中国同盟社

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1578|回复: 25

[求助] 麻烦高手在帮忙加入个权限   [复制链接]

Rank: 7Rank: 7Rank: 7

帖子
649
精华
0
声望
3297 点
金币
3 Mold
被赞许
3 次
注册时间
2009-5-25
发表于 2010-10-7 14:21:31 |显示全部楼层
5金币
  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",0,"buy sun glasses")
  28.         register_clcmd("say sunglasses","buyglasses",0,"buy sun glasses")
  29.         register_concmd("hy_sun_wear","wearglasses",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.                 ****e_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.                 ****e_print(id,"%s has been disarmed",name)
  141.         } else {
  142.                 ****e_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. }
复制代码
麻烦高手在加入个权限

最佳答案

a7811311622 查看完整内容

你把「public buyglasses(id)」裡的換成再把「public wearglasses(id,level,cid)」裡的換成

使用道具 举报

Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15

帖子
406
精华
0
声望
9411 点
金币
1421 Mold
被赞许
4 次
注册时间
2009-12-18
发表于 2010-10-7 14:21:32 |显示全部楼层
还是不行,插入都编辑不了
kaijinwuye 发表于 2010-10-11 14:21

你把「public buyglasses(id)」裡的
  1. if (!is_user_alive(id)) return rtn?PLUGIN_HANDLED:PLUGIN_CONTINUE
  2. if (!in_buyzone[id]) return rtn?PLUGIN_HANDLED:PLUGIN_CONTINUE
复制代码
換成
  1. if (!is_user_alive(id)) return rtn?PLUGIN_HANDLED:PLUGIN_CONTINUE
  2. if (!in_buyzone[id]) return rtn?PLUGIN_HANDLED:PLUGIN_CONTINUE
  3. if (!(get_user_flags(id) & ADMIN_RESERVATION)) return PLUGIN_HANDLED
复制代码
再把「public wearglasses(id,level,cid)」裡的
  1. if (!player) return PLUGIN_HANDLED
复制代码
換成
  1. if (!player) return PLUGIN_HANDLED
  2. if (!(get_user_flags(id) & ADMIN_RESERVATION)) return PLUGIN_HANDLED
复制代码

使用道具 举报

Modchina声望-尊敬

战场小白

Rank: 7Rank: 7Rank: 7

帖子
1788
精华
0
声望
2505 点
金币
95 Mold
被赞许
0 次
注册时间
2009-4-12
发表于 2010-10-7 14:27:25 |显示全部楼层
这是什么 加什么权限

使用道具 举报

Rank: 7Rank: 7Rank: 7

帖子
649
精华
0
声望
3297 点
金币
3 Mold
被赞许
3 次
注册时间
2009-5-25
发表于 2010-10-7 15:11:11 |显示全部楼层
帮忙加入B权限!!!!!!!!

使用道具 举报

Rank: 3Rank: 3

帖子
418
精华
0
声望
450 点
金币
45 Mold
被赞许
0 次
注册时间
2010-7-11
发表于 2010-10-7 15:44:42 |显示全部楼层
什么插件?.........

使用道具 举报

Rank: 5Rank: 5

帖子
178
精华
0
声望
1054 点
金币
94 Mold
被赞许
0 次
注册时间
2009-2-13
发表于 2010-10-7 16:51:27 |显示全部楼层
在第35行的这句中已经提到要有B权限才能使用的
  1. register_concmd("hy_sun_wear","wearglasses",ADMIN_LEVEL_B
复制代码
水王猪皮进军modchina!!!

使用道具 举报

Rank: 7Rank: 7Rank: 7

帖子
649
精华
0
声望
3297 点
金币
3 Mold
被赞许
3 次
注册时间
2009-5-25
发表于 2010-10-7 22:28:24 |显示全部楼层
回复 5# 449095600


    不对,我测试过 Z权限玩家也可以买到!!

使用道具 举报

Rank: 3Rank: 3

帖子
0
精华
0
声望
110 点
金币
40 Mold
被赞许
3 次
注册时间
2009-6-18
发表于 2010-10-8 05:17:53 |显示全部楼层
帮你看看,别急

使用道具 举报

Rank: 7Rank: 7Rank: 7

帖子
649
精华
0
声望
3297 点
金币
3 Mold
被赞许
3 次
注册时间
2009-5-25
发表于 2010-10-8 10:18:03 |显示全部楼层
回复 7# nan575556


    谢谢!!

使用道具 举报

Rank: 3Rank: 3

帖子
0
精华
0
声望
110 点
金币
40 Mold
被赞许
3 次
注册时间
2009-6-18
发表于 2010-10-9 01:41:21 |显示全部楼层
回复 8# kaijinwuye


    给我说一下你的邮箱
给你发邮箱

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

回顶部