jiajiazf 发表于 2009-4-7 03:42:10

谢谢大家的支持。。
呵呵。。。难得R版光临,谢谢。。
是呀你也可以改成say /0 呀。。有源码,你想怎样改都可以。

landyhsu 发表于 2009-4-7 15:34:58

转贴...........
/*
*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
new Re_Player_Name
new MSG_1,MSG_2,MSG_3
new choices
new target
new players
new page = { 1, ...}
new bool:counted
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
        get_user_ip(id,ip,21)

        for(new i = 1; i < MAX_PLAYERS; i++) {
                if (equal(ip, pID, 21)) {

                        new name
                        get_user_name(id, name, 33)

                        if (get_cvar_num("amx_retryshow")) {
                                new uID
                                uID = id
                                set_task(2.0,"showMsg", id, uID, 1)
                        }

                        if (get_cvar_num("amx_retrychat")) {
                                new txt
                                get_cvar_string("amx_retrychatmsg", txt, 127)
                                new sec
                                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, " %s", txt)
                        }

                        if (get_cvar_num("amx_retrykick")) {
                                new uID
                                uID = 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
        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) {
                                get_user_ip(id, pID, 21)
                                new aID
                                aID = 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,"输入 /reme 或 /replace 刷新自己的得分.")
   return PLUGIN_CONTINUE
}

public replace_say(id) {//说话检查
new said
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
new len
len = format(MenuBody,255,"您是否想更新自己的得分?^n\r(金钱也将刷新)")
len += format(MenuBody,150 - len,"^n\w 1. 是!")
len += format(MenuBody,150 - len,"^n\w 2. 否!")
len += format(MenuBody,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 = ""
    }

    new menu
    format(menu,255," 想刷新谁的得分 ?( 第 %d 页 ):^n^n",page)

    get_players(players,num)
    new onepageplayer = num-((page-1)*8)
    if(num-((page-1)*8) > 8)
    onepageplayer = 8

    new offset = (page * 8) - 8

    for(new i=offset;i<onepageplayer+offset;i++)
    {
    new username
          get_user_name(players,username,32)
    new string
                format(string,255,"\w%d. %s ^n",i+1-offset,username)
                new id_str
                num_to_str(players,id_str,32)
                choices = id_str
          add(menu,255,string)
    }
    if(num-((page-1)*8) > 8)
    {
              choices = "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 == 1)
    {
       page=1
       return 1
    }
    else if(key == 9 && page > 1)
    {
      page -=1
      show_replayers(id)
      return 1
    }

    if(equal(choices,""))
    {
      show_replayers(id)
      return 1
    }

    if(key < 8)
    {
      page=1
      target = choices
      showmenu(id,target)
      return 1
    }

    if(key == 8 && equal(choices,"Next"))
    {
      page += 1
      show_replayers(id)
      return 1
    }

    return 1
}

public showmenu(id,target)
{
    get_players(players,num)
    for(new i=0;i<num;i++)
    {
            counted[ players ]=false
    }
    new targetname
    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,"你的得分已被管理员强制刷新.")
    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,"你取消了更新得分,你的得分不会更改.")
    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,"你的得分已刷新.")
        format(MSG_2, 111, "^x04你的得分已刷新.")
        print_message(id, MSG_2)
        client_print(0,print_chat,"玩家 %s 得分已更新.",Re_Player_Name)
        return PLUGIN_HANDLED
}

public cleanID(i[]) {
        pID] = 0
}

public showMsg(pID[]) {
        new txt
        get_cvar_string("amx_retrymsg", txt, 127)

        new playername
        get_user_name(pID, playername, 33)

        new sec
        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,txt)
}

public kick(id[]) {
        new txt
        get_cvar_string("amx_retrykickmsg", txt, 127)
        server_cmd("kick #%d ^"%s^"", id, txt)
}

print_message(id ,msg[]){
        message_begin(MSG_ONE, gmsgSayText,{0,0,0},id)
        write_byte(id)
        write_string(msg)
        message_end()
}

MaxWunsche 发表于 2009-4-14 09:13:02

好东西,虽然不下,强烈顶一下。

haijunxuluwei 发表于 2009-4-18 13:14:28

还有比这更简单的

大江 发表于 2009-4-18 15:40:10

z支持...

benladeng 发表于 2009-4-21 15:29:22

这个还有点作用哦

kaspersky 发表于 2009-5-3 05:25:45

什么样子的 截图上来

blue_eleven 发表于 2009-5-11 04:42:08

retry本来就不是什么好习惯,搂住费那么多心思在这些东西上面,佩服,顺便说一句,东西挺好,但是不实用

此人已失踪 发表于 2012-8-7 20:44:07

sbsbsbsb你是个大傻B
页: 1 [2]
查看完整版本: 不用retry重刷分数.