Maintenance mode

/* 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)

 
Last edited by a moderator:
got warning on make plugin.maintenance

Code:
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 ?
 
Last edited by a moderator:
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 in
Code:
maintenance.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

 
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
 
Last edited by a moderator:
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?

 
hi maam got some warning after patch...

Code:
atcommand.c: In function 'atcommand_maintenance':atcommand.c:9403: warning: format '%99[^' expects type 'char *', but argument 6 has type 'char (*)[99]'atcommand.c:9381: warning: 'weekday' may be used uninitialized in this functionatcommand.c:9381: warning: 'hour' may be used uninitialized in this functionatcommand.c:9381: warning: 'minute' may be used uninitialized in this functionchrif.c: In function 'chrif_connectack':chrif.c:511: warning: 'weekday' may be used uninitialized in this functionchrif.c:511: warning: 'hour' may be used uninitialized in this functionchrif.c:511: warning: 'minute' may be used uninitialized in this functionscript.c: In function 'buildin_maintenance':script.c:18851: warning: 'weekday' may be used uninitialized in this functionscript.c:18851: warning: 'hour' may be used uninitialized in this functionscript.c:18851: warning: 'minute' may be used uninitialized in this function
 
so only my compiler so super doesn't throw errors =/ (microsoft visual c++)

it just all short/int has to be initialize

up version 1.2 to initialize all short/int variable

also allows to change announcement color by changing intif->broadcast into intif->broadcast2

btw I broke 1st post ... jabote I share your pain now

version 1.2

patch -> http://upaste.me/1ee741

plugin -> http://upaste.me/84177a

.

.

.

Hi annie.. how can i change the announce color?
search around line 284 in the patch
Code:
chrif->maintenance_color = 0xFFFF00;
change 0xFFFF00 into annie_is_stupid
 
Last edited by a moderator:
so only my compiler so super doesn't throw errors =/ (microsoft visual c++)
Using old gcc that why im always got warning
default_swt3.gif
,

 
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 ?
Its working now, its just that i didnt know we should activate the HPMHooking

,

im using the 1.2

got error on mallow .

just added this on the plugin.

Code:
#include "../common/malloc.h"
 
Last edited by a moderator:
It was stated yesterday that it required HPMHooking, you also said you got it yesterday as well, did you somehow un-add that lol.

At either rate, this plugin is awesome, it works great as intended.

Perhaps the only thing you need to do now Annie, to prevent further repeat issues, is to just make a small notation at the First Post, about needing to enable HPMHooking.

 
i didnt even said that i got it , i didnt even know HPMHooking, since Garr said what the problem..
well problem solve
default_wink.png


Im Very Thankful for Granting my Request to AnnieRuRu <3 <3 <3

 
Last edited by a moderator:
Nice plugin annie! We will surely implement this in our server. Thanks a lot.
default_biggrin.png


 
so only my compiler so super doesn't throw errors =/ (microsoft visual c++)

it just all short/int has to be initialize

up version 1.2 to initialize all short/int variable

also allows to change announcement color by changing intif->broadcast into intif->broadcast2

btw I broke 1st post ... jabote I share your pain now

version 1.2

patch -> http://upaste.me/1ee741

plugin -> http://upaste.me/84177a

.

.

.

Hi annie.. how can i change the announce color?
search around line 284 in the patchchrif->maintenance_color = 0xFFFF00;change 0xFFFF00 into annie_is_stupid

@Annie can you help me why im getting this compile warning?

atcommand.c:9404: warning: format '%99[^
' expects type 'char *', but argument 6 has type 'char (*)[99]'
 
hi AnnieRuru im having errors like this using the plugin:
 
[Error]: HPM:AddHook Fail! 'maintenance' tried to hook to 'pc->authok' but HPMHooking is disabled!
[Error]: HPM:AddHook Fail! 'maintenance' tried to hook to 'clif->pLoadEndAck' but HPMHooking is disabled!
 
how can i enable HPMHooking?
 
Thank you.
 
Last edited by a moderator:
hi AnnieRuru im having errors like this using the plugin:
 
[Error]: HPM:AddHook Fail! 'maintenance' tried to hook to 'pc->authok' but HPMHooking is disabled!
[Error]: HPM:AddHook Fail! 'maintenance' tried to hook to 'clif->pLoadEndAck' but HPMHooking is disabled!
 
how can i enable HPMHooking?
 
Thank you.

Sorry for this, it was there!!! I was not reading briefly:

plugins_list: [
/* Enable HPMHooking when plugins in use rely on Hooking */
"HPMHooking",
//"db2sql",
//"sample",
//"other",
]
 
Hadeszeus, on 15 Sept 2014 - 14:03, said:

@Annie can you help me why im getting this compile warning?

atcommand.c:9404: warning: format '[^

' expects type 'char *', but argument 6 has type 'char (*)[99]'
this is so weird, I just copy paste the syntax from all other atcommand within that filebut how come only mine getting error ?

try replace this line

Code:
char reason[99], esc_reason[198], esc_name[46], min_display[3];
into this
Code:
const char* reason;	char esc_reason[198], esc_name[46], min_display[3];;
didn't test
 
Hadeszeus, on 15 Sept 2014 - 14:03, said:

@Annie can you help me why im getting this compile warning?

atcommand.c:9404: warning: format '[^

' expects type 'char *', but argument 6 has type 'char (*)[99]'
this is so weird, I just copy paste the syntax from all other atcommand within that filebut how come only mine getting error ?

try replace this line

char reason[99], esc_reason[198], esc_name[46], min_display[3];into this
Code:
const char* reason;	char esc_reason[198], esc_name[46], min_display[3];;
didn't test
Annie, same.

Code:
atcommand.c: In function 'atcommand_maintenance':atcommand.c:9403: warning: format '%99[^' expects type 'char *', but argument 6 has type 'const char **'
 
funny ... why your server always give me funny funny error that makes me headache ?

honestly, can you post your ACMD(guild) ... isn't it something like this ?

ACMD(guild){ char guild_name[NAME_LENGTH]; int prev; memset(guild_name, '0', sizeof(guild_name)); if (!message || !*message || sscanf(message, "%23[^n]", guild_name) < 1) { clif->message(fd, msg_txt(1030)); // Please enter a guild name (usage: @guild <guild_name>). return false; }....so either your server doesn't use the same format ...or your server just purposely hates me ???

EDIT:

if this one doesn't work, I'm gonna use the dirty method

char reason[100];

just 99 into 100

 
Last edited by a moderator:
Annie, same.

atcommand.c: In function 'atcommand_maintenance':atcommand.c:9403: warning: format '[^' expects type 'char *', but argument 6 has type 'const char **'
dirty methodhttp://upaste.me/9e3531

can you tell how you compile your server ?

test_server.png

[info]: Compiled with Microsoft Visual C++ 2010 (v1600)

 
Back
Top