AnnieRuru 957 Posted September 10, 2014 (edited) Download: 1.5 plugin create table maintenance ( id int primary key auto_increment, account_id int, name varchar(23), reason varchar(99), minlv2connect tinyint, order_time datetime, start_time datetime, end_time datetime ) engine = innodb; . remember to enable HPMHooking to enable this modification plugins_list: [ /* Enable HPMHooking when plugins in use rely on Hooking */ "HPMHooking", . . Note: sometimes the server countdown jumps 1 second ahead this is normal because the timetick from time->add is unstable so I use unix_time to synchronize the countdown to server time . . so, if you found some script/source code having bugs and you need to shut down your server for a short while then you come to the right place . @maintenance <Group ID can stay 1~99> <duration to kick in minute> <maintenance duration in minute> <reason> then a GM99 can commence the maintenance Example : '@maintenance 40 5 10 need to fix announcer script' every player with group ID 40 and below will be kick after 5 minutes and the server will start counting down by an announcement, during the maintenance of 10 minutes, group ID 40 and below will deny from login into the server `maintenance` table will also generate a new line, with the `reason` field as 'need to fix announcer script' which is useful to know when and how many times you did emergency server shutdown though, the actual reason for using SQL is to persist the data after server shutdown so the server will continue being in maintenance mode despite how many times you have shut down the server until it times up ( `end_time` field ), or manually do `@maintenanceoff` Note: you can't generate a new line using 'INSERT INTO' Sql syntax when server is online because I declare a bunch of variables to for them, for the purpose of saving memory consumption you have to login the game and type `@maintenance` to initiate the maintenance mode, otherwise it wont work. . . . @maintenanceoff if you have already finished fixing the script/source code, and there's still a lot of time left you can type '@maintenanceoff' to immediately turn off the maintenance mode so players can login before the schedule. . . . . -- Script commands -- . *maintenance <Group ID can stay 1~99>, <duration to kick in minute>, <maintenance duration in minute> { , <reason> }; . . actually I have no idea why I wanna make a script command ... maybe just for fun ? . - script jsdfksdj FAKE_NPC,{ OnMon0255: maintenance 40, 5, 60; end; } . this will make an announcement on Monday, 2:55AM that the server will have a regular server maintenance starts from 3AM to 4AM during that time, player with group ID 40 will be kicked and blocked from entering the server the `reason` field in `maintenance` table will be defaulted to '*Regular server maintenance*' . maintenance 40, 5, 60, "系统保养"; this will overwrite the `reason` field in `maintenance` table to '系统保养' instead of regular maintenance . . *maintenanceoff { <reason> }; uhh ... useless I think ... . . *maintenancecheck( <type> ); use 'maintenance()' to check the server is currently in maintenance mode or not return 0 if server is normal return 1 if server is going to have maintenance return 2 if server is having maintenance all other types are meant to myself to debug this junk 1.0 plugin patch 1.1 plugin patch --- change timer reset variable from 0 into INVALID_TIMER (-1) --- fix plugin when GM type '@maintenance' blank, it mentioned group id 0, should be showing the correct syntax --- also change 60-5-1 into 60-10-1 when announcing countdown --- change maintainance into maintenance hahaha, 4 of them 1.2 plugin patch --- initialize all short/inf variable because of st*p*d compiler problem --- change intif-broadcast into intif-broadcast2 to allow changing announcement color 1.3 plugin patch nothing much change other than increase readability --- fix all misleading aaa[255] into output[CHAT_SIZE_MAX] --- move the config value to battle folder for the patch 1.4 plugin - nothing change much, other than fixing to the new format 1.5 plugin - update to latest revision, but nothing else is change Edited October 27, 2020 by AnnieRuru 14 Lanz, Kairedia, caspe and 11 others reacted to this Quote Share this post Link to post Share on other sites
Darkpurple 1 Posted September 10, 2014 (edited) So sexy picture... Can make the patch for rathena user too...?>_< Edited September 10, 2014 by Darkpurple Quote Share this post Link to post Share on other sites
evilpuncker 504 Posted September 11, 2014 thanks a bunch <3 Quote Share this post Link to post Share on other sites
THPO 7 Posted September 11, 2014 You are so kind and awesome AnnieRuru Quote Share this post Link to post Share on other sites
Luffy 14 Posted September 11, 2014 THANK YOU SO MUCH! ANNIERURU FOR GRANTING MY REQUEST!... mwuah mwuah Quote Share this post Link to post Share on other sites
THPO 7 Posted September 11, 2014 (edited) Test it with Windows MSVC no problem., but when I tried with CentOS I get an error return while compiling: Quote CC maintenance.c maintenance.c: In function ‘atcommand_maintenance’: maintenance.c:237: warning: implicit declaration of function ‘aMalloc’ maintenance.c:237: warning: cast to pointer from integer of different size maintenance.c:256: warning: implicit declaration of function ‘aFree’ maintenance.c: In function ‘plugin_init’: maintenance.c:534: error: ‘iMalloc’ undeclared (first use in this function) maintenance.c:534: error: (Each undeclared identifier is reported only once maintenance.c:534: error: for each function it appears in.) make[1]: *** [../../plugins/maintenance.so] Error 1 make[1]: Leaving directory `/home/nix/hercules/src/plugins' make: *** [plugins] Error 2 Ok seems working now with centos I just added on include: Quote #include "../common/malloc.h" with little warnings and could be ignored. Thanks again AnnieRuru. Edited September 11, 2014 by THPO 1 AnnieRuru reacted to this Quote Share this post Link to post Share on other sites
AnnieRuru 957 Posted September 11, 2014 @Darkpurple nope, this modification took me 2 full days to write, very time consuming stuffs go ahead and buy from roserver or cydh ... I don't care seriously, you should consider switch to hercules because I noticed you always follow my posts @THPO fixed in 1.0a 1 ShankS reacted to this Quote Share this post Link to post Share on other sites
Cydh 9 Posted September 11, 2014 (edited) So sexy picture... Can make the patch for rathena user too...?>_< for rAthena, u can do simply trick [*]just do normal announcement "/b I gonna do maintenance bla bla bla" [*]"@kickall" [*]with a little modification on char & login server (see my PR on rA "server:reloadconf" [*]edit the configs that have mean to "only this group level above can login" [*]on your char & login server console, (make sure console:yes for both servers) just go type "server:reloadconf" ehh, the proper sort is 3-1-4-5-2. @Annie instead of use 0 here, u should use INVALID_TIMER (and other lines) + if ( chrif->maintenance_countid > 0 ) {+ timer->delete( chrif->maintenance_countid, chrif->maintenance_countdown );+ chrif->maintenance_countid = 0; + } Edited September 11, 2014 by Cydh 1 AnnieRuru reacted to this Quote Share this post Link to post Share on other sites
AnnieRuru 957 Posted September 11, 2014 (edited) @Annie instead of use 0 here, u should use INVALID_TIMER (and other lines) + if ( chrif->maintenance_countid > 0 ) {+ timer->delete( chrif->maintenance_countid, chrif->maintenance_countdown );+ chrif->maintenance_countid = 0; + } are you sure about this ... there is no problem with plugin with this, as I can initialize the value as -1 at the top of the file but I am not able to change it inside chrif.h with the patch how to reproduce : 1. type @maintenance 1 1 1 aaaaaa 2. immediately @maintenanceoff [Error]: timer_do_delete error : function mismatch 005E9EE4(console_parse_timer) != 005E6E01(unknown timer function) the chrif->maintenance_timerid was defaulted to 0, and INVALID_TIMER is -1 1. how do I initialize the value as -1 ? 2. or maybe I just change != operator into > ...? because all I see the example inside src folder is always ( xxxx != INVALID_TIMER ) LOL I forgot I have execute the timer when server starts so just have to initialize the value inside chrif_connectack function up everything to version 1.1 Edited September 11, 2014 by AnnieRuru Quote Share this post Link to post Share on other sites
Luffy 14 Posted September 11, 2014 i think there's a problem, i tried to @maintenance 99 3 20 Testing Purposes , Everything goes well, the players got kick and i try to login with dual login using normal account (not GM99) , it still can login. Quote Share this post Link to post Share on other sites
AnnieRuru 957 Posted September 11, 2014 i think there's a problem, i tried to @maintenance 99 3 20 Testing Purposes , Everything goes well, the players got kick and i try to login with dual login using normal account (not GM99) , it still can login.can't reproduce, tested with the plugin oneI do the same, KinoRuru not able to login, even with server restart type @who to confirm it is normal player or not or, try with the maintenancecheck() script command to debug type 1 value when maintenance is on - script kjdfksjdf -1,{OnInit: for ( .@i = 0; .@i <= 5; .@i++ ) announce .@i +". "+ maintenancecheck(.@i), 0; end;} Quote Share this post Link to post Share on other sites
Luffy 14 Posted September 11, 2014 Here i tried what you said.also use this - script kjdfksjdf -1,{OnInit: for ( .@i = 0; .@i <= 5; .@i++ ) announce .@i +". "+ maintenancecheck(.@i), 0; end;} what do you think? Quote Share this post Link to post Share on other sites
AnnieRuru 957 Posted September 11, 2014 (edited) try overwrite the pc_authok_pre function with this bool pc_authok_pre( struct map_session_data *sd, int *login_id2, time_t *expiration_time, int *group_id, struct mmo_charstatus *st, bool *changing_mapservers ) { ShowDebug( "unix %dn", time(NULL) ); ShowDebug( "start %dn", maintenance_starttime ); ShowDebug( "end %dn", maintenance_endtime ); ShowDebug( "*group %dn", *group_id ); ShowDebug( "main_group %dn", maintenance_group ); if ( time(NULL) > maintenance_starttime && maintenance_endtime > time(NULL) && *group_id < maintenance_group ) { clif->authfail_fd( sd->fd, 1 ); hookStop(); return false; } return true;}AnnieRuru (GM99) login got this[Debug]: unix 1410468793[Debug]: start 1410468711[Debug]: end 1410498711[Debug]: *group 99[Debug]: main_group 99[Info]: 'AnnieRuru' logged in. (AID/CID: '2000000/150000', IP: '127.0.0.1', Group '99').KinoRuru (GM0) login got this[Debug]: unix 1410468800[Debug]: start 1410468711[Debug]: end 1410498711[Debug]: *group 0[Debug]: main_group 99[Info]: Closed connection from '127.0.0.1'... I got a feeling that your server doesn't hook the function ... Edited September 11, 2014 by AnnieRuru Quote Share this post Link to post Share on other sites
Luffy 14 Posted September 11, 2014 (edited) i got the feeling too.. is this because of my revision is : Last Changed Rev: 14293Last Changed Date: 2014-06-08 got warning on make plugin.maintenance maintenance.c: In function ‘atcommand_maintenance’:maintenance.c:222: warning: ‘group_id’ may be used uninitialized in this functionmaintenance.c:222: warning: ‘kick_duration’ may be used uninitialized in this functionmaintenance.c:222: warning: ‘maintenance_duration’ may be used uninitialized in this functionmaintenance.c:224: warning: ‘weekday’ may be used uninitialized in this functionmaintenance.c:224: warning: ‘hour’ may be used uninitialized in this functionmaintenance.c:224: warning: ‘minute’ may be used uninitialized in this functionmaintenance.c: In function ‘buildin_maintenance’:maintenance.c:401: warning: ‘weekday’ may be used uninitialized in this functionmaintenance.c:401: warning: ‘hour’ may be used uninitialized in this functionmaintenance.c:401: warning: ‘minute’ may be used uninitialized in this functionmaintenance.c: In function ‘server_online’:maintenance.c:145: warning: ‘weekday’ may be used uninitialized in this functionmaintenance.c:145: warning: ‘hour’ may be used uninitialized in this functionmaintenance.c:145: warning: ‘minute’ may be used uninitialized in this function Edited September 11, 2014 by Luffy Quote Share this post Link to post Share on other sites
Darkpurple 1 Posted September 11, 2014 @Darkpurple nope, this modification took me 2 full days to write, very time consuming stuffs go ahead and buy from roserver or cydh ... I don't care seriously, you should consider switch to hercules because I noticed you always follow my posts @THPO fixed in 1.0a Yup, I am one of your super fans Like your script which are all so creative. But I have so many personal COSTUMED SCR MOD (paid) in rathena. If I changed to use hercules, it mean that I need to give up all of them... Quote Share this post Link to post Share on other sites
Luffy 14 Posted September 11, 2014 @annieruru-at my makefile.in When you add a plugin, add its name here: ## Example: if you have a plugin named my_cool_plugin.c and another ## one named my_second_plugin.c, add them to the list like this: ## ## MYPLUGINS = my_cool_plugin my_second_plugin ## ## This is only needed if you want to build your plugin through ## 'make plugins' or 'make all'. If you don't add it to this list, ## you will still be able to build your plugin through ## 'make plugin.my_plugin' ## ## Note: DO NOT include the .c extension!!! #MYPLUGINS = GM_impersonate maintenance plugins.conf plugins_list: [ /* Enable HPMHooking when plugins in use rely on Hooking */ //"HPMHooking", //"db2sql", //"sample", //"other", "GM_impersonate", "maintenance",] Last Changed Rev: 14293Last Changed Date: 2014-06-08 Quote Share this post Link to post Share on other sites
Garr 117 Posted September 11, 2014 /* Enable HPMHooking when plugins in use rely on Hooking */ //"HPMHooking", There's your problem. This plugin uses hooking. 1 AnnieRuru reacted to this Quote Share this post Link to post Share on other sites
THPO 7 Posted September 12, 2014 i think there's a problem, i tried to @maintenance 99 3 20 Testing Purposes , Everything goes well, the players got kick and i try to login with dual login using normal account (not GM99) , it still can login. I just tested with same settings no problem at all. Quote Share this post Link to post Share on other sites
Luffy 14 Posted September 12, 2014 (edited) /* Enable HPMHooking when plugins in use rely on Hooking */ //"HPMHooking", There's your problem. This plugin uses hooking. oh i see, thanks Garr. let me try it :3 Okay its working now, Thank you Garr (y) Edited September 12, 2014 by Luffy Quote Share this post Link to post Share on other sites
Hadeszeus 15 Posted September 12, 2014 Hands down... This is awesome Annie! Quote Share this post Link to post Share on other sites
AnnieRuru 957 Posted September 12, 2014 got warning on make plugin.maintenance maintenance.c: In function ‘atcommand_maintenance’:maintenance.c:222: warning: ‘group_id’ may be used uninitialized in this functionmaintenance.c:222: warning: ‘kick_duration’ may be used uninitialized in this functionmaintenance.c:222: warning: ‘maintenance_duration’ may be used uninitialized in this functionmaintenance.c:224: warning: ‘weekday’ may be used uninitialized in this functionmaintenance.c:224: warning: ‘hour’ may be used uninitialized in this functionmaintenance.c:224: warning: ‘minute’ may be used uninitialized in this functionmaintenance.c: In function ‘buildin_maintenance’:maintenance.c:401: warning: ‘weekday’ may be used uninitialized in this functionmaintenance.c:401: warning: ‘hour’ may be used uninitialized in this functionmaintenance.c:401: warning: ‘minute’ may be used uninitialized in this functionmaintenance.c: In function ‘server_online’:maintenance.c:145: warning: ‘weekday’ may be used uninitialized in this functionmaintenance.c:145: warning: ‘hour’ may be used uninitialized in this functionmaintenance.c:145: warning: ‘minute’ may be used uninitialized in this function do you still have the warning despite its working correctly now ? Quote Share this post Link to post Share on other sites
Cydh 9 Posted September 12, 2014 got warning on make plugin.maintenance maintenance.c: In function ‘atcommand_maintenance’:maintenance.c:222: warning: ‘group_id’ may be used uninitialized in this functionmaintenance.c:222: warning: ‘kick_duration’ may be used uninitialized in this functionmaintenance.c:222: warning: ‘maintenance_duration’ may be used uninitialized in this functionmaintenance.c:224: warning: ‘weekday’ may be used uninitialized in this functionmaintenance.c:224: warning: ‘hour’ may be used uninitialized in this functionmaintenance.c:224: warning: ‘minute’ may be used uninitialized in this functionmaintenance.c: In function ‘buildin_maintenance’:maintenance.c:401: warning: ‘weekday’ may be used uninitialized in this functionmaintenance.c:401: warning: ‘hour’ may be used uninitialized in this functionmaintenance.c:401: warning: ‘minute’ may be used uninitialized in this functionmaintenance.c: In function ‘server_online’:maintenance.c:145: warning: ‘weekday’ may be used uninitialized in this functionmaintenance.c:145: warning: ‘hour’ may be used uninitialized in this functionmaintenance.c:145: warning: ‘minute’ may be used uninitialized in this function do you still have the warning despite its working correctly now ? example for warnings inmaintenance.c: In function ‘server_online’:they're lasting if you don't initialize values of http://upaste.me/51b8e5#LC144.if the checks here http://upaste.me/51b8e5#LC159-172 are fail to, those var aren't initialized and then they're used at http://upaste.me/51b8e5#LC173 Quote Share this post Link to post Share on other sites
Hadeszeus 15 Posted September 12, 2014 (edited) Is this okay? I got this compile warning after patch. script.c: In function 'buildin_maintenance': script.c:18742: warning: 'weekday' may be used uninitialized in this function script.c:18742: warning: 'hour' may be used uninitialized in this function script.c:18742: warning: 'minute' may be used uninitialized in this function Edited September 12, 2014 by Hadeszeus Quote Share this post Link to post Share on other sites
Jedzkie 58 Posted September 12, 2014 Download: 1.1 plugin <-- for those who knows how to install plugin or patch <-- for those who thinks plugin is pain create table maintenance (id int(11) primary key auto_increment,account_id int(11),name varchar(23),reason varchar(99),minlv2connect tinyint(4),order_time datetime,start_time datetime,end_time datetime) engine = innodb;.. Note : sometimes the server countdown jumps 1 second ahead this is normal because the timetick from time->add is unstable, so I use unix_time to synchronize the countdown to server time . so, if you found some script/source code having bugs and you need to shut down your server for a short while this is the source code you need @maintenance <Group ID can stay 1~99> <duration to kick in minute> <maintenance duration in minute> <reason>then a GM99 can commence the maintenance Example : '@maintenance 40 5 10 need to fix announcer script' every player with group ID 40 and below will be kick after 5 minutes and the server will start counting down by an announcement, during the maintenance of 10 minutes, group ID 40 and below will deny from login into the server `maintenance` table will also generate a new line, with the `reason` field as 'need to fix announcer script' which is useful to know when and how many times you did emergency server shutdown though, the actual reason for using SQL is to persist the data after server shutdown so the server will continue being in maintenance mode despite how many times you have shut down the server until the times up ( `end_time` field ), or do @maintenanceoff Note : you can't generate a new line using 'INSERT INTO' Sql syntax when server is on because I declare a bunch of variables to for them, for the purpose of saving memory consumption you have to login the game and type @maintenance to initiate the maintenance mode, otherwise it wont work. . . @maintenanceoffif you have already finished fixing the script/source code, and there's still a lot of time leftyou can type '@maintenanceoff' to immediately turn off the maintenance mode so players can login before the schedule -- Script commands -- *maintenance <Group ID can stay 1~99>, <duration to kick in minute>, <maintenance duration in minute> { , <reason> };actually I have no idea why I wanna make a script command ... maybe just for fun ?. - script jsdfksdj -1,{OnMon0255: maintenance 40, 5, 60; end;}this will make an announcement on Monday, 2:55AM that the server will have a regular server maintenancestarts from 3AM to 4AM during that time, player with group ID 40 will be kicked and blocked from entering the server the `reason` field in `maintenance` table will be defaulted to '*Regular server maintenance*' maintenance 40, 5, 60, "系统保养"; this will overwrite the `reason` field in `maintenance` table to '系统保养' instead of regular maintenance . . *maintenanceoff { <reason> };uhh ... useless I think .... . *maintenancecheck( <type> );use 'maintenance()' to check the server is currently in maintenance mode or notreturn 0 if server is normal return 1 if server is going to have maintenance return 2 if server is having maintenance all other types are meant to myself to debug this junk 1.0 plugin patch 1.1 plugin patch --- change timer reset variable from 0 into INVALID_TIMER (-1) --- fix plugin when GM type '@maintenance' blank, it mentioned group id 0, should be showing the correct syntax --- also change 60-5-1 into 60-10-1 when announcing countdown --- change maintainance into maintenance hahaha, 4 of them Hi annie.. how can i change the announce color? Quote Share this post Link to post Share on other sites