antrax16 2 Posted February 16, 2015 Share Posted February 16, 2015 Hi Guys . I need the function of cmd_gm.cpp for ban and unban, I tried with the functions of the source on vanilla but give error at compile . Can you help me someone ? Thanks . Link to comment Share on other sites More sharing options...
Premium Cataclismo 86 Posted February 17, 2015 Premium Share Posted February 17, 2015 This is for ban: For unban I guess you can work around with the ban command and make one. Link to comment Share on other sites More sharing options...
antrax16 2 Posted February 17, 2015 Author Share Posted February 17, 2015 This is for ban: For unban I guess you can work around with the ban command and make one. I tried the function of that topic but i am this eroor . 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...
Premium Cataclismo 86 Posted February 17, 2015 Premium Share Posted February 17, 2015 This is for ban: For unban I guess you can work around with the ban command and make one. I tried the function of that topic but i am this eroor . 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 # cmd_gm.cpp:4446: error: 'pmsg' was not declared in this scope Well, this variable does not exists in the code. So you probably tried another tutorial or you edited it. Also, you did not declared variables arg1, arg2, arg3: char arg1[256], arg2[256], arg3[256]; After AMCD(do_ban) { Link to comment Share on other sites More sharing options...
antrax16 2 Posted February 17, 2015 Author Share Posted February 17, 2015 First eroor is solved thanks Cataclismo but now i am this eroor . cmd_gm.cpp:4487: error: 'pmsg' was not declared in this scope Error occurs here in this function . if(msg.get() && msg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1) Problem is this . pmsg->Get() Link to comment Share on other sites More sharing options...
Premium Cataclismo 86 Posted February 18, 2015 Premium Share Posted February 18, 2015 What you wanna check with this? if(msg.get() && msg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1) You're trying to check if the ban command worked? If yes, use this: if (msg->Get()->uiAffectedRows > 0) ch->ChatPacket(CHAT_TYPE_INFO, "User %s has been blocked.", arg1); else ch->ChatPacket(CHAT_TYPE_INFO, "Command failed."); Also, why?! pmsg->Get()->uiAffectedRows == (uint32_t)-1 Are you trying to check if uiAffectedRows is -1, but you convert -1 to unsigned? WTF! Link to comment Share on other sites More sharing options...
antrax16 2 Posted February 18, 2015 Author Share Posted February 18, 2015 I solved this . I compile game with gcc49 . Link to comment Share on other sites More sharing options...
Ken 904 Posted February 18, 2015 Share Posted February 18, 2015 Also, why?! pmsg->Get()->uiAffectedRows == (uint32_t)-1 Are you trying to check if uiAffectedRows is -1, but you convert -1 to unsigned? WTF! Return Values An integer greater than zero indicates the number of rows affected or retrieved. Zero indicates that no records were updated for an UPDATE statement, no rows matched the WHERE clause in the query or that no query has yet been executed. -1 indicates that the query returned an error or that, for a SELECT query,mysql_affected_rows() was called prior to calling mysql_store_result(). At first read some contents please. Kind Regards Ken ~ TA Do not be sorry, be better. Link to comment Share on other sites More sharing options...
Premium Cataclismo 86 Posted February 19, 2015 Premium Share Posted February 19, 2015 Also, why?! pmsg->Get()->uiAffectedRows == (uint32_t)-1 Are you trying to check if uiAffectedRows is -1, but you convert -1 to unsigned? WTF! Return Values An integer greater than zero indicates the number of rows affected or retrieved. Zero indicates that no records were updated for an UPDATE statement, no rows matched the WHERE clause in the query or that no query has yet been executed. -1 indicates that the query returned an error or that, for a SELECT query,mysql_affected_rows() was called prior to calling mysql_store_result(). At first read some contents please. Kind Regards Ken ~ TA (uint32_t)-1 What's that? 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