Jump to content

Creating quest function


Recommended Posts

Hello,
I am creating report system using quest. I created new function and quest.
But when I use that quest, it inputs my name ("who") into "reported" column.. And "reported" text is nowhere..
 
quest (it is only testing quest):
quest report_button begin
    state start begin
        when letter begin
            cmdchat("report_button "..q.getcurrentquestindex())
        end
        when button or info begin
            local who = pc.get_name()
            local reported = "Make DDS!"
            report_log(who, reported)
            syschat("DEBUG COMPLETE")
        end
    end
end

It is calling function report_log, which I created.. There is function:

questlua_global.cpp:

    int _report_log(lua_State * L)
    {
        CQuestManager& q = CQuestManager::instance();

        const char* who = "";
        const char* reported = "";

        if (lua_isstring(L, 1)) who = lua_tostring(L, 1);
        if (lua_isstring(L, 2)) reported = lua_tostring(L, 2);

        LogManager::instance().ReportLog(who, reported);
        return 0;
    }

And this function is called by "ReportLog"

log.cpp:

void LogManager::ReportLog(const char* who, const char* reported)
{
  
    Query("INSERT DELAYED INTO report (who, reported) VALUES('%s', '%s');",
            get_table_postfix(), who, reported);
}

Could somebody help me, please? :/

Link to comment
Share on other sites

  • Bronze

"get_table_postfix()," -> Remove that , or replace all query with:

    Query("INSERT DELAYED INTO report%s (who, reported) VALUES('%s', '%s');",
            get_table_postfix(), who, reported);

get_table_postfix is used for test servers most of the times , for example you add TABLE_POSTFIX = "_test" in db config and your new tables will be "player_test", "item_test" ....

  • Love 1
Link to comment
Share on other sites

13 minutes ago, Abel(Tiger) said:

"get_table_postfix()," -> Remove that , or replace all query with:


    Query("INSERT DELAYED INTO report%s (who, reported) VALUES('%s', '%s');",
            get_table_postfix(), who, reported);

get_table_postfix is used for test servers most of the times , for example you add TABLE_POSTFIX = "_test" in db config and your new tables will be "player_test", "item_test" ....

Thank you very much for solution and explanation..

You are god! :)

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.