【问题标题】:adding ULX function to a script将 ULX 函数添加到脚本
【发布时间】:2021-04-27 05:22:23
【问题描述】:

我需要一些帮助,将 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 )

【问题讨论】:

    标签: lua garrys-mod


    【解决方案1】:

    首先,你需要解决一些问题: 1,网络库使用回调作为第二个参数,所以) 应该只在块的末尾。而且缩进很重要……

    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 uses it) to add users to usergroups.

    ucl.addUser(    ply:SteamID64(),
    nil,
    nil,
    "clonetrooper",
    false)
    

    【讨论】:

      猜你喜欢
      • 2012-07-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-02
      • 2021-09-06
      • 2021-07-11
      • 1970-01-01
      • 2022-01-20
      相关资源
      最近更新 更多