life-rest 发表于 2005-6-24 17:53:32

【灌水】Hydralisk 的服务器开局用小刀插件AMXX1.0 版

呵呵,用了Hydralisk改编的那个插件,发现服务器开始三局都是用刀,觉得不太好
后来在他的插件里改了个参数,重新编译后恢复到每次服务器刷新或是换图后只是第一局用刀
本来昨天就打算发上来的,但是我的IP在执行过搜索后给OVER了
刚刚通过代理能上点通了就发了出来,是用AMXX1。0的编译器编的,在别的版本下没试过,在AMXX1.0下测试正常。 :d:

下面是改过后的源代码,也只是将register_cvar("amx_kniferound","2") 里面的2改成了1


/* AMX Mod script.
*
* Knife Arena
*
* amx_knives 1 - restricts weapons to knives
*                                        0 - enables all weapons
*
* NOTE: Plugin adminvote from AMX 0.9.x required!!!
*/

#include <amxmod>
#include <amxmisc>

new bool:KnifeEnabled
new option
new round

public amx_enableknife(id,level,cid) {
        if (!cmd_access(id,level,cid,1))
                return PLUGIN_HANDLED

        new arg1
        read_argv(1,arg1,3)
       
        if (equal(arg1,"1")||equali(arg1,"on")){
                KnifeEnabled = true
                unpause("b","switchweapon")
        }
        else if (equal(arg1,"0")||equali(arg1,"off")){
                KnifeEnabled = false
                pause("b","switchweapon")
        }
        else {
                console_print(id,"Knives Only Mode is %s",KnifeEnabled ? "enabled" : "disabled")
                return PLUGIN_HANDLED
        }

        console_print(id,"Knives Only Mode %s",KnifeEnabled ? "enabled" : "disabled")
        client_print(0,print_center,"Knives Only Mode Has Been %s!",KnifeEnabled ? "Enabled" : "Disabled")
       
        engclient_cmd(0,"weapon_knife")
                       
        set_hudmessage(0, 100, 0, 0.05, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)       
        show_hudmessage(0,KnifeEnabled ? "Knives Only Allowed" : "All Guns Allowed" )
        return PLUGIN_HANDLED
}

public switchweapon(id)
        engclient_cmd(id,"weapon_knife")

new votepistols[] = "\yAMX %s Knives Only Mode?\w^n^n1. Yes^n2. No"

public vote_knives(id){
        new Float:voting = get_cvar_float("amx_last_voting")
        if (voting > get_gametime()){
                client_print(id,print_chat,"* There is already one voting...")
                return PLUGIN_HANDLED
        }
        if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
                client_print(id,print_chat,"* Voting not allowed at this time...")
                return PLUGIN_HANDLED
        }
        new menu_msg
        format(menu_msg,255,votepistols,KnifeEnabled ? "Disable" : "Enable")
        new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
        set_cvar_float("amx_last_voting",get_gametime() + vote_time )
        show_menu(0,(1<<0)|(1<<1),menu_msg,floatround(vote_time))
        set_task(vote_time,"check_votes")
        client_print(0,print_chat,"* Voting has started...")
        option=option=0
        return PLUGIN_HANDLED        
}

public vote_count(id,key){
        if ( get_cvar_float("amx_vote_answers") ) {
                new name
                get_user_name(id,name,31)
                client_print(0,print_chat,"* %s voted %s", name, key ? "against" : "for" )
        }
        ++option
        return PLUGIN_HANDLED
}

public check_votes(id){
        if (option > option){
                server_cmd("amx_knives %s", KnifeEnabled ? "off" : "on" )
                client_print(0,print_chat,"* Voting successful (yes ^"%d^") (no ^"%d^").",option,option)
        }
        else{
                client_print(0,print_chat,"* Voting failed (yes ^"%d^") (no ^"%d^").",option,option)
        }
        return PLUGIN_CONTINUE
}

public end_round(){
        if (round >0)
          round --
        else
          round = 0
        if (!round)
                pause("b","switchweapon")
        else
          unpause("b","switchweapon")
        return PLUGIN_CONTINUE
}

public reset_round(){
        round = get_cvar_num("amx_kniferound")
        unpause("b","switchweapon")
        return PLUGIN_CONTINUE
}

public plugin_init() {
        register_plugin("Knife Arena","0.9","tcquest78")
        register_cvar("amx_kniferound","1")
        register_event("CurWeapon","switchweapon","be","1=1","2!29")
        register_concmd("amx_knives","amx_enableknife",ADMIN_LEVEL_B,"<1|0> - knives only mode")
        register_clcmd("say /voteknives","vote_knives",0,"- start voting session for knives only mode")
        register_menucmd(register_menuid("Knives Only Mode?"),(1<<0)|(1<<1),"vote_count")
        register_event("SendAudio", "end_round", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw")
        register_event("TextMsg", "reset_round", "a", "2&#Game_C", "2&#Game_w")
        round = get_cvar_num("amx_kniferound")
        if (!round) pause("b","switchweapon")
        return PLUGIN_CONTINUE
}

Hydralisk 发表于 2005-6-24 17:59:00

原来的那个可以通过
amx_kniferound 局数
调整开始多少局用刀的,呵呵。

life-rest 发表于 2005-6-24 18:04:14

呵呵,给那些不怎么改的朋友方便 :byebye:

Hydralisk 发表于 2005-6-24 18:04:58

:spiderman

life-rest 发表于 2005-6-24 18:06:17

:cold:
别凶我,怕怕 :em07:

Hydralisk 发表于 2005-6-24 18:07:31

另外指正一点,这个插件不是我编的,是我改编的 :go:

life-rest 发表于 2005-6-24 18:09:32

:wink: 哦,SORRY,我改过来

Hydralisk 发表于 2005-6-24 18:11:20

仍然保留了原有插件的一些功能,如:
amx_knives 1   :本局只能用刀。

1x2s 发表于 2005-6-25 03:41:40

晕不好用!

1x2s 发表于 2005-6-25 03:42:57

不过支持一下!
页: [1] 2
查看完整版本: 【灌水】Hydralisk 的服务器开局用小刀插件AMXX1.0 版