GA好望角|魔力宝贝私服|魔力私服|魔力私服|GA反外挂

 找回密码
 立即注册
查看: 172|回复: 2

[分享]来自珊瑚大大的LUAC--给与全队道具

[复制链接]

1

主题

12

帖子

12

积分

新手上路

Rank: 1

金钱
133
号角币
0
发表于 2025-9-20 15:28:26 | 显示全部楼层 |阅读模式
--此条LUAC来自珊瑚大大精心制作无错版.
--使用方法.GMSV-LUA-System-BaseModule-luac.(以下代码复制进你的luac里)
--##########
--# 全队指令
--##########
    local s_tmp = Split(s,",")
    local key = s_tmp[1] or ""
    --全队道具栏空位检测
    if key == "gaitemspace" then
        local RTFLG = 1;
        local NeedNum = tonumber(s_tmp[2]) or 1
        for i = 0,4 do
            local pch = Char.GetPartyMember(player,i);
            if Char.GetData(player,%对象_组队模式%) == 0 then
                pch = player
            end
                        local EmptyNum = 0
                        for j = 8, 27 do
                                if Char.GetItemIndex(pch,j) < 0 then
                                        EmptyNum = EmptyNum + 1
                                end
                        end
            if EmptyNum < NeedNum then
                RTFLG = 0
                --告诉队员
                NLG.SystemMessage(pch,"需要保留"..NeedNum.."个道具栏空位");
                --告诉队长
                if pch ~= player then
                    NLG.SystemMessage(player,"["..Char.GetData(pch,2000).."]需要保留"..NeedNum.."个道具栏空位");
                end
            end
            if Char.GetData(player,%对象_组队模式%) == 0 then
                break
            end
        end
        return RTFLG
    --全队给道具
    elseif key == "gagiveitem" then
        local ItemID = tonumber(s_tmp[2]) or 0;
        if ItemID == 0 then return 0 end;
        local ItemNum = tonumber(s_tmp[3]) or 1;
        for i = 0 , 4 do
            local pch = Char.GetPartyMember(player,i);
            if Char.GetData(player,%对象_组队模式%) == 0 then
                pch = player
            end
            local ItemIndex = Char.GiveItem(pch,ItemID,ItemNum);
            if pch ~= player then
                NLG.SystemMessage(player,"["..Char.GetData(pch,2000).."]获得了 "..Item.GetData(ItemIndex,2001));
            end
            if Char.GetData(player,%对象_组队模式%) == 0 then
                break
            end
        end
        return 1
    end
-------
---以下为脚本的写法.
block
        luac gaitemspace,1
                if localcount31 == 1
                        window "啊.啊.啊.",OK,cancel
                        window_OK
                                luac gagiveitem,211,1
                                        #warp 0,1000,238,80
                endif
endblock
回复

使用道具 举报

156

主题

170

帖子

170

积分

管理员

Rank: 9Rank: 9Rank: 9

金钱
2728
号角币
480
发表于 2025-9-20 15:44:35 | 显示全部楼层
帮忙解释一下 lua脚本中return的值 会临时存放在普通脚本的localcount 31 中,可以用作后续判断
如下:

-- 自注册luacall事件
-- 格式 Event.ScriptCall.[任意字符] 即可自动注册luac事件

function Event.ScriptCall.TestCall(npc, player, s)
       if split(s,",")[1] == "gaitemspace" then
          ....
          return 1
       end
       return 100
end
============================================================

block
    luac gaitemspace,1
    if localcount 31 == 1
                       
    endif

    if localcount 31 == 100
                       
    endif
endblock



回复 支持 1 反对 0

使用道具 举报

3

主题

7

帖子

7

积分

新手上路

Rank: 1

金钱
191
号角币
5
发表于 2025-9-20 15:30:44 | 显示全部楼层
好东西要支持
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|GA好望角

GMT+8, 2025-10-3 05:25 , Processed in 0.066773 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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