Jump to content

Add new function for Quests


Recommended Posts

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
Share on other sites

  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

    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
Share on other sites

  • 2 months later...

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
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 60

      Inbuild GR2 Animation

    2. 2

      wait() function bug

    3. 0

      Remove Party Role Bonuses

    4. 1

      Fix CBar3D

    5. 2

      set_quest_state not working

    6. 1

      Fix CBar3D

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