Jump to content

Bacca001

Inactive Member
  • Posts

    28
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by Bacca001

  1. You have look this? [Hidden Content] Is official paypal API detailed.
  2. M2 Download Center Download Here ( Internal ) Here ( Require Ban System ) Hello everyone, with this thread I want to introduce myself to the community, i'm an Italian user and I really like this forum, from today, I will share and follow this community. Having said that, beginning immediately to share with you my command "/sban <name character>" which is used to unban a banned character, I used a sanchez thread as a base([Hidden Content]) and I thank him, I'm just starting out with the metin2 sources. Introduction: the column in the database that sanchez has appointed "reason" I have named "ragione". Ok start, open "game/src/cmd.dpp" and search for: ACMD(do_block_chat); Add this under that: ACMD(do_sban); Always in the same file look for: { "block_chat_list",do_block_chat_list, 0, POS_DEAD, GM_PLAYER }, Add this under that: { "sban", do_sban, 0, POS_DEAD, GM_IMPLEMENTOR }, So now save this file, and open "game/src/cmd_gm.cpp", and search for this event: ACMD(do_block_chat) Now add this new event: ACMD(do_sban) { char arg1[256]; const char* nome_pg; if (!ch || ch->GetGMLevel() != GM_IMPLEMENTOR) { sys_log(0, "do_sban without rights %s[%d]", ch->GetName(), ch->GetPlayerID()); return; } one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Error syntax, use: /sban <name character>"); return; } nome_pg = arg1; std::auto_ptr<SQLMsg> esiste_pg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM player.player WHERE name='%s';", nome_pg)); if (esiste_pg->Get()->uiNumRows > 0) { MYSQL_ROW row_esiste_pg = mysql_fetch_row(esiste_pg->Get()->pSQLResult); if (!(row_esiste_pg[0] && row_esiste_pg[0][0] == '0')) { std::auto_ptr<SQLMsg> esiste_ban(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM account.account WHERE (availDt != '0000-00-00 00:00:00' or status='BLOCK') and (id = (SELECT account_id FROM player.player WHERE name='%s'));", nome_pg)); if (esiste_ban->Get()->uiNumRows > 0) { MYSQL_ROW row_esiste_ban = mysql_fetch_row(esiste_ban->Get()->pSQLResult); if (!(row_esiste_ban[0] && row_esiste_ban[0][0] == '0')) { std::auto_ptr<SQLMsg> sban(DBManager::instance().DirectQuery("UPDATE account.account SET availDt = '0000-00-00 00:00:00', ragione = '', status = 'OK' WHERE id = (SELECT account_id FROM player.player WHERE name='%s')", nome_pg)); sys_log(0, "%s[%d] has unban %s.", ch->GetName(), ch->GetPlayerID(), nome_pg); ch->ChatPacket(CHAT_TYPE_INFO, "%s is now unbanned.", nome_pg); } else if (!(row_esiste_ban[0] && row_esiste_ban[0][0] == '1')) { ch->ChatPacket(CHAT_TYPE_INFO, "The character %s isn't banned.", nome_pg); return; } } else { ch->ChatPacket(CHAT_TYPE_INFO, "Im unable to exec the query (Error Code: 1)."); return; } } else if (!(row_esiste_pg[0] && row_esiste_pg[0][0] == '1')) { ch->ChatPacket(CHAT_TYPE_INFO, "The character %s doesn't exist, are a valid name?", nome_pg); return; } } else { ch->ChatPacket(CHAT_TYPE_INFO, "Im unable to exec the query (Error Code: 2)."); return; } } Example of use: /sban Joe This function set in the database status to OK and availDt to 0(default). Ok, that's all, thank you again Sanchez for the base, and I apologize again if the code is long or something I could do better, but as mentioned earlier, are the functions and I'm learning. I hope you find it useful, best regards. For any questions post it here.
×
×
  • 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.