Jump to content
  • 0

Add new function for Quests


Dumik

Question

I want add new function for quests. But when i apply this function to quest nothing happens. Please can you help me?

int game_mysql_query(lua_State* L) 
{ 
  LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); 
  SQLMsg *msg; 

  msg = DBManager::instance().DirectQuery(lua_tostring(L, 1)); 

  if (msg->uiSQLErrno != 0) 
  { 
    sys_err("game_mysql_query failed"); return 0; 
  } 
} 

{ "mysql_query", game_mysql_query }, 

Quest part: pc.give_item2(game.mysql_query("SELECT login FROM account.account WHERE id="..player_id.." ")) Thank you a lot

Link to comment
  • Answers 9
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

9 answers to this question

Recommended Posts

  • 0
    int game_mysql_query(lua_State* L) {
        int i=0;
        //MYSQL_FIELD *field;
        //MYSQL_ROW row;
        char szQuery[1024];
        const char * query = lua_tostring(L, 1);
        unsigned long long int num = 0;
        snprintf(szQuery, sizeof(szQuery), "%s",query);
        
        SQLMsg * msg = DBManager::instance().DirectQuery(szQuery);
        if(msg) {
            std::auto_ptr<SQLMsg> pmsg(msg);
            lua_newtable(L);
            while(MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult)) {
                while(MYSQL_FIELD * field = (MYSQL_FIELD*)mysql_fetch_field(pmsg->Get()->pSQLResult) ) {
                    lua_pushstring(L,field->name);
                    if (sscanf(row[i],"%llu", &num)) 
                        lua_pushnumber(L, num * 1.0);
                    else 
                        lua_pushstring(L,row[i]);
                    lua_rawset(L, -3);
                    i++;            
                }
            }
            return 1;
        } else {
            sys_err("MySQL Query failed!");
            lua_pushnumber(L,0);
        }
        return 0;
    } 

try this one

Link to comment
  • 0

I want add new function for quests. But when i apply this function to quest nothing happens. Please can you help me?

int game_mysql_query(lua_State* L) 
{ 
  LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); 
  SQLMsg *msg; 

  msg = DBManager::instance().DirectQuery(lua_tostring(L, 1)); 

  if (msg->uiSQLErrno != 0) 
  { 
    sys_err("game_mysql_query failed"); return 0; 
  } 
} 

{ "mysql_query", game_mysql_query }, 

Quest part: pc.give_item2(game.mysql_query("SELECT login FROM account.account WHERE id="..player_id.." ")) Thank you a lot

Pan frajer už najednou tak moc nemachruje jo? :D Nezapomeň zase psát že s staráš jen o web a autopatcher :D Tak hlavně že neumíš ani použít funkci pc.give_item2 a píšeš weby :D :D 

//Sorry, i don't speak english :-) 

Link to comment

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


  • Read our Rules
  • Activity

    1. 2

      [Python] Code Translator 2 to 3

    2. 0

      bug gaya

    3. 5

      Fix Core Crash (unused serverside packet)

    4. 45

      Chest Drop View

    5. 0

      How to add Python 3.9 script?

    6. 15

      Metin2 Download Center - Specifications & Documentation

    7. 5

      Fix Core Crash (unused serverside packet)

    8. 45

      Chest Drop View

    9. 5

      Fix Core Crash (unused serverside packet)

  • Recently Browsing

    No registered users viewing this page.

×
×
  • 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.