For if players has permission i use this
"if permission.UserHasPermission(steamId, "cankill") then"
but i want this for groups like
"if group.UserHasGroup(steamId, "player") then"
Solved If players is in group ?
Discussion in 'Rust Development' started by PaiN, May 23, 2015.
-
If you want to know if a specific library function, you would need, exists you can simply look up the library on github.
https://github.com/OxideMod/Oxide/blob/master/Oxide.Core/Libraries/Permission.cs#L360 -
[DOUBLEPOST=1432367530][/DOUBLEPOST]So in Lua this should like
Code:function PLUGIN:UserHasGroup( userid, groupname)if (GroupExists(groupname)) return false local data = GetUserData(userid) return data.Groups.Contains(groupname.ToLower())end end
Code:[Oxide] 11:07 AM [Error] Failed to load plugin test File: test Line: 29 'then' expected near 'return': at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unkn own>:0 at NLua.Lua.LoadString (System.String chunk, System.String name) [0x00000] in <filename unknown>:0 at Oxide.Ext.Lua.Plugins.LuaPlugin.Load () [0x00000] in <filename unknown>:0 at Oxide.Ext.Lua.Plugins.LuaPluginLoader.Load (System.String directory, System .String name) [0x00000] in <filename unknown>:0 at Oxide.Core.OxideMod.LoadPlugin (System.String name) [0x00000] in <filename unknown>:0
Last edited by a moderator: May 23, 2015 -
Why would you write that in Lua, just call it like you call the other permission methods.
-
i'm trying to do the same for group as i said Domestos gave me something but i'm lost with all these codes in github
so it should be
if UserHasGroup(steamId, "player") ???? -
Code:
if permission.UserHasGroup(steamId, "player") then .....
-