Emistry Posted November 22, 2011 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: 17 hours ago Share Posted November 22, 2011 erm...since i still too noob in SRC Modification, so i would like to ask some guideline on how to edit this command /*========================================== * @afk * Turns on/off logout on player *------------------------------------------*/ int atcommand_afk(const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); if( map[sd->bl.m].flag.autotrade == battle_config.autotrade_mapflag ) { sd->state.monster_ignore = 0; sd->state.autotrade = 1; if( battle_config.at_timeout ) { int timeout = atoi(message); status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0); } clif_authfail_fd(fd, 15); } else clif_displaymessage(fd, "AFK is not allowed on this map."); return 0; } this is the Origin @AFK Command i get from eA last time, but i was wondering how to make it check on certain flag / cell i can see that in the code there is a autotrade mapflag checking for allow and disallow using it.. but, i would like to modify it / add a check on certain cell / coordinate cant use @AFK by refering to this 2 cell cell_novending 6 cell_nochat 7 Example : if i have an area that already run with either cell_nochat / cell_novending then it will display a message to inform you cant use @AFK at this spot. Quote Link to comment Share on other sites More sharing options...
Conflicts Posted November 22, 2011 Group: Members Topic Count: 14 Topics Per Day: 0.00 Content Count: 317 Reputation: 63 Joined: 11/13/11 Last Seen: March 23 Share Posted November 22, 2011 if( map[sd->bl.m].flag.vending_cell != map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOVENDING) || map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) ) { clif_displaymessage(fd, "You can't use @AFK on this spot."); return -1; } Quote Link to comment Share on other sites More sharing options...
Emistry Posted November 23, 2011 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: 17 hours ago Author Share Posted November 23, 2011 (edited) just some question that i didnt understand very well here ~ if( map[sd->bl.m].flag.vending_cell != map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOVENDING) || map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) ) why we still need to put if( map[sd->bl.m].flag.vending_cell but this part doesnt need in the check CELL_CHKNOCHAT part ? if( map[sd->bl.m].flag.vending_cell ) if do like this it wont be able to work ? if( map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOVENDING) || map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) ) * LOL..the Colour Tag keep mess up my post when i posting....grrr.... O.O * Edited November 23, 2011 by Emistry Quote Link to comment Share on other sites More sharing options...
GodLesZ Posted November 23, 2011 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 186 Reputation: 51 Joined: 11/14/11 Last Seen: January 21, 2015 Share Posted November 23, 2011 but, i would like to modify it / add a check on certain cell / coordinate cant use @AFK by refering to this 2 cell cell_novending 6 cell_nochat 7 Example : if i have an area that already run with either cell_nochat / cell_novending then it will display a message to inform you cant use @AFK at this spot. This is how its done /*========================================== * @afk * Turns on/off logout on player *------------------------------------------*/ ACMD_FUNC(afk) { nullpo_retr(-1, sd); // Map checks if ( map[sd->bl.m].flag.novending // No vending on the whole map || map[sd->bl.m].flag.nochat // No chats on the whole map || map[sd->bl.m].flag.autotrade != battle_config.autotrade_mapflag // Autotrade config dosnt match ) { clif_displaymessage(fd, "AFK is not allowed on this map."); return -1; } // Cell checks if ( map_getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) // No vending on the current cell || map_getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOCHAT) // No chats on the current cell ) { clif_displaymessage(fd, "AFK is not allowed on this spot."); return -1; } // All checks passed sd->state.monster_ignore = 0; sd->state.autotrade = 1; if( battle_config.at_timeout ) { int timeout = atoi(message); status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0); } clif_authfail_fd(fd, 15); return 0; } 1 Quote Link to comment Share on other sites More sharing options...
redge25 Posted May 17, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 30 Reputation: 0 Joined: 04/21/12 Last Seen: June 22, 2012 Share Posted May 17, 2012 its not working on my server >.< i tried 3 kind of @afk commands, but every time i type @afk or @at or @autotrade on my GM account its not working.. my character doesn't AFK.. please i need ur help... thank u in advanced.. hope u see my thread. Quote Link to comment Share on other sites More sharing options...
Question
Emistry
erm...since i still too noob in SRC Modification, so i would like to ask some guideline on how to edit this command
this is the Origin @AFK Command i get from eA last time,
but i was wondering how to make it check on certain flag / cell
i can see that in the code there is a autotrade mapflag checking for allow and disallow using it..
but, i would like to modify it / add a check on
certain cell / coordinate cant use @AFK
by refering to this 2 cell
Example :
if i have an area that already run with either cell_nochat / cell_novending then it will display a message to inform you cant use @AFK at this spot.
Link to comment
Share on other sites
4 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.