我正在尝试将GetUserGroup返回为多个值,但它只返回1我尝试使用for语句但没有用,并且我不想这样做,ply:GetUserGroup() == "owner"
或者ply:GetUserGroup() == "superadmin"
这是解决问题的唯一方法,但是它会很长行,我不能拥有
这是darkrp可添加性代码:
DarkRP.createEntity("Money printer", {
ent = "money_printer",
model = "models/props_c17/consolebox01a.mdl",
price = 1000,
cmd = "buymoneyprinter",
getMax = function(ply)
local limitRanks = {"odyssian", "tmod", "dmod", "dadmin", "admin", "superadmin", "co-owner", "owner"}
return ply:GetUserGroup() == limitRanks and 6 or 3
end,
})
您需要转limitRanks
成哈希表,并检查键是否存在于return语句中:
local limitRanks = {odyssian = true, tmod = true, dmod = true, dadmin = true,
admin = true, superadmin = true, ["co-owner"] = true, owner = true}
return limitRanks[ply:GetUserGroup()] and 6 or 3
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句