|
发表于 2009-10-16 12:51:00
|
显示全部楼层
来自 中国–上海–上海–徐汇区
这个插件点通早有了,搜索一下.....
/*
* AMX X Mod script.
*
* (c) Copyright 2006, caihanzi(3826)
*
* Note:
* ^x04 绿色
* ^x03 红色
*/
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#define PLUGIN "replace_player_Score+no_retry"
#define VERSION "1.1+"
#define AUTHOR "caihanzi&Priski"
#define MAX_PLAYERS 32
new pID[MAX_PLAYERS][22]
new Re_Player_Name[33]
new MSG_1[256],MSG_2[256],MSG_3[256]
new choices[33][9][33]
new target[33][33]
new players[32]
new page[33] = { 1, ...}
new bool:counted[33]
new keys,gmsgSayText,num
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say", "replace_say")
register_concmd("amx_remenu", "readminlist",ADMIN_IMMUNITY,"admin re menu")
register_cvar("amx_retrytime","60")
register_cvar("amx_retrykick","1")
register_cvar("amx_retryshow","1")
register_cvar("amx_retrychat","1")
register_cvar("amx_remoney","800")
register_cvar("amx_retrymsg","这里不允许重复登陆, %s")
register_cvar("amx_retrykickmsg","不允许很快地重复连接")
register_cvar("amx_retrychatmsg","%s 被服务器拒绝:因为他在 %t 秒内重复连接")
register_menucmd(register_menuid("您是否想更新自己的得分?^n\r(金钱也将刷新)"),1023,"MenuReplaceBody")
register_menucmd(register_menuid("who?"),(1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9), "choosewho_re")
gmsgSayText = get_user_msgid("SayText")
set_task(30.0,"Replace_Say",888,"",0,"b")
return PLUGIN_CONTINUE
}
public client_putinserver(id) {
if ((is_user_bot(id)) || (get_user_flags(id)&ADMIN_IMMUNITY)) {
return PLUGIN_HANDLED
}
new ip[22]
get_user_ip(id,ip,21)
for(new i = 1; i < MAX_PLAYERS; i++) {
if (equal(ip, pID, 21)) {
new name[34]
get_user_name(id, name, 33)
if (get_cvar_num("amx_retryshow")) {
new uID[1]
uID[0] = id
set_task(2.0,"showMsg", id, uID, 1)
}
if (get_cvar_num("amx_retrychat")) {
new txt[128]
get_cvar_string("amx_retrychatmsg", txt, 127)
new sec[6]
num_to_str(get_cvar_num("amx_retrytime"),sec, 5)
replace(txt, 127, "%s", name)
replace(txt, 127, "%t", sec)
client_print( 0, print_chat, "[AMXX] %s", txt)
}
if (get_cvar_num("amx_retrykick")) {
new uID[1]
uID[0] = get_user_userid(id)
set_task(7.0,"kick",77,uID,1)
}
break
}
}
return PLUGIN_HANDLED;
}
public client_disconnect(id) {
if ((is_user_bot(id)) || (get_user_flags(id)&ADMIN_IMMUNITY)) {
return PLUGIN_HANDLED; }
new ip[22]
get_user_ip(id,ip,21)
new found = 0;
for(new i = 1; i < MAX_PLAYERS; i++) {
if (equal(ip, pID, 21)) {
found = 1
break
}
}
if (found == 0) {
for(new i = 1; i < MAX_PLAYERS; i++) {
if (pID[0] == 0) {
get_user_ip(id, pID, 21)
new aID[1]
aID[0] = i
set_task( get_cvar_float("amx_retrytime"), "cleanID", (id + MAX_PLAYERS),aID,1)
break
}
}
}
return PLUGIN_HANDLED;
}
public Replace_Say()
{
client_print(0,print_chat,"[REPL]输入 /reme 或 /replace 刷新自己的得分.")
return PLUGIN_CONTINUE
}
public replace_say(id) {//说话检查
new said[192]
read_args(said,192)
if( ( containi(said, "/replace") != -1 || containi(said, "replace") != -1 || containi(said, "/reme") != -1) || contain(said, "reme") != -1 )
set_task(0.1,"MenuReplace",id)
return PLUGIN_CONTINUE
}
public MenuReplace(id,key)
{
new MenuBody[151]
new len
len = format(MenuBody,255,"您是否想更新自己的得分?^n\r(金钱也将刷新)")
len += format(MenuBody[len],150 - len,"^n\w 1. 是!")
len += format(MenuBody[len],150 - len,"^n\w 2. 否!")
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 show_replayers(id)
{
for(new i=0;i<9;i++)
{
choices[id] = ""
}
new menu[256]
format(menu,255," 想刷新谁的得分 ? ( 第 %d 页 ):^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]
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. 返回")
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,menu,60,"who?")
return PLUGIN_CONTINUE
}
public choosewho_re(id,key)
{
if(key == 9 && page[id] == 1)
{
page[id]=1
return 1
}
else if(key == 9 && page[id] > 1)
{
page[id] -=1
show_replayers(id)
return 1
}
if(equal(choices[id][key],""))
{
show_replayers(id)
return 1
}
if(key < 8)
{
page[id]=1
target[id] = choices[id][key]
showmenu(id,target[id])
return 1
}
if(key == 8 && equal(choices[id][key],"Next"))
{
page[id] += 1
show_replayers(id)
return 1
}
return 1
}
public showmenu(id,target[33])
{
get_players(players,num)
for(new i=0;i<num;i++)
{
counted[ players ]=false
}
new targetname[32]
new tid=str_to_num(target)
get_user_name(tid,targetname,32)
set_user_frags(tid,0)
cs_set_user_deaths(tid,0)
cs_set_user_money(tid,get_cvar_num("amx_remoney"),1)
//client_print(tid,print_chat,"[REPL]你的得分已被管理员强制刷新.")
format(MSG_3, 111, "^x04你的得分已被管理员强制刷新.")
print_message(tid, MSG_3)
return PLUGIN_CONTINUE
}
public readminlist(id,level,cid)
{
if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED;
show_replayers(id)
return PLUGIN_CONTINUE
}
public MenuReplaceBody(id,key)
{
if(key == 0)
{
get_user_name(id,Re_Player_Name,32)
set_task(0.1,"RePlace",id)
}
else if(key == 1)
{
get_user_name(id,Re_Player_Name,32)
//client_print(id,print_chat,"[REPL]你取消了更新得分,你的得分不会更改.")
format(MSG_1, 111, "^x04你取消了更新得分,你的得分不会更改.")
print_message(id, MSG_1)
}
return PLUGIN_CONTINUE
}
public RePlace(id)
{
set_user_frags(id,0)
cs_set_user_deaths(id,0)
cs_set_user_money(id,get_cvar_num("amx_remoney"),1)
get_user_name(id,Re_Player_Name,32)
//client_print(id,print_chat,"[REPL]你的得分已刷新.")
format(MSG_2, 111, "^x04你的得分已刷新.")
print_message(id, MSG_2)
client_print(0,print_chat,"[REPL]玩家 %s 得分已更新.",Re_Player_Name)
return PLUGIN_HANDLED
}
public cleanID(i[]) {
pID[i[0]][0] = 0
}
public showMsg(pID[]) {
new txt[128]
get_cvar_string("amx_retrymsg", txt, 127)
new playername[34]
get_user_name(pID[0], playername, 33)
new sec[6]
num_to_str(get_cvar_num("amx_retrytime"),sec, 5)
replace(txt, 127, "%s", playername)
replace(txt, 127, "%t", sec)
set_hudmessage(255, 255, 255, 0.05, 0.72, 0, 5.0, 10.0, 2.0, 0.15, 3)
show_hudmessage(pID[0],txt)
}
public kick(id[]) {
new txt[128]
get_cvar_string("amx_retrykickmsg", txt, 127)
server_cmd("kick #%d ^"%s^"", id[0], txt)
}
print_message(id ,msg[]){
message_begin(MSG_ONE, gmsgSayText,{0,0,0},id)
write_byte(id)
write_string(msg)
message_end()
} |
|