nd5 发表于 2005-11-23 17:33:14

大家看看这个ranabil.sma/amx是什么插件

请问大家这是什么插件? 看了半天没明白。删除又舍不得 呵呵 以下是代码:

/*
Random Abilites Beta3-Stable
Lee Burton
It reads from a config file...
ran_plug <start cmd> <start cmd parameters> <stop cmd> <stop cmd parameters> <1/2> <discription>
like some example entries in the cfg would be
ran_plug "stalk" "" "unstalk" "" "1" "You are a stalker this round!"
the "1" means client
so
ran_plug "amx_chicken" "" "amx_unchicken" "" "2" "You got to be a chicken!"
the "2" mean admin cmd
OR
ran_plug "amx_noclip" "1" "amx_noclip" "0" "2" "You got no clip!!!"
it would send amx_noclip <id of user> 1 to the server console on round start
and amx_noclip <id> 0 on round end
cvar ran_abil 0/1 disable/enable
*/
#include <amxmod>
#include <amxmisc>
#include <string>
#define max_plug 64;
#define maxuser 30;
#define maxlen 32;
#define mlen ((maxlen * 2) + 15);
new bool:ranabil;
new ran_cmds;
new ran_cmds2;
new ran_cmdsarg;
new ran_cmds2arg;
new ran_type;
new ran_disc;
new ran_num = 0;
new usernum = 0;
new abil;
new userid2;
public randomabil(id) {
        if (ranabil==false)
                return PLUGIN_CONTINUE;
        abil = random_num(0,ran_num);
        if (ran_type] == 1) {
                if (id != 0) {
                        client_cmd(id,ran_cmds]);
                        client_print(id,print_chat,ran_disc]);
                }
        }
        else if (ran_type] == 2) {
                new stemp = abil;
                new thecmd = "";
                add(thecmd,31,ran_cmds);
                add(thecmd,32," ");
                new ttemp;
                num_to_str(id,ttemp,4);
                add(thecmd,33,ttemp);
                add(thecmd,37," ");
                add(thecmd,38,ran_cmdsarg);
                server_cmd(thecmd);
                client_print(id,print_chat,ran_disc]);
        }
        userid2 = id;
        usernum++;
        return PLUGIN_CONTINUE
}
public random_plug() {
        if (ran_num >= max_plug) {
                server_print("Plugin Limit HAS BEEN REACHED!");
                return PLUGIN_HANDLED;
        }
        new outlenth = (maxlen - 1);
        read_argv(1,ran_cmds,outlenth);
        read_argv(2,ran_cmdsarg,outlenth);
        read_argv(3,ran_cmds2,outlenth);
        read_argv(4,ran_cmds2arg,outlenth);
        new temptype;
        read_argv(5,temptype,3);
        ran_type = str_to_num(temptype);
        read_argv(6,ran_disc,(outlenth + 30));
        ran_num++;
        return PLUGIN_HANDLED;
}
public endofround(id) {
        new numb = 0;
        usernum = 0;
        new decmd;
        while(numb != (maxuser - 1)) {
                if(userid2 == id) {
                        decmd = numb;
                }
                numb++;
        }
        if (ran_type] == 1) {
                if (id != 0) {
                        client_cmd(id,ran_cmds2]);
                }
        }
        else if (ran_type] == 0) {
                new stemp = abil;
                new thecmd = "";
                add(thecmd,31,ran_cmds2);
                add(thecmd,32," ");
                new ttemp;
                num_to_str(id,ttemp,4);
                add(thecmd,33,ttemp);
                add(thecmd,37," ");
                add(thecmd,38,ran_cmds2arg);
                server_cmd(thecmd);
        }
}
public check_ran(){
        if (get_cvar_num("ran_abil")==0) {
                ranabil=false;
        }
        else {
                ranabil=true;
        }
        return PLUGIN_CONTINUE;
}
public plugin_init() {
        register_plugin("RANDOM ABILITES","0.8","Lee Burton(SG1)");
        register_event("ResetHUD","randomabil","be");
        register_event("SendAudio","endofround","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
        register_srvcmd("ran_plug","random_plug");
        register_cvar("ran_abil","1",0);
        set_task(10.0,"check_ran",456,"",0,"b");
        set_task(1.0,"check_ran",457);
        server_cmd("exec addons/amx/random.cfg");
}
:confused:

nd5 发表于 2005-11-23 17:35:34

回复: 大家看看这个ranabil.sma/amx是什么插件

zip 上传测试...
页: [1]
查看完整版本: 大家看看这个ranabil.sma/amx是什么插件