Jump to content
  • 0

doubt command


Question

Posted (edited)

How do I use this command with all of it is being applied only on the map.

ACMD_FUNC(maintenance) {
nullpo_retr(-1, sd);[/font][/color]
if (message && *message) {
 if(strcmpi(message, "on") == 0) {
  if(runflag == MAPSERVER_ST_MAINTENANCE) {
clif_displaymessage(fd, "Server already in maintenance");
  } else {
struct map_session_data* pl_sd;
struct s_mapiterator* iter;[/font][/color]
iter = mapit_getallusers();
for (pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter)) {
 if (pc_get_group_level(pl_sd) != 99) { // Only Admin(99) that will stay in maintenance
  clif_GM_kick(NULL, pl_sd);
 }
}
mapit_free(iter);[/font][/color]
runflag = MAPSERVER_ST_MAINTENANCE; //Activate maintenance, disable all player except Admin to login
chrif_maintenis(MAPSERVER_ST_MAINTENANCE);
//ShowInfo("Maintenance: Onn");
clif_displaymessage(fd, "Maintenance: On");
  }
 } else if(strcmpi(message, "off") == 0) {
  if(runflag == MAPSERVER_ST_MAINTENANCE) {
runflag = MAPSERVER_ST_RUNNING; //Deactivate maintenance
chrif_maintenis(MAPSERVER_ST_RUNNING);
//ShowInfo("Maintenance: Offn");
clif_displaymessage(fd, "Maintenance: Off");
  } else {
clif_displaymessage(fd, "Server is not in maintenance");
  }
 } else {
  clif_displaymessage(fd, "Usage: @maintenance <on|off>");
  return -1;
 }
} else {
 clif_displaymessage(fd, "Usage: @maintenance <on|off>");
 return -1;
}
}

Edited by Emistry
Codeboxed Content

4 answers to this question

Recommended Posts

Posted

Doesn't seem like this preven connection on map but to whole server, do you want i to execute it on one map so people can't go there while in maintenance ?

If yes I'd put a new mapflag (maintenance) and prevent warping here in pc_set_pos or function similar, then you could still insert a check if someone manage to get in this map to get kicked or warped somewhere else.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...