RegItemUseEvent (DoFile, InitFuncName);


函数功能:

创建一个所有玩家双击道具就会触发的Lua函数。


请求方式:

参数名 是否必须 类型 说明
DoFile string 脚本文件路径(如是本文件则填写nil)
InitFuncName string 响应事件处理函数的名称,声明格式参考如下

参数说明:

参数名 是否必须 类型 说明
CharIndex int 响应事件的对象索引
ItemIndex int 响应事件的道具对象索引

返回值:

类型 是否必须 正常 拦截
int 0 1

操作实例:

function RegItemUseEvent(CharIndex, Itemindex)
--竞技场内不允许使用15607道具(血瓶)
    local MapID = Char.GetData(CharIndex, %对象_地图%);
    local ItemID = Item.GetData(Itemindex, %对象_ID%);
    if (MapID == 1401 and ItemID == 15607)then
        NLG.SystemMessage(CharIndex, "竞技场不能使用血瓶!");
        return 0;
    end
    return 1;
end

备注:

  • 返回错误代码请使用 GetErrorStr 获取具体错误信息。
文档更新时间: 2023-04-21 15:45   作者:105493660