Radian Posted July 31, 2014 Group: Members Topic Count: 162 Topics Per Day: 0.04 Content Count: 1546 Reputation: 192 Joined: 07/23/14 Last Seen: Friday at 02:35 AM Share Posted July 31, 2014 Anyone got a working @away command on the latest revision of rAthena? i attempt to test this source code by Cydh, and i cant able to work it well on the latest revision here's the code ( Credits goes to Cydh for releasing this code ) i appreciate any help with this.. Index: conf/msg_athena.conf =================================================================== --- conf/msg_athena.conf (revision 17128) +++ conf/msg_athena.conf (working copy) @@ -1406,5 +1406,11 @@ 1396: You do not have a cart to be cleaned. 1397: Your cart was cleaned. +// @away +1398: Your away message has been removed. +1399: Please, enter at least an option (usage: @away <away message>). +1400: Your away message is active, use @away to disable it. +1401: (away) \"%s\" + //Custom translations import: conf/import/msg_conf.txt Index: src/map/atcommand.c =================================================================== --- src/map/atcommand.c (revision 17128) +++ src/map/atcommand.c (working copy) @@ -8818,6 +8818,39 @@ #undef MC_CART_MDFY } +/*========================================== +* Original code by [Cydh] +* [email protected] +* @away (away massage) +*------------------------------------------*/ +ACMD_FUNC(away) +{ + + char temp_msg[CHAT_SIZE_MAX]; + nullpo_retr(-1, sd); + memset(temp_msg, '\0', sizeof(temp_msg)); + + if (sd->state.away) { + sd->state.away = 0; + sscanf(message, "%0s", sd->state.away_msg); + sprintf(atcmd_output, msg_txt(1398)); // Your away message has been removed. + clif_displaymessage(sd->fd, atcmd_output); + } + else if (!message || !*message || sscanf(message, "%255[^\n]", temp_msg) < 1) { + sprintf(atcmd_output, msg_txt(1399)); // Please, enter at least an option (usage: @away <away message>). + clif_displaymessage(sd->fd, atcmd_output); + return -1; + } + else { + sd->state.away = 1; + sscanf(message, "%255[^\n]", sd->state.away_msg); + sprintf(atcmd_output, msg_txt(1400)); // Your away message is active, use @away to disable it. + clif_displaymessage(sd->fd, atcmd_output); + } + + return 0; +} + /** * Fills the reference of available commands in atcommand DBMap **/ @@ -9078,7 +9111,8 @@ ACMD_DEF2("rmvperm", addperm), ACMD_DEF(unloadnpcfile), ACMD_DEF(cart), - ACMD_DEF(mount2) + ACMD_DEF(mount2), + ACMD_DEF(away) }; AtCommandInfo* atcommand; int i; Index: src/map/clif.c =================================================================== --- src/map/clif.c (revision 17128) +++ src/map/clif.c (working copy) @@ -10062,6 +10062,19 @@ return; } + // if player is @away. [Cydh] + if( dstsd->state.away == 1 ) + { + char output_away[CHAT_SIZE_MAX]; + + clif_wis_end(fd, 0); // 0: success to send wisper + sprintf(output_away, msg_txt(1401), dstsd->state.away_msg); // (away) \"%s\" + clif_wis_message(fd, dstsd->status.name, output_away, strlen(output_away) + 1); // send @away message to sender + clif_wis_message(dstsd->fd, sd->status.name, message, messagelen); // show meesage from sender + return; + } + + // if player is autotrading if( dstsd->state.autotrade == 1 ) { char output[256]; Index: src/map/pc.h =================================================================== --- src/map/pc.h (revision 17128) +++ src/map/pc.h (working copy) @@ -144,6 +144,8 @@ struct guild *gmaster_flag; unsigned int prevend : 1;//used to flag wheather you've spent 40sp to open the vending or not. unsigned int warping : 1;//states whether you're in the middle of a warp processing + unsigned short away : 1; //@away auto message. [Cydh] + char away_msg[CHAT_SIZE_MAX]; //@away auto message. [Cydh] } state; struct { unsigned char no_weapon_damage, no_magic_damage, no_misc_damage; Quote Link to comment Share on other sites More sharing options...
Question
Radian
Anyone got a working @away command on the latest revision of rAthena?
i attempt to test this source code by Cydh, and i cant able to work it well on the latest revision
here's the code ( Credits goes to Cydh for releasing this code ) i appreciate any help with this..
Link to comment
Share on other sites
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.