TShockAPI.DB.Region.RemoveID C# (CSharp) Method

RemoveID() public method

Removes a user's access to the region
public RemoveID ( int id ) : bool
id int User ID to remove
return bool
        public bool RemoveID(int id)
        {
            return AllowedIDs.Remove(id);
        }

Usage Example

Esempio n. 1
0
        public bool RemoveUser(string regionName, string userName)
        {
            Region r = GetRegionByName(regionName);

            if (r != null)
            {
                r.RemoveID(TShock.Users.GetUserID(userName));
                string ids = string.Join(",", r.AllowedIDs);
                int    q   = database.Query("UPDATE Regions SET UserIds=@0 WHERE RegionName=@1 AND WorldID=@2", ids,
                                            regionName, Main.worldID.ToString());
                if (q > 0)
                {
                    return(true);
                }
            }
            return(false);
        }