Premium Sanchez 2465 Posted July 5, 2014 Author Premium Share Posted July 5, 2014 "UPDATE account.account SET status = 'BLOCK', availDt = FROM_UNIXTIME(UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) + %i), reason = '%s' WHERE id = '%d'" Try this. 2 Link to comment Share on other sites More sharing options...
Avalonking 0 Posted July 9, 2014 Share Posted July 9, 2014 Sorry but i have game 34k, where is "Now open game/cmd.cpp" ?? Link to comment Share on other sites More sharing options...
Great 16 Posted July 18, 2014 Share Posted July 18, 2014 fo reason with spaces use std::string line(argument); reason = line.substr(line.find(arg2) + 2).c_str(); works:) 1 Link to comment Share on other sites More sharing options...
Lehel 14 Posted August 31, 2014 Share Posted August 31, 2014 Sorry but i have game 34k, where is "Now open game/cmd.cpp" ?? I think you can't do that,because the metin2source is 40k . Link to comment Share on other sites More sharing options...
Saud bin abdullah 7 Posted September 3, 2014 Share Posted September 3, 2014 awesome !! Link to comment Share on other sites More sharing options...
Premium MrLibya 554 Posted November 12, 2014 Premium Share Posted November 12, 2014 Nice , Thx But Why You Use AvailDt ? Why You Not Make It Change The State To " BLOCK " ? If you're going to do something, then do it right. Link to comment Share on other sites More sharing options...
Premium Sanchez 2465 Posted November 12, 2014 Author Premium Share Posted November 12, 2014 Because then the player will be banned for forever. Link to comment Share on other sites More sharing options...
Premium MrLibya 554 Posted November 12, 2014 Premium Share Posted November 12, 2014 Can't Make Timer For It ? If you're going to do something, then do it right. Link to comment Share on other sites More sharing options...
Denis 1474 Posted November 12, 2014 Share Posted November 12, 2014 Why?There is already availdt to do that... Link to comment Share on other sites More sharing options...
Premium MrLibya 554 Posted November 12, 2014 Premium Share Posted November 12, 2014 I Know . But I Was Just Asking ! If you're going to do something, then do it right. Link to comment Share on other sites More sharing options...
Damixxx0101 6 Posted January 9, 2015 Share Posted January 9, 2015 ACMD(do_ban) Now time to add the complete code to ACMD(do_ban): ? // Args char arg1[256], arg2[256], arg3[256]; // Local variables const char* szName; const char* szReason; int iDuration; one_argument(two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)), arg3, sizeof(arg3)); // Invalid syntax if (!*arg1 || !*arg2 || !*arg3) { ch->ChatPacket(CHAT_TYPE_INFO, "Invalid Syntax, usage: <player name> <time in hours> <reason> tip: don't use spaces in the reason, use _"); return; } szName = arg1; iDuration = atoi(arg2); szReason = arg3; if (iDuration <= 0) { ch->ChatPacket(CHAT_TYPE_INFO, "Duration can't be 0 or minus."); return; } LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(szName); if (!tch) { ch->ChatPacket(CHAT_TYPE_INFO, "%s is not playing", szName); return; } if (!tch->GetDesc()) { ch->ChatPacket(CHAT_TYPE_INFO, "%s don't have desc", szName); return; } if (tch == ch) { ch->ChatPacket(CHAT_TYPE_INFO, "What's wrong with you? Don't ban yourself"); return; } if (tch->GetGMLevel() > GM_PLAYER) { ch->ChatPacket(CHAT_TYPE_INFO, "Do not ban GMs"); return; } std::auto_ptr<SQLMsg> msg(DBManager::instance().DirectQuery("UPDATE account.account SET availDt = FROM_UNIXTIME(UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) + %i), reason = '%s' WHERE id = %d", iDuration * 3600, szReason, tch->GetDesc()->GetAccountTable().id)); tch->GetDesc()->DelayedDisconnect(5); sys_log(0, "%s[%d] banned %s for %i hours with reason: %s", ch->GetName(), ch->GetPlayerID(), szName, iDuration, szReason); ch->ChatPacket(CHAT_TYPE_INFO, "%s has been banned for %i hours with reason: %s", szName, iDuration, szReason); not work for me spam fully error i have tab please give me this file cpp i look where is i create wrong Link to comment Share on other sites More sharing options...
antrax16 2 Posted February 16, 2015 Share Posted February 16, 2015 Not work for me this function i am eroor to compile . What is problem . Link to comment Share on other sites More sharing options...
Ken 904 Posted February 16, 2015 Share Posted February 16, 2015 (edited) ACMD(do_ban) { char szName[CHARACTER_NAME_MAX_LEN + 1]; char szReason[512]; int iDuration; one_argument(two_arguments(argument,szName,sizeof(szName),szReason,sizeof(szReason)),iDuration,sizeof(iDuration)); // Invalid syntax if (!*arg1 || !*arg2 || !*arg3) { ch->ChatPacket(CHAT_TYPE_INFO, "Invalid Syntax, usage: <player name> <time in hours> <reason> tip: don't use spaces in the reason, use _"); return; } str_to_number(iDuration,arg2); if (iDuration <= 0) { ch->ChatPacket(CHAT_TYPE_INFO, "Duration can't be 0 or minus."); return; } LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(szName); if (!tch->GetDesc()) { ch->ChatPacket(CHAT_TYPE_INFO, "%s don't have desc", szName); return; } if (tch == ch) { ch->ChatPacket(CHAT_TYPE_INFO, "What's wrong with you? Don't ban yourself"); return; } if (tch->GetGMLevel() > GM_HIGH_WIZARD) { ch->ChatPacket(CHAT_TYPE_INFO, "Do not ban GMs"); return; } std::auto_ptr<SQLMsg> msg(DBManager::instance().DirectQuery("UPDATE account.account SET availDt = FROM_UNIXTIME(UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) + %d), reason = '%s' WHERE id = %u", iDuration * 3600, szReason, tch->GetDesc()->GetAccountTable().id)); if(msg.get() && msg->Get()->uiAffectedRows == 0 || msg->Get()->uiAffectedRows == (uint32_t)-1) { ch->ChatPacket(CHAT_TYPE_INFO,"do_ban failed : can not modify account table"); return; } tch->GetDesc()->DelayedDisconnect(5); sys_log(0, "%s[%u] banned %s for %d hours with reason: %s", ch->GetName(), ch->GetPlayerID(), szName, iDuration, szReason); ch->ChatPacket(CHAT_TYPE_INFO, "%s has been banned for %d hours with reason: %s", szName, iDuration, szReason); } 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...
Lyrex 6 Posted February 16, 2015 Share Posted February 16, 2015 Why are you guys still using std::auto_ptr? It's old, deprecated and unsafe. Just use sse std::unique_ptr instead. Link to comment Share on other sites More sharing options...
Premium Galet 510 Posted February 17, 2015 Premium Share Posted February 17, 2015 unique_ptr is used for gcc48+ I guess. However it's use it Link to comment Share on other sites More sharing options...
antrax16 2 Posted February 17, 2015 Share Posted February 17, 2015 ACMD(do_ban) { char szName[CHARACTER_NAME_MAX_LEN + 1]; char szReason[512]; int iDuration; one_argument(two_arguments(argument,arg1,sizeof(arg1),arg2,sizeof(arg2)),arg3,sizeof(arg3)); // Invalid syntax if (!*arg1 || !*arg2 || !*arg3) { ch->ChatPacket(CHAT_TYPE_INFO, "Invalid Syntax, usage: <player name> <time in hours> <reason> tip: don't use spaces in the reason, use _"); return; } str_to_number(iDuration,arg2); if (iDuration <= 0) { ch->ChatPacket(CHAT_TYPE_INFO, "Duration can't be 0 or minus."); return; } LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(szName); if (!tch->GetDesc()) { ch->ChatPacket(CHAT_TYPE_INFO, "%s don't have desc", szName); return; } if (tch == ch) { ch->ChatPacket(CHAT_TYPE_INFO, "What's wrong with you? Don't ban yourself"); return; } if (tch->GetGMLevel() > GM_HIGH_WIZARD) { ch->ChatPacket(CHAT_TYPE_INFO, "Do not ban GMs"); return; } std::auto_ptr<SQLMsg> msg(DBManager::instance().DirectQuery("UPDATE account.account SET availDt = FROM_UNIXTIME(UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) + %d), reason = '%s' WHERE id = %u", iDuration * 3600, szReason, tch->GetDesc()->GetAccountTable().id)); if(msg.get() && msg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1) { ch->ChatPacket(CHAT_TYPE_INFO,"do_ban failed : can not modify account table"); return; } tch->GetDesc()->DelayedDisconnect(5); sys_log(0, "%s[%u] banned %s for %d hours with reason: %s", ch->GetName(), ch->GetPlayerID(), szName, iDuration, szReason); ch->ChatPacket(CHAT_TYPE_INFO, "%s has been banned for %d hours with reason: %s", szName, iDuration, szReason); } Kind Regards Ken ~ TA I add this code but . cmd_gm.cpp: In function 'void do_ban(CHARACTER*, const char*, int, int)': cmd_gm.cpp:4407: error: 'arg1' was not declared in this scope cmd_gm.cpp:4407: error: 'arg2' was not declared in this scope cmd_gm.cpp:4407: error: 'arg3' was not declared in this scope cmd_gm.cpp:4446: error: 'pmsg' was not declared in this scope Makefile:119: recipe for target 'OBJDIR/cmd_gm.o' failed gmake: *** [OBJDIR/cmd_gm.o] Error 1 root@metin2:/usr/src/Server/game/src # Link to comment Share on other sites More sharing options...
Ken 904 Posted February 17, 2015 Share Posted February 17, 2015 Sorry. Post is updated again. Kind Regards Ken ~ TA Do not be sorry, be better. Link to comment Share on other sites More sharing options...
Ken 904 Posted February 17, 2015 Share Posted February 17, 2015 (edited) Why are you guys still using std::auto_ptr? It's old, deprecated and unsafe. Just use sse std::unique_ptr instead. GCC 4.2 is not support that. As galet said. If you wanna use that, you can use it. Meanwhile new command for gcc 4.8+ ACMD(do_ban) { char szName[CHARACTER_NAME_MAX_LEN + 1]; char szReason[512]; int iDuration; one_argument(two_arguments(argument,szName,sizeof(szName),szReason,sizeof(szReason)),iDuration,sizeof(iDuration)); // Invalid syntax if (!*arg1 || !*arg2 || !*arg3) { ch->ChatPacket(CHAT_TYPE_INFO, "Invalid Syntax, usage: <player name> <time in hours> <reason> tip: don't use spaces in the reason, use _"); return; } str_to_number(iDuration,arg2); if (iDuration <= 0) { ch->ChatPacket(CHAT_TYPE_INFO, "Duration can't be 0 or minus."); return; } LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(szName); if (!tch->GetDesc()) { ch->ChatPacket(CHAT_TYPE_INFO, "%s don't have desc", szName); return; } if (tch == ch) { ch->ChatPacket(CHAT_TYPE_INFO, "What's wrong with you? Don't ban yourself"); return; } if (tch->GetGMLevel() > GM_HIGH_WIZARD) { ch->ChatPacket(CHAT_TYPE_INFO, "Do not ban GMs"); return; } std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery("UPDATE account.account SET availDt = FROM_UNIXTIME(UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) + %d), reason = '%s' WHERE id = %u", iDuration * 3600, szReason, tch->GetDesc()->GetAccountTable().id)); if(msg.get() && msg->Get()->uiAffectedRows == 0 || msg->Get()->uiAffectedRows == (uint32_t)-1) { ch->ChatPacket(CHAT_TYPE_INFO,"do_ban failed : can not modify account table"); return; } tch->GetDesc()->DelayedDisconnect(5); sys_log(0, "%s[%u] banned %s for %d hours with reason: %s", ch->GetName(), ch->GetPlayerID(), szName, iDuration, szReason); ch->ChatPacket(CHAT_TYPE_INFO, "%s has been banned for %d hours with reason: %s", szName, iDuration, szReason); } Kind Regards Ken ~ TA Edited February 17, 2015 by Ken 2 Do not be sorry, be better. Link to comment Share on other sites More sharing options...
Shichirojii 8 Posted February 17, 2015 Share Posted February 17, 2015 edit Link to comment Share on other sites More sharing options...
Ken 904 Posted February 17, 2015 Share Posted February 17, 2015 edit You are removed me and you are say many thing. I can change my nickname and that's too normal. But i am so sorry for you. You are bought this from me also my customer is bought this from me but him system working perfectly what ever #edit Kind Regards Ken ~ TA Do not be sorry, be better. Link to comment Share on other sites More sharing options...
Damixxx0101 6 Posted March 18, 2015 Share Posted March 18, 2015 compile cmd_gm.cpp cmd_gm.cpp: In function 'void do_ban(CHARACTER*, const char*, int, int)': cmd_gm.cpp:2816: error: only constructors take base initializers cmd_gm.cpp:2818: error: expected identifier before 'char' cmd_gm.cpp:2818: error: expected `(' before 'char' cmd_gm.cpp:2818: error: expected `{' before 'char' cmd_gm.cpp: At global scope: cmd_gm.cpp:2825: error: expected constructor, destructor, or type conversion before '(' token cmd_gm.cpp:2828: error: expected unqualified-id before 'if' cmd_gm.cpp:2834: error: expected constructor, destructor, or type conversion before '=' token cmd_gm.cpp:2835: error: expected constructor, destructor, or type conversion before '=' token cmd_gm.cpp:2836: error: expected constructor, destructor, or type conversion before '=' token cmd_gm.cpp:2838: error: expected unqualified-id before 'if' cmd_gm.cpp:2846: error: expected unqualified-id before 'if' cmd_gm.cpp:2852: error: expected unqualified-id before 'if' cmd_gm.cpp:2858: error: expected unqualified-id before 'if' cmd_gm.cpp:2864: error: expected unqualified-id before 'if' cmd_gm.cpp:2872: error: expected constructor, destructor, or type conversion before '->' token cmd_gm.cpp:2874: error: expected constructor, destructor, or type conversion before '(' token cmd_gm.cpp:2876: error: expected constructor, destructor, or type conversion before '->' token cmd_gm.cpp: In function 'void do_set_stat(CHARACTER*, const char*, int, int)': cmd_gm.cpp:3997: warning: NULL used in arithmetic gmake: *** [OBJDIR/cmd_gm.o] Error 1 root@Damian:/usr/src/Source/main/Srcs/Server/game/src # Link to comment Share on other sites More sharing options...
Former Staff flygun 304 Posted March 18, 2015 Former Staff Share Posted March 18, 2015 Thanks.... i really enjoy reading your topics because you explain every detail Link to comment Share on other sites More sharing options...
Premium Galet 510 Posted March 18, 2015 Premium Share Posted March 18, 2015 Thanks Ken, but "However it's use it" (I don't know why I told this, it's a nonsense) Link to comment Share on other sites More sharing options...
JarajTo 40 Posted June 22, 2015 Share Posted June 22, 2015 How to perm ban? Link to comment Share on other sites More sharing options...
Cyclone_DE 9 Posted June 30, 2015 Share Posted June 30, 2015 How to perm ban? Just change the "status" of the account to BLOCK and it will banned for ever, i dont know to make it ingame, if that is what you mean! Link to comment Share on other sites More sharing options...
Recommended Posts