|
楼主 |
发表于 2010-10-11 00:44:42
|
显示全部楼层
来自 中国–广西–贺州
还有在麻烦你 能帮我加入个权限吗??R我知道你在线的:loveliness:- /* AMX MOD Script
- * Hydralisk
- * 2005.7.16
- * For RonyDick
- * Admin Command:
- * hy_sun_wear <nick> <0/1> : 1-make someone have sunglasses, 1-make someone haven't sunglasses
- * User Command:
- * buyglasses : buy sun glasses
- * say sunglasses : buy sun glasses
- * Cvar:
- * hy_sun_cost <money> : the price of sun glasses
- * hy_sun_times <number> : set how many times can a sunglasses be used up.
- * Info:
- * Sun glasses can keep one from flashbang.
- * Sun glasses will lost if the player dead.
- */
-
- #include <amxmod>
- #include <amxmisc>
- #define ICON_HIDE 0
- #define ICON_SHOW 1
- #define ICON_FLASH 2
- #define ICON_S "suithelmet_full"
- new wear_sun[33]
- new bool:in_buyzone[33]
- public plugin_init(){
- register_plugin("Sun Glasses","0.1","Hydralisk")
- register_clcmd("buyglasses","buyglasses",ADMIN_RESERVATION,"buy sun glasses")
- register_clcmd("say sunglasses","buyglasses",ADMIN_RESERVATION,"buy sun glasses")
- register_concmd("hy_sun_wear","wearglasses",ADMIN_RESERVATION|ADMIN_LEVEL_B,"<nick> <0/1>")
- register_cvar("hy_sun_cost","800")
- register_cvar("hy_sun_times","8")
- register_event("ScreenFade","det_fade","be","1!0","2!0","7!0")
- register_event("TextMsg", "end_round", "a", "2&#Game_C", "2&#Game_w")
- register_event("DeathMsg","death","a")
- register_event("ResetHUD","reset","b")
- register_event("StatusIcon","detBuy","be","2=buyzone")
- return PLUGIN_CONTINUE
- }
- public detBuy(id){
- if (read_data(1))
- in_buyzone[id] = true
- else
- in_buyzone[id] = false
- return PLUGIN_CONTINUE
- }
- public death(){
- new id = read_data(2)
- wear_sun[id] = 0
- screen_icon(id,ICON_S,0,0,0,ICON_HIDE)
- return PLUGIN_CONTINUE
- }
- public reset(id){
- if (wear_sun[id]>1){
- new full = get_cvar_num("hy_sun_times")
- full = floatround(255.0 * float(wear_sun[id])/float(full))
- screen_icon(id,ICON_S,0,full,255-full,ICON_SHOW)
- }
- if (wear_sun[id] == 1){
- screen_icon(id,ICON_S,0,0,255,ICON_FLASH)
- }
- return PLUGIN_CONTINUE
- }
- public end_round(){
- for (new i = 1; i<=32;i++)
- wear_sun[i] = 0
- }
- public det_fade(id){
- if (wear_sun[id]){
- wear_sun[id] --
- screen_fade(id,0,0,0,0,0)
- set_hudmessage(255,0,0,-1.0,-0.45,1,6.0,10.0,1.3,0.7,9)
- show_hudmessage(id,"Your sunglasses have just keep you from a flashbang, %d times left.",wear_sun[id])
- if (wear_sun[id]>1){
- new full = get_cvar_num("hy_sun_times")
- full = floatround(255.0 * float(wear_sun[id])/float(full))
- screen_icon(id,ICON_S,255-full,full,0,ICON_SHOW)
- }
- if (wear_sun[id] == 1){
- screen_icon(id,ICON_S,0,255,0,ICON_FLASH)
- }
- if (wear_sun[id] == 0){
- screen_icon(id,ICON_S,0,0,0,ICON_HIDE)
- }
- }
- }
- public buyglasses(id){
- new cmd[33],bool:rtn
- read_argv(0,cmd,32)
- if (equal(cmd,"buyglasses"))
- rtn = true
- else
- rtn = false
- if (!is_user_alive(id)) return rtn?PLUGIN_HANDLED:PLUGIN_CONTINUE
- if (!in_buyzone[id]) return rtn?PLUGIN_HANDLED:PLUGIN_CONTINUE
- new full = get_cvar_num("hy_sun_times")
- if (wear_sun[id] >= full){
- client_print(id,print_center,"You have already got the sun glasses")
- return rtn?PLUGIN_HANDLED:PLUGIN_CONTINUE
- }
- new moneycost = get_cvar_num("hy_sun_cost")
- new pmoney = get_user_money(id)
- if (moneycost > pmoney){
- client_print(id,print_center,"You have not enough money")
- return rtn?PLUGIN_HANDLED:PLUGIN_CONTINUE
- }
- set_user_money(id,pmoney - moneycost)
- wear_sun[id] = full
- if (wear_sun[id]>1){
- full = floatround(255.0 * float(wear_sun[id])/float(full))
- screen_icon(id,ICON_S,255-full,full,0,ICON_SHOW)
- }
- if (wear_sun[id] == 1){
- screen_icon(id,ICON_S,0,255,0,ICON_FLASH)
- }
- return rtn?PLUGIN_HANDLED:PLUGIN_CONTINUE
- }
- public wearglasses(id,level,cid){
- if (!cmd_access(id,level,cid,3)) return PLUGIN_HANDLED
- new arg[33],arg2[8]
- read_argv(1,arg,32)
- read_argv(2,arg2,7)
- new player = cmd_target(id,arg,4)
- if (!player) return PLUGIN_HANDLED
- new name[33]
- get_user_name(player,name,32)
- if (equal(arg2,"1")){
- wear_sun[player] = get_cvar_num("hy_sun_times")
- if (wear_sun[player]>1){
- new full = get_cvar_num("hy_sun_times")
- full = floatround(255.0 * float(wear_sun[player])/float(full))
- screen_icon(player,ICON_S,255-full,full,0,ICON_SHOW)
- }
- if (wear_sun[player] == 1){
- screen_icon(player,ICON_S,0,255,0,ICON_FLASH)
- }
- console_print(id,"%s has been armed",name)
- } else if (equal(arg2,"0")){
- wear_sun[player] = 0
- screen_icon(player,ICON_S,0,0,0,ICON_HIDE)
- console_print(id,"%s has been disarmed",name)
- } else {
- console_print(id,"the 3rd parm must be 0 or 1")
- }
- return PLUGIN_HANDLED
- }
- public client_connect(id){
- wear_sun[id] = 0
- }
- stock screen_icon(id,icon[],r,g,b,type){
- // new string [8][32] = {"dmg_rad","item_longjump","dmg_shock","item_healthkit","dmg_heat","suit_full","cross","dmg_gas"}
- message_begin( MSG_ONE, get_user_msgid("StatusIcon"), {0,0,0}, id )
- write_byte( type ) // status
- write_string( icon ) // sprite name
- write_byte( r ) // red
- write_byte( g ) // green
- write_byte( b ) // blue
- message_end()
- }
- stock screen_fade(id,r,g,b,alpha,tm){
- message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id)
- write_short( 1<<tm ) // fade lasts this long duration
- write_short( 1<<tm ) // fade lasts this long hold time
- write_short( 1<<12 ) // fade type (in / out)
- write_byte( r ) // fade red
- write_byte( g ) // fade green
- write_byte( b ) // fade blue
- write_byte( alpha ) // fade alpha
- message_end()
- }
复制代码 |
|