EOSERV Forum > EOSERV > Disable Redistration (.RELEASE.) (FIXED - UPDATE YOUR CODE!)
Topic is locked.
Page: << 1 >>
Disable Redistration (.RELEASE.) (FIXED - UPDATE YOUR CODE!)
Author Message
Post #22668 Disable Redistration (.RELEASE.) (FIXED - UPDATE YOUR CODE!)

Hey, I've decided to release my Registration disabler.



put in eoconst.hpp under "ACCOUNT_CHANGED = 6,":

    ACCOUNT_DENY = 7,


put in account.cpp under "reply.SetID(PACKET_ACCOUNT, PACKET_REPLY);" in "PACKET_REQUEST" :

FOR REV <167

            if (static_cast<std::string>(this->server->world->config["Registration"]) == "off")
            {
                reply.AddShort(ACCOUNT_DENY);
                reply.AddString("NO");
            }

FOR REV 168

            if (!this->server->world->config["Registration"])
            {
                reply.AddShort(ACCOUNT_DENY);
                reply.AddString("NO");
            }


and replace "if (!Player::ValidName(username))" (under code you've pasted) with:

else if (!Player::ValidName(username))

and put under "CLIENT_SEND(reply);" :

FOR REV <167

if (static_cast<std::string>(this->server->world->config["Registration"]) == "off") this->Close();

FOR REV 168

if (!this->server->world->config["Registration"]) this->Close();


put in main.cpp under other eoserv_config_default:

        eoserv_config_default(config, "Registration"       , "on");


and somewhere in your config.ini:
##Registration (bool)
# Enables or disables registration
# Default : on
Registration = on


And compile EOserv. Now you can Disable registration setting "registration" config value to disabled.

14 years, 25 weeks ago
Post #22675 Re: Disable Redistration (.RELEASE.)

Good job, I remember talking about how to do it just awhile ago. Very well coded also. One note though, you should just add "DisableRegistration" into config, that way you don't have to put disabled or enabled, it's just 0 or 1.


---
http://www.addipop.com
14 years, 25 weeks ago
Post #22688 Re: Disable Redistration (.RELEASE.)

Looks good, does this open the popup that says 'Account registrations are temporarily disabled' ?

---
Web developer, currently looking for graphic artists / designers.
14 years, 25 weeks ago
Post #22692 Re: Disable Redistration (.RELEASE.)
Klutz posted: (22nd Oct 2009 12:48 am)

Looks good, does this open the popup that says 'Account registrations are temporarily disabled' ?


It didn't for me. However it did close the registration and prevent new accounts from being made. When I set it back to Enable the account was created fine.
---
Do what thou wilt shall be the whole of the law. Love is the law, love under will. There is no law
beyond do what thou wilt. 93/93
14 years, 25 weeks ago
Post #22783 Re: Disable Redistration (.RELEASE.)

When I'l get my compiler working for ev 168, I'l update code to make it working witr rev 168.

14 years, 24 weeks ago
Post #24197 Disable Redistration (.RELEASE.) (FIXED - UPDATE YOUR CODE!)

I have fixed his code so it shows the message that the registration is closed.



put in eoconst.hpp under "ACCOUNT_CHANGED = 6,":

    ACCOUNT_DENY = 7,


put in account.cpp under "reply.SetID(PACKET_ACCOUNT, PACKET_REPLY);" in "PACKET_REQUEST" :

FOR REV <167

            if (static_cast<std::string>(this->server->world->config["Registration"]) == "off")
            {
                reply.AddShort(ACCOUNT_DENY);
                reply.AddString("NO");
            }

FOR REV 168

            if (!this->server->world->config["Registration"])
            {
                reply.AddShort(ACCOUNT_DENY);
                reply.AddString("NO");
            }


and replace "if (!Player::ValidName(username))" (under code you've pasted) with:

else if (!Player::ValidName(username))

and put under "CLIENT_SEND(reply);" :

FOR REV <167

if (static_cast<std::string>(this->server->world->config["Registration"]) == "off") this->Close();

FOR REV 168

if (!this->server->world->config["Registration"]) this->Close();


put in main.cpp under other eoserv_config_default:

        eoserv_config_default(config, "Registration"       , "on");


and somewhere in your config.ini:
##Registration (bool)
# Enables or disables registration
# Default : on
Registration = on


And compile EOserv.

Now you can Disable registration setting by changing "registration" config value to off.

14 years, 22 weeks ago
Post #24339 Re: Disable Redistration (.RELEASE.) (FIXED - UPDATE YOUR CODE!)

Hey, you've only copied and pasted my code! I've fixed it some time, before you've posted this!

14 years, 22 weeks ago
Post #24442 Disable Redistration (.RELEASE.) (FIXED - UPDATE YOUR CODE!)

I made it so that the config uses 0 and 1 instead of off and on.


put in eoconst.hpp under "ACCOUNT_CHANGED = 6,":

    ACCOUNT_DENY = 7,


put in account.cpp under "reply.SetID(PACKET_ACCOUNT, PACKET_REPLY);" in "PACKET_REQUEST" :

FOR REV <167

            if (static_cast<std::string>(this->server->world->config["DisableRegistration"]) == "0")
            {
                reply.AddShort(ACCOUNT_DENY);
                reply.AddString("NO");
            }

FOR REV 168

            if (!this->server->world->config["DisableRegistration"])
            {
                reply.AddShort(ACCOUNT_DENY);
                reply.AddString("NO");
            }


and replace "if (!Player::ValidName(username))" (under code you've pasted) with:

else if (!Player::ValidName(username))

and put under "CLIENT_SEND(reply);" :

FOR REV <167

if (static_cast<std::string>(this->server->world->config["DisableRegistration"]) == "0") this->Close();

FOR REV 168

if (!this->server->world->config["DisableRegistration"]) this->Close();


put in main.cpp under other eoserv_config_default:

        eoserv_config_default(config, "DisableRegistration"       , "1");


and somewhere in your config.ini:
##DisableRegistration
# Enables or disables registration
# Default : 1 (enable = 1 and disable = 0)
DisableRegistration= 1


And compile EOserv.

Now you can Disable registration setting "DisableRegistration" by changeing the config value to 0.

14 years, 22 weeks ago
Post #24456 Re: Disable Redistration (.RELEASE.) (FIXED - UPDATE YOUR CODE!)

I think mine was easier. Everyone knows what on and off means.


14 years, 22 weeks ago
Post #24735 Re: Disable Redistration (.RELEASE.) (FIXED - UPDATE YOUR CODE!)

well you took my code the first time i fixed it so i figured i would change it to use 0 and 1.

14 years, 22 weeks ago
Post #24736 Re: Disable Redistration (.RELEASE.) (FIXED - UPDATE YOUR CODE!)

You should probably use whatever the other configuration variables use.

14 years, 22 weeks ago
Page: << 1 >>
Topic is locked.
EOSERV Forum > EOSERV > Disable Redistration (.RELEASE.) (FIXED - UPDATE YOUR CODE!)