搜索
查看: 1871|回复: 1

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

[复制链接]
发表于 2005-11-23 17:33:14 | 显示全部楼层 |阅读模式 来自 中国–河南–洛阳
请问大家这是什么插件? 看了半天没明白。删除又舍不得 呵呵 以下是代码:

/*
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[max_plug][maxlen];
new ran_cmds2[max_plug][maxlen];
new ran_cmdsarg[max_plug][maxlen];
new ran_cmds2arg[max_plug][maxlen];
new ran_type[max_plug];
new ran_disc[max_plug][maxlen + 30];
new ran_num = 0;
new usernum = 0;
new abil[maxuser];
new userid2[maxuser];
public randomabil(id) {
        if (ranabil==false)
                return PLUGIN_CONTINUE;
        abil[usernum] = random_num(0,ran_num);
        if (ran_type[abil[usernum]] == 1) {
                if (id != 0) {
                        client_cmd(id,ran_cmds[abil[usernum]]);
                        client_print(id,print_chat,ran_disc[abil[usernum]]);
                }
        }
        else if (ran_type[abil[usernum]] == 2) {
                new stemp = abil[usernum];
                new thecmd[mlen] = "";
                add(thecmd,31,ran_cmds[stemp]);
                add(thecmd,32," ");
                new ttemp[5];
                num_to_str(id,ttemp,4);
                add(thecmd,33,ttemp);
                add(thecmd,37," ");
                add(thecmd,38,ran_cmdsarg[stemp]);
                server_cmd(thecmd);
                client_print(id,print_chat,ran_disc[abil[usernum]]);
        }
        userid2[usernum] = 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[ran_num],outlenth);
        read_argv(2,ran_cmdsarg[ran_num],outlenth);
        read_argv(3,ran_cmds2[ran_num],outlenth);
        read_argv(4,ran_cmds2arg[ran_num],outlenth);
        new temptype[4];
        read_argv(5,temptype,3);
        ran_type[ran_num] = str_to_num(temptype);
        read_argv(6,ran_disc[ran_num],(outlenth + 30));
        ran_num++;
        return PLUGIN_HANDLED;
}
public endofround(id) {
        new numb = 0;
        usernum = 0;
        new decmd;
        while(numb != (maxuser - 1)) {
                if(userid2[numb] == id) {
                        decmd = numb;
                }
                numb++;
        }
        if (ran_type[abil[usernum]] == 1) {
                if (id != 0) {
                        client_cmd(id,ran_cmds2[abil[decmd]]);
                }
        }
        else if (ran_type[abil[usernum]] == 0) {
                new stemp = abil[usernum];
                new thecmd[mlen] = "";
                add(thecmd,31,ran_cmds2[stemp]);
                add(thecmd,32," ");
                new ttemp[5];
                num_to_str(id,ttemp,4);
                add(thecmd,33,ttemp);
                add(thecmd,37," ");
                add(thecmd,38,ran_cmds2arg[stemp]);
                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:
 楼主| 发表于 2005-11-23 17:35:34 | 显示全部楼层 来自 中国–河南–洛阳

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

zip 上传测试...

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
回复 1 0

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表