|
发表于 2008-3-8 02:03:39
|
显示全部楼层
来自 中国–广东–深圳
回复: 请求修改showop.sma 请各位达人帮忙
[PHP]/*
* AMX X Mod script.
*
* (c) Copyright 2004, caihanzi(3826)
*
* History:
* v0.1 显示及提示OP登陆,在线
* v0.2 添加玩家举报菜单(模仿Enigmaya的cheating_punish.sma制作)
* v0.3 增加固定请求OP换地图菜单,增加VIP登陆和再线提示
* v0.4 加入内网免疫,与更多设置命令
*/
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define MAXPLAYERS 32
#define MENU_PLAYERS 8
#define MENUTIME 15
#define KEY1 (1<<0)
#define KEY2 (1<<1)
#define KEY3 (1<<2)
#define KEY4 (1<<3)
#define KEY5 (1<<4)
#define KEY6 (1<<5)
#define KEY7 (1<<6)
#define KEY8 (1<<7)
#define KEY9 (1<<8)
#define KEY0 (1<<9)
new op_name[32]
new vip_name[32]
new g_Player[MAXPLAYERS+1]
new g_Pig[MAXPLAYERS+1]
new players[32], num
new cheat[33][33]
new choices[33][9][33]
new page[33] = { 1, ...}
new bool:counted[33]
public plugin_init()
{
register_plugin("show OP","0.3", "caihanzi")
register_clcmd("say /op", "showopmenu")
register_menucmd(register_menuid("\y您有什么问题询问OP:"),1023,"MenuShowOp")
register_menucmd(register_menuid("who?"), KEY1|KEY2|KEY3|KEY4|KEY5|KEY6|KEY7|KEY8|KEY9|KEY0, "choosewho")
register_menucmd(register_menuid("想请OP换哪一幅地图?"), KEY1|KEY2|KEY3|KEY4|KEY5|KEY6|KEY7|KEY8|KEY9|KEY0, "whichmap")
}
public client_putinserver(id)
{
if(is_user_connected(id) && !is_user_bot(id) && !is_user_hltv(id))
set_task(10.0,"Check_op",id,_,_,"a",1)
}
public Check_op(id)
{
g_Pig[id] = 0
g_Player[id] = 1
//client_print(id,print_chat,"[妖精提示] 按Y键输入/op联系在线OP !")
set_task(01.0,"show_op",id,_,_,"a",1)
}
public client_dis(id)
{
g_Player[id] = 0
remove_task(id)
}
public show_op(id)
{
if ((get_user_flags(id) & ADMIN_IMMUNITY)) {
get_user_info(id,"name",op_name,31)
client_print(0,print_chat,"[妖精提示]管理员 %s 登陆啦... ",op_name)
set_hudmessage ( 30, 144, 255, 0.2, 0.90, 2, 0.02, 6.0, 0.01, 0.2, 2 )
show_hudmessage (0," 管理员 %s 登陆啦... ",op_name)
}
else if((get_user_flags(id) & ADMIN_RESERVATION) && !(get_user_flags(id) & ADMIN_IMMUNITY)){//VIP提示
get_user_info(id,"name",vip_name,31)
client_print(0,print_chat,"[妖精提示]会员 %s 登陆啦... ",vip_name)
set_hudmessage ( 255, 0, 0, 0.2, 0.90, 2, 0.02, 6.0, 0.01, 0.2, 2 )
show_hudmessage ( 0, " 会员 %s 登陆啦... ",vip_name)
}
set_task(7.0,"on_op",id,_,_,"b",1)
return PLUGIN_HANDLED
}
public on_op(id)
{
if ((get_user_flags(id) & ADMIN_IMMUNITY)) {
get_user_info(id,"name",op_name,31)
//client_print(0,print_chat,"[妖精提示] OP %s 在线.有什么问题请询问OP ",op_name)
set_hudmessage ( 30, 144, 255, 0.05, 0.90, 2, 0.02, 8.0, 0.01, 0.2, 3 )
show_hudmessage (0, " 【管理员】 %s 在线.有什么问题请询问OP ",op_name)
}
else if((get_user_flags(id) & ADMIN_RESERVATION) && !(get_user_flags(id) & ADMIN_IMMUNITY)){//VIP提示
get_user_info(id,"name",vip_name,31)
//client_print(0,print_chat,"[妖精提示] VIP %s 在线 ",vip_name)
set_hudmessage ( 255, 0, 0, 0.05, 0.90, 2, 0.02, 8.0, 0.01, 0.2, 3 )
show_hudmessage (0, " VIP %s 在线 ",vip_name)
}
return PLUGIN_CONTINUE
}
public showopmenu(id,key)
{
new MenuBody[151]
new len,keys
len = format(MenuBody,255,"\y您有什么问题询问OP:")
len += format(MenuBody[len],150 - len,"^n\w 1. 报告OP %s 有人作弊",op_name)
len += format(MenuBody[len],150 - len,"^n\w 2. 请求OP %s 换地图",op_name)
len += format(MenuBody[len],150 - len,"^n\w 0. 退出")
keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)
show_menu( id, keys, MenuBody, -1 )
return PLUGIN_CONTINUE
}
public MenuShowOp(id,key)
{
if(key == 0)
{
new Name[32]
get_user_name(id,Name,31)
set_task(1.0,"showplayers",id)
//client_print(0,print_chat,"[妖精提示] %s 举报有人作弊",Name)
}
else if(key == 1)
{
new Name[32]
get_user_name(id,Name,31)
client_print(0,print_chat,"[妖精提示] %s 请求换地图",Name)
set_task(1.0,"showMapMenu",id)
}
else if(key == 9)
return PLUGIN_CONTINUE
}
public showplayers(id)
{
for(new i=0;i<9;i++)
{
choices[id] = ""
}
new menu[256]
format(menu,255," 举报谁在作弊 ? ( 第 %d 页 ):^n \r请不要恶意举报! ^n^n",page[id])
get_players(players,num)
new onepageplayer = num-((page[id]-1)*8)
if(num-((page[id]-1)*8) > 8)
onepageplayer = 8
new offset = (page[id] * 8) - 8
for(new i=offset;i<onepageplayer+offset;i++)
{
new username[33]
get_user_name(players,username,32)
new string[256]
if((get_user_flags(players) & ADMIN_IMMUNITY ))
{
format(string,255,"\d%d. %s (管理员) ^n",i+1-offset,username)
}
else if((get_user_flags(players) & ADMIN_RESERVATION) && !(get_user_flags(players) & ADMIN_IMMUNITY))
{
format(string,255,"\d%d. %s (会员) ^n",i+1-offset,username)
}
else
{
format(string,255,"\w%d. %s ^n",i+1-offset,username)
new id_str[33]
num_to_str(players,id_str,32)
choices[id][i-offset] = id_str
}
add(menu,255,string)
}
if(num-((page[id]-1)*8) > 8)
{
choices[id][8] = "Next"
add(menu,255,"\w^n9. 下一页")
}
add(menu,255,"\w^n0. 返回")
show_menu(id,KEY1|KEY2|KEY3|KEY4|KEY5|KEY6|KEY7|KEY8|KEY9|KEY0,menu,MENUTIME,"who?")
return PLUGIN_CONTINUE
}
public choosewho(id,key)
{
if(key == 9 && page[id] == 1)
{
page[id]=1
return 1
}
else if(key == 9 && page[id] > 1)
{
page[id] -=1
showplayers(id)
return 1
}
if(equal(choices[id][key],""))
{
showplayers(id)
return 1
}
if(key < 8)
{
page[id]=1
cheat[id] = choices[id][key]
showmenu(id,cheat[id])
return 1
}
if(key == 8 && equal(choices[id][key],"Next"))
{
page[id] += 1
showplayers(id)
return 1
}
return 1
}
public showmenu(id,cheat[33])
{
get_players(players,num)
for(new i=0;i<num;i++)
{
counted[ players ]=false
}
new choosename[32],cheatname[32]
get_user_name(id,choosename,32)
new tid=str_to_num(cheat)
get_user_name(tid,cheatname,32)
if ((get_user_flags(id) & ADMIN_IMMUNITY) || (get_user_flags(id) & ADMIN_KICK)) {
client_print(id,print_chat,"[妖精提示] %s 报告 %s 作弊",choosename,cheatname)
//set_hudmessage ( 255, 0, 0, 0.2, 0.2, 2, 0.4, 14.0, 0.2, 0.2, 5)
//show_hudmessage (id, "%s 报告 %s 作弊",choosename,cheatname)
}
return PLUGIN_HANDLED
}
public showMapMenu(id,key)
{
new mapmenu[256]
format(mapmenu, 255, "想请OP换哪一幅地图?^n^n1. dod_anzio^n2. dod_donner^n3. dod_harrington ^n4. dod_saint^n5. dod_chemille^n6. dod_railroad2_b2")
show_menu(id, KEY1|KEY2|KEY3|KEY4|KEY5|KEY6|KEY7|KEY8|KEY9|KEY0, mapmenu,MENUTIME,"想请OP换哪一幅地图?")
return PLUGIN_HANDLED
}
public whichmap(id,key)
{
new Name[32]
get_user_name(id,Name,31)
switch (id,key)
{
case 0: client_print(0,print_chat,"[妖精提示] %s 请求换地图为dod_anzio",Name)
case 1: client_print(0,print_chat,"[妖精提示] %s 请求换地图为dod_donner",Name)
case 2: client_print(0,print_chat,"[妖精提示] %s 请求换地图为dod_harrington",Name)
case 3: client_print(0,print_chat,"[妖精提示] %s 请求换地图为dod_saint",Name)
case 4: client_print(0,print_chat,"[妖精提示] %s 请求换地图为dod_chemille",Name)
case 5: client_print(0,print_chat,"[妖精提示] %s 请求换地图为dod_railroad2_b2",Name)
}
return PLUGIN_CONTINUE
} [/PHP]
简单的改了下
未测试
编译通过 |
|