masher0782 发表于 2009-8-16 03:27:23

WAR3自动购买再生十字架插件,每个玩家单独自行开启

本帖最后由 masher0782 于 2009-8-16 03:30 编辑

回合结束后如果玩家已经死亡自动购买再生十字架,每个玩家都可根据自己的意愿设置是否开启,执行amx_saveguns开启,再次执行则关闭,可以集成在菜单里,只占一行。
这个插件基本上已经很完善了拿去可以直接用。



什么也不说了直接贴代码。#include <amxmodx>
#include <amxmisc>

#define PLUGIN_NAME        "war3_saveguns"
#define PLUGIN_VERSION        "1.0"
#define PLUGIN_AUTHOR        "masher0782"

public plugin_init()
{

register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_event("SendAudio","end_round","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
register_concmd("amx_saveguns", "saveguns",0,"ON|OFF")

}

new savegunson = 0

public saveguns(id)
{
        if (savegunson == 0)
        {
        savegunson = 1
        client_print(id, print_chat, "* 自动保留武器已开启,回合结束时如果您已死亡则自动购买十字架。")
        }
        else
        {
        savegunson = 0
        client_print(id, print_chat, "* 自动保留武器已关闭。")
        }
        return PLUGIN_CONTINUE
}

public end_round(id)
{
set_task(4.5,"execscript",_,_,_,"a",1)
return PLUGIN_CONTINUE
}

public execscript()
{
for (new x=1;x<=32;x=x+1)
        if (!is_user_alive(x) && savegunson == 1)
        {
        client_cmd(x,"shopmenu")
        client_cmd(x,"wait")
        client_cmd(x,"slot1")
        client_cmd(x,"wait")
        client_cmd(x,"shopmenu")
        client_cmd(x,"wait")
        client_cmd(x,"slot1")
        }
return PLUGIN_HANDLED
}

asa366 发表于 2009-8-16 08:10:17

谢谢分享
页: [1]
查看完整版本: WAR3自动购买再生十字架插件,每个玩家单独自行开启