搜索
查看: 1724|回复: 5

kinsprite 请进来帮个忙谢谢

[复制链接]
发表于 2006-12-2 16:50:52 | 显示全部楼层 |阅读模式 来自 中国–重庆–重庆–永川区
能否帮小弟修改下这个插件。效果很简单。 也就是只能拥有B权限的人才能使用命令
我知道关键在这两句话,但是小弟很菜不懂怎么修改
register_clcmd("buyglasses","buyglasses",0,"buy sun glasses")
register_clcmd("say sunglasses","buyglasses",0,"buy sun glasses")

下面是完整代码


#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",0,"buy sun glasses")
register_clcmd("say sunglasses","buyglasses",0,"buy sun glasses")
register_concmd("hy_sun_wear","wearglasses",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 = 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()
}
发表于 2006-12-2 16:58:54 | 显示全部楼层 来自 中国–北京–北京–海淀区

回复: kinsprite 请进来帮个忙谢谢

register_clcmd("buyglasses","buyglasses",ADMIN_LEVEL_B,"buy sun glasses")
register_clcmd("say sunglasses","buyglasses",ADMIN_LEVEL_B,"buy sun glasses")

public buyglasses(id){
改成
public buyglasses(id,level,cid){
if (!cmd_access(id,level,cid,1))
   return PLUGIN_HANDLED
回复

使用道具 举报

发表于 2006-12-2 16:59:06 | 显示全部楼层 来自 中国–北京–北京

回复: kinsprite 请进来帮个忙谢谢

[php]register_clcmd("buyglasses", "buyglasses", ADMIN_LEVEL_B, "buy sun glasses")
register_clcmd("say sunglasses", "buyglasses", ADMIN_LEVEL_B, "buy sun glasses")[/php]
回复

使用道具 举报

 楼主| 发表于 2006-12-2 17:27:02 | 显示全部楼层 来自 中国–重庆–重庆–永川区

回复: kinsprite 请进来帮个忙谢谢

编译的时候有错。。。。。。。。。。。。。。。。。
回复

使用道具 举报

发表于 2006-12-2 18:10:49 | 显示全部楼层 来自 中国–北京–北京–海淀区

回复: kinsprite 请进来帮个忙谢谢

如果你用amxx编译,要用这个:#include <amxmodx>
回复

使用道具 举报

 楼主| 发表于 2006-12-2 18:23:18 | 显示全部楼层 来自 中国–重庆–重庆–永川区

回复: kinsprite 请进来帮个忙谢谢

没改这个还好
改了这个更多错误了
不信你试下
回复

使用道具 举报

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

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