Despero 131 Posted February 17, 2015 Share Posted February 17, 2015 M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) Hello first this in Account table DROP TABLE IF EXISTS `ban_list`; CREATE TABLE `ban_list` ( `account` varchar(12) DEFAULT NULL, `reason` varchar(64) DEFAULT NULL, `source` varchar(12) DEFAULT NULL, `date` datetime DEFAULT NULL, `action` enum('ban','unban') DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; and lets go open game/cmd.cpp and search for this: ACMD(do_block_chat); Add this under that: ACMD(do_player_ban); ACMD(do_player_unban); Search for this still in the game/cmd.cpp: { "block_chat_list",do_block_chat_list, 0, POS_DEAD, GM_PLAYER }, Make a new line and add this under that: { "player_unban", do_player_unban, 0, POS_DEAD, GM_IMPLEMENTOR }, { "player_ban", do_player_ban, 0, POS_DEAD, GM_HIGH_WIZARD }, Search for this event in game/cmd_gm.cpp: ACMD(do_block_chat) Add this under that: ACMD (do_player_ban) { if (ch && (ch->GetGMLevel() < GM_HIGH_WIZARD)) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("그런 명령어는 없습니다")); return; } char arg1[256]; argument = one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) { if (ch) ch->ChatPacket(CHAT_TYPE_INFO, "Usage: player_ban <name> <reason>"); return; } const char* name = arg1; char arg2[256]; argument = one_argument(argument, arg2, sizeof(arg2)); if (!*arg2) { if (ch) ch->ChatPacket(CHAT_TYPE_INFO, "Usage: player_ban <name> <reason>"); return; } char* reason; if(!*arg2) reason = (char*) ""; else reason = arg2; sys_log(0, "BAN %s", name); LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(name); if (!tch) { ch->ChatPacket(CHAT_TYPE_INFO, "can not find the target!"); return; } if (ch) ch->ChatPacket(CHAT_TYPE_INFO, "ban requested."); if (tch && ch != tch) { if(tch->GetGMLevel() == GM_IMPLEMENTOR) { ch->ChatPacket(CHAT_TYPE_INFO, "Can not ban/unban Administrator!"); } else { tch->ban(reason, ch->GetPlayerID()); } } } ACMD (do_player_unban) { if (ch && (ch->GetGMLevel() < GM_HIGH_WIZARD)) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("그런 명령어는 없습니다")); return; } char arg1[256]; argument = one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) { if (ch) ch->ChatPacket(CHAT_TYPE_INFO, "Usage: player_unban <name>"); return; } char* name = arg1; sys_log(0, "UNBAN %s", name); ch->ChatPacket(CHAT_TYPE_INFO, "player_unban requested."); ch->unban(name); } Search for this event in game/char.cpp int CHARACTER::GetSkillPowerByLevel(int level, bool bMob) const { return CTableBySkill::instance().GetSkillPowerByLevelFromType(GetJob(), GetSkillGroup(), MINMAX(0, level, SKILL_MAX_LEVEL), bMob); } and add this void CHARACTER::ban(char* reason2, unsigned int myid2) { DWORD myself = GetAID(); char * query = (char*) malloc(sizeof(*query)); snprintf(query, 1024, "UPDATE account.account SET status='BLOCK' WHERE id='%u'", myself); SQLMsg * msg = DBManager::instance().DirectQuery(query); if(!msg) { sys_err("cmd_ban: MySQL Query failed!"); } free(query); char * query2 = (char*) malloc(sizeof(*query2)); snprintf(query2, 1024, "INSERT INTO account.ban_list (account, reason, source, date, action) VALUES('%u', '%s', '%u', NOW(), 'ban')", myself, reason2, myid2); //const char * query2 = "INSERT INTO account.ban_list (account, reason, source) VALUES('%d', '%d', '%s')", GetAID(), myid2, reason2; SQLMsg * msg2 = DBManager::instance().DirectQuery(query2); if(!msg2) { sys_err("cmd_ban: MySQL Query2 failed!"); } free(query2); M2_DELETE(query); M2_DELETE(query2); M2_DELETE(msg); M2_DELETE(msg2); char * resulttxt = (char*) malloc(sizeof(*query2)); snprintf(resulttxt, 1024, "%s %s", LC_TEXT("You were banned! Reason:"), reason2); ChatPacket(CHAT_TYPE_INFO, resulttxt); GetDesc()->DelayedDisconnect(3); M2_DELETE(resulttxt); } void CHARACTER::unban(char* name) { char * query = (char*) malloc(sizeof(*query)); snprintf(query, 1024, "UPDATE account.account INNER JOIN player.player ON player.account_id=account.id SET status='OK' WHERE player.name='%s'", name); //snprintf(query, 1024, "UPDATE account.account SET status='OK' WHERE id='%u'", GetAID()); SQLMsg * msg = DBManager::instance().DirectQuery(query); if(!msg) { sys_err("cmd_unban: MySQL Query failed!"); } free(query); char * query2 = (char*) malloc(sizeof(*query)); snprintf(query2, 1024, "INSERT INTO account.ban_list (account, reason, source, date, action) VALUES(0, '%s', '%u', NOW(), 'unban')", name, GetPlayerID()); //snprintf(query, 1024, "UPDATE account.account SET status='OK' WHERE id='%u'", GetAID()); SQLMsg * msg2 = DBManager::instance().DirectQuery(query2); if(!msg2) { sys_err("cmd_unban: MySQL Query failed!"); } free(query2); M2_DELETE(query2); M2_DELETE(msg2); M2_DELETE(query); M2_DELETE(msg); } and now open game/char.h search this void StartAffectEvent(); and add this void ban(char* reason2, unsigned int myid2); void unban(char* name); Kind Regards, Despero 10 1 9 Link to comment Share on other sites More sharing options...
Ken 905 Posted February 17, 2015 Share Posted February 17, 2015 (edited) I can't see actual functions ch-unban(name); tch->ban(reason, ch->GetPlayerID()); // GM이 아니거나 block_chat_privilege가 없는 사람은 명령어 사용 불가 I don't know what i say for this Thanks anyway. Kind Regards Ken ~ TA Edited February 17, 2015 by Ken 1 Do not be sorry, be better. Link to comment Share on other sites More sharing options...
Despero 131 Posted February 17, 2015 Author Share Posted February 17, 2015 It works 100 % Link to comment Share on other sites More sharing options...
Ken 905 Posted February 17, 2015 Share Posted February 17, 2015 (edited) It works 100 % Can you tell me one thing please? How can gcc know these functions if it's not declared in char.h & char.cpp ? #first error unban & ban are not declared in char.h & char.cpp Kind Regards Ken ~ TA Edited February 17, 2015 by Ken 1 Do not be sorry, be better. Link to comment Share on other sites More sharing options...
Despero 131 Posted February 17, 2015 Author Share Posted February 17, 2015 It works 100 % Can you tell me one thing please? How can gcc know these functions if it's not declared in char.h & char.cpp ? #first error unban & ban are not declared in char.h & char.cpp Kind Regards Ken ~ TA I have edit the topic Link to comment Share on other sites More sharing options...
Lyrex 6 Posted February 19, 2015 Share Posted February 19, 2015 Please refer to the source of your code which comes directly from the recently released vanilla source code. Well, giving credits is the least you could do if you're just copy-pasting. Link to comment Share on other sites More sharing options...
antrax16 2 Posted March 6, 2015 Share Posted March 6, 2015 Thanks . Im tested this tutorial and its work . Link to comment Share on other sites More sharing options...
Premium Galet 515 Posted March 6, 2015 Premium Share Posted March 6, 2015 Unban Ban Anyways, thanks 1 2 Link to comment Share on other sites More sharing options...
Raptt 0 Posted March 9, 2015 Share Posted March 9, 2015 Thanks you body's!! Link to comment Share on other sites More sharing options...
Damixxx0101 6 Posted March 18, 2015 Share Posted March 18, 2015 thx Link to comment Share on other sites More sharing options...
thespeedy 20 Posted September 2, 2015 Share Posted September 2, 2015 dont work -.- Link to comment Share on other sites More sharing options...
Draeth 0 Posted October 10, 2015 Share Posted October 10, 2015 The Server shutdown if you write like this: /Player_ban NICK REASON OTHERSTUFFTHATYOUWROTE /Player_unban NICK OTHERSTUFFTHATYOUWROTE Link to comment Share on other sites More sharing options...
Premium EnKor 43 Posted March 28, 2016 Premium Share Posted March 28, 2016 On 10/10/2015 at 3:05 PM, Draeth said: The Server shutdown if you write like this: /Player_ban NICK REASON OTHERSTUFFTHATYOUWROTE /Player_unban NICK OTHERSTUFFTHATYOUWR in my home_server this working 5* and no problems but in my main server, core crash. Why??? if pc.get_sex() == true and npc.get_sex() == false then npc.purge() end Link to comment Share on other sites More sharing options...
DiabloxPL 0 Posted July 1, 2016 Share Posted July 1, 2016 Nice. Thanks & Work ! Link to comment Share on other sites More sharing options...
tarata12 16 Posted March 18, 2021 Share Posted March 18, 2021 (edited) How do I get the system to change give / player_ban Name, Reason, and time? Error compile: cmd_gm.cpp:4388:7: error: redefinition of 'do_player_ban' ACMD (do_player_ban) ^ cmd_gm.cpp:2758:7: note: previous definition is here ACMD (do_player_ban) ^ cmd_gm.cpp:4450:7: error: redefinition of 'do_player_unban' ACMD (do_player_unban) ^ cmd_gm.cpp:2820:7: note: previous definition is here ACMD (do_player_unban) ^ 2 errors generated. gmake: *** [Makefile:76: debug/cmd_gm.o] Error 1 Edited March 18, 2021 by tarata12 Link to comment Share on other sites More sharing options...
Recommended Posts