Traceur3RUN 75 Posted October 19, 2018 Share Posted October 19, 2018 Hello, i ask now how i can use MySQL insert/update/select from c++ and lua. can you post example how i can use it? i ask there for example how i can send packet from game->python game->client binary game->client binary->python client binary->python client binary->game client binary->game and python get values like from MySQL like[player->gold] and send it to client and receive binary/and or python if (gold >= 0){ //todo } can someone make a tutorial or show under example code? i think it will be helpfull not only for me but for all people to understand how it work. thanks! Link to comment Share on other sites More sharing options...
ManiacRobert 428 Posted October 19, 2018 Share Posted October 19, 2018 Link to comment Share on other sites More sharing options...
Traceur3RUN 75 Posted October 19, 2018 Author Share Posted October 19, 2018 15 minut temu, ManiacRobert napisał: oh, i missed it but, i still need example to MySQL part, insert, update, select Link to comment Share on other sites More sharing options...
Premium ragem0re 155 Posted October 19, 2018 Premium Share Posted October 19, 2018 Just look for an existing part in your source code. Link to comment Share on other sites More sharing options...
Traceur3RUN 75 Posted October 19, 2018 Author Share Posted October 19, 2018 5 minut temu, ragem0re napisał: Just look for an existing part in your source code. so you mean like this: int pc_set_test(lua_State* L){ char szQuery[QUERY_MAX_LEN]; if(!lua_isstring(L,1)){ return 0; } LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); snprintf(szQuery,sizeof(szQuery),"update account%s set test = '%s' where id = '%d'",get_table_postfix(),lua_tostring(L,1), ch->GetAID()); //ch->GetAID() = get account id std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery)); if(pmsg->Get()->uiInsertID == 0){ return 0; } return 1; } is correct? i think this is LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); // = current character playing btw, how about use mysql_query in lua? Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now