Jump to content
  • 0

Modify @AFK


Emistry

Question


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

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.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  317
  • Reputation:   63
  • Joined:  11/13/11
  • Last Seen:  

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;
   }

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

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 by Emistry
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  186
  • Reputation:   51
  • Joined:  11/14/11
  • Last Seen:  

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 /oh

/*==========================================
* @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;
}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  30
  • Reputation:   0
  • Joined:  04/21/12
  • Last Seen:  

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...