Dump.sql and Struct.sql (from Trapped Github)

Posts 1–8 of 8 · Page 1 of 1
Dump.sql and Struct.sql (from Trapped Github)
Okay. Every time i register i'm always not on the whitelist. So i decided to edit Dump and Struct to be sure. Changed Verified and Whitelisted Default to 1 but still every time i create a new account its still not on the whitelist... Anyone who can heelp me??

@Trapped
@Trapped how do i change the default of the struct.sql of Whitelisted to 1 ?

Because whenever i create a new account, it is always not in the whitelist... I want to make it always in the Whitelist. I do i make it default?
Same problem here..
Oh you need to make one account whitelisted dont make new!
ehrm......
Here's a quick fix... not the best but it works.

Database.cs -
Code:
public bool isWhitelisted(Account acc)
        {
            var cmd = CreateQuery();
            cmd.CommandText = "SELECT whitelisted FROM accounts WHERE id=@id";
            cmd.Parameters.AddWithValue("@id", acc.AccountId);
            object scalar = cmd.ExecuteScalar();
            if (scalar.ToString() == "1")
            {
                return true;
            }
            else
            {
                return true;
            }
        }
@Trapped will lol at this
Quote Originally Posted by C453 View Post
ehrm......
Here's a quick fix... not the best but it works.

Database.cs -
Code:
public bool isWhitelisted(Account acc)
        {
            var cmd = CreateQuery();
            cmd.CommandText = "SELECT whitelisted FROM accounts WHERE id=@id";
            cmd.Parameters.AddWithValue("@id", acc.AccountId);
            object scalar = cmd.ExecuteScalar();
            if (scalar.ToString() == "1")
            {
                return true;
            }
            else
            {
                return true;
            }
        }
@Trapped will lol at this
looooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooool.

No, the real code to be changed is that (snippet from Register method in Database.cs):
Code:
public object Register(string uuid, string password, bool isGuest)
        {
            var cmd = CreateQuery();
            cmd.CommandText = "SELECT COUNT(id) FROM accounts WHERE uuid=@uuid;";
            cmd.Parameters.AddWithValue("@uuid", uuid);
            if (cmd.ExecuteNonQuery() == 0) return null;

            cmd = CreateQuery();
            cmd.CommandText = "INSERT INTO accounts(uuid, password, name, admin, namechosen, verified, guild, guildRank, vaultCount, maxCharSlot, regTime, guest, whitelisted, banned) VALUES(@uuid, SHA1(@password), @NaMe.., 0, 0, 0, 0, 0, 1, 1, @regtime, @guest, 0, 0);";
The bold values are the whitelist ones. Change the second one to 1 to have every account whitelisted by default (or delete both if you want to modify that from the Database table settings).
Thanks. Both of You!!
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us