• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ how to call a config.lua value into c++ files?

5lave Ots

Active Member
Joined
Oct 2, 2017
Messages
246
Solutions
1
Reaction score
40
Location
Ankrahmun
how to get a config variable like (X) from config.lua
to be used in protocol login.cpp
here it a c++ example
Lua:
Account account;
    if (!IOLoginData::loginserverAuthentication(accountName, password, account)) {
        disconnectClient("blah blah "Get the config value here.."");
        return;
    }
 
Add a new string value under enum string_config_t in configmanager.h like

DC_REASON


Load it under ConfigManager::load()

Code:
    string[SERDC_REASONER_NAME] = getGlobalString(L, "dcReason", "Default reason here.");

Call it's value in DC

Lua:
        disconnectClient("Disconnected for: " + g_config.getString(ConfigManager::DC_REASON) + ".");


Search for references to SERVER_NAME and just add the values below SERVER_NAME or similar.
 
Back
Top