将 ULX 功能添加到脚本中

我需要帮助,在一个单独的脚本中添加 Player:SetUserGroup。当前我尝试的是一旦完成“测试”,该用户就会被加入到一个 ulx 群组中。

目前的情况是这样的。非常感谢任何帮助!!!

net.Receive("Player:SetUserGroup"),function(len,ply)
if not IsValid(ply) or not ply:IsPlayer() then return end
if ply.ADLTable["GoodResponse"] >= (ADLTableCount*ADL.CompletePourcent)/100 then
Player:SetUserGroup( clonetrooper )

end
    end )
点赞
用户15062207
用户15062207

首先,你需要修复一些问题:1,net库将回调函数作为第二个参数,所以 ) 应该只出现在块的结尾。缩进很重要......

net.Receive("Player:SetUserGroup", function(len, ply)
    if not IsValid(ply) or not ply:IsPlayer() then return end

    if ply.ADLTable["GoodResponse"] >= (ADLTableCount*ADL.CompletePourcent)/100 then
        Player:SetUserGroup( clonetrooper )
    end
end )

第二:玩家附加的 ADLTable 的内容是什么? 第三:你应该使用 ULIB(ulx 使用)来将用户添加到用户组。

ucl.addUser(
    ply:SteamID64(),
    nil,
    nil,
    "clonetrooper",
    false
)
2021-01-22 20:44:56