• 0
Avisek

solved Creating quest function

Question

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? :/

Share this post


Link to post
Share on other sites

2 answers to this question

  • 0

"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" ....

  • Thanks 1

Share this post


Link to post
Share on other sites
  • 0
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! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.