Solved If players is in group ?

Discussion in 'Rust Development' started by PaiN, May 23, 2015.

  1. 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"
     
  2. Thanks Domestos! As Always helpfull

    [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
    
    error
    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
  3. Why would you write that in Lua, just call it like you call the other permission methods. :)
     
  4. I only know the on if permission.UserHasPermission ..
    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") ????
     
  5. Code:
     if permission.UserHasGroup(steamId, "player") then .....
     
  6. Oh.... Thanks so much