· 6 years ago · May 19, 2019, 05:56 AM
1//===== eAthena Script =======================================
2//= GM Activity Log
3//===== By ===================================================
4//= llchrisll
5//===== Version ==============================================
6//= 1.0 - Script Made
7//= Added "Edit GM List" - Part
8// Made some improvements about the Log Timer
9//===== Compatible With ======================================
10//= Every eAthena SVN
11//===== Description ==========================================
12//= This Scripts allows you to log the activity,
13// how many days, weeks, months and years he was online.
14//===== Comments =============================================
15//= None yet.....
16//====== TO/WANNA DO List ==========================================
17//= Giving out presents for reaching a certain Activity Time like
18// for 1 Month = 100m Zeny on legit account or like that
19// maybe in using the activity as a kind of credit
20//= Adding more "Edit" Options for the GM List
21//============================================================
22function script GMLog {
23
24if(getgmlevel() >= 1) {
25 if(gettimetick(2) >= #gm_time && ($gm_logger == 1)) {
26 set @day,0;
27 set @week,0;
28 set @month,0;
29 set @year,0;
30 query_sql "SELECT `acc_id`,`gm_name`,`day`,`week`,`month`,`year` FROM `gm_log` WHERE `acc_id` = '"+getcharid(3)+"'",@acc_id,@gm_name$,@day,@week,@month,@year;
31 if(!@acc_id) {
32 query_sql "INSERT INTO `gm_log` ( `acc_id` , `gm_name` , `day` , `week` , `month` , `year` ) VALUES ( '"+getcharid(3)+"' , '"+escape_sql(strcharinfo(0))+"' , '1' , '0' , '0' , '0' )";
33 set @day,1;
34 set #gm_time,gettimetick(2) + 86400;
35 announce "Your Activity Status has been updated to "+@day+" day(s), "+@week+" week(s), "+@month+" month(s), "+@year+" year(s).",3,0xff0000;
36 sleep2 2000;
37 announce "See ya tomorrow =3.",0,0xff0000;
38 return;
39 }
40 if(@acc_id == getcharid(3) && @gm_name$ != strcharinfo(0)) {
41 query_sql "UPDATE `gm_log` SET `gm_name` = '"+escape_sql(strcharinfo(0))+"' WHERE `acc_id` = '"+getcharid(3)+"'";
42 }
43 set @day,@day + 1;
44 if(@day > 7) {set @day,0; set @week,@week + 1;}
45 if(@week > 4) {set @week,0; set @month,@month + 1;}
46 if(@month > 12) {set @month,0; set @year,@year + 1;}
47 announce "Your Activity Status has been updated to "+@day+" day(s), "+@week+" week(s), "+@month+" month(s), "+@year+" year(s).",3,0xff0000;
48 sleep2 2000;
49 announce "See ya tomorrow =3.",3,0xff0000;
50 query_sql "UPDATE `gm_log` SET `day` = '"+@day+"' WHERE `acc_id` = '"+getcharid(3)+"'";
51 query_sql "UPDATE `gm_log` SET `week` = '"+@week+"' WHERE `acc_id` = '"+getcharid(3)+"'";
52 query_sql "UPDATE `gm_log` SET `month` = '"+@month+"' WHERE `acc_id` = '"+getcharid(3)+"'";
53 query_sql "UPDATE `gm_log` SET `year` = '"+@year+"' WHERE `acc_id` = '"+getcharid(3)+"'";
54 set #gm_time,gettimetick(2) + 86400;
55
56 } else if(!#gm_time && $gm_logger == 1) {
57 query_sql "INSERT INTO `gm_log` ( `acc_id` , `gm_name` , `day` , `week` , `month` , `year` ) VALUES ( '"+getcharid(3)+"' , '"+escape_sql(strcharinfo(0))+"' , '1' , '0' , '0' , '0' )";
58 set #gm_time,gettimetick(2) + 86400;
59
60 } else if(#gm_time > 1 && $gm_logger == 0) {
61 announce "The GM Logging System is momentally offline.",bc_red|bc_self;
62 set #gm_time,1;
63 } else if(#gm_time == 1 && $gm_logger == 1) {
64 announce "The GM Logging System is back online.",bc_red|bc_self;
65 set #gm_time,gettimetick(2) + 86400;
66 }
67}
68return;
69}
70
71sec_in02.gat,136,146,2 script GM Activity Log 833,{
72set .@n$,"[GM Activity Log]";
73
74mes .@n$;
75if(getgmlevel() >= 80) {
76 if($gm_table == 1) {
77 mes "Hello, GM.";
78 mes "What do ya wanna do?";
79 switch(select("- Show Log Entries:- En/Disable the System:- Edit GM List:- Delete MySQL Table")) {
80 case 1:
81 next;
82 cleararray @day[0],0,getarraysize(@day);
83 cleararray @week[0],0,getarraysize(@week);
84 cleararray @month[0],0,getarraysize(@month);
85 cleararray @year[0],0,getarraysize(@year);
86 cleararray @gm_name$[0],"",getarraysize(@gm_name$);
87 cleararray @acc_id[0],0,getarraysize(@acc_id);
88 query_sql "SELECT `gm_name`,`acc_id`,`day`,`week`,`month`,`year` FROM `gm_log` ORDER BY `acc_id` ASC",@gm_name$,@acc_id,@day,@week,@month,@year;
89 mes .@n$;
90 mes "I will list now the Entries:";
91 if(@gm_name$ == "") {
92 mes " ";
93 mes "There are no Entries";
94 mes "in the Log.";
95 close;
96 }
97 for( set @o,0; @o < getarraysize(@acc_id); set @o,@o + 1) {
98 next;
99 mes "^FF0000"+@gm_name$[@o]+"^000000:";
100 mes "-----------------";
101 mes @day[@o]+" Day's";
102 mes @week[@o]+" Week's";
103 mes @month[@o]+" Month's";
104 mes @year[@o]+" Year's";
105 mes "======================";
106 }
107 close;
108
109 case 2:
110 next;
111 mes .@n$;
112 mes "Do you want to";
113 mes (!$gm_logger) ? "enable" : "disable";
114 mes "GM Logging System?";
115 menu "I want to "+((!$gm_logger) ? "^00BB22enable^000000" : "^FF2200disable^000000")+" it.",-,"Nothing",L_quit;
116 next;
117 mes .@n$;
118 if($gm_logger == 0) {
119 mes "I enabled the GM Logging System.";
120 set $gm_logger,1;
121
122 } else if($gm_logger == 1) {
123 mes "I disabled the GM Logging System.";
124 set $gm_logger,0;
125 }
126 close;
127
128 case 3:
129 next;
130 mes .@n$;
131 mes "I will now list the GM's.";
132 cleararray @day[0],0,getarraysize(@day);
133 cleararray @week[0],0,getarraysize(@week);
134 cleararray @month[0],0,getarraysize(@month);
135 cleararray @year[0],0,getarraysize(@year);
136 cleararray @gm_name$[0],"",getarraysize(@gm_name$);
137 cleararray @acc_id[0],0,getarraysize(@acc_id);
138 query_sql "SELECT `gm_name`,`acc_id`,`day`,`week`,`month`,`year` FROM `gm_log` ORDER BY `acc_id` ASC",@gm_name$,@acc_id,@day,@week,@month,@year;
139 mes " ";
140 if(@gm_name$ == "") {
141 mes "There is no GM";
142 mes "in the Log.";
143 mes " ";
144 }
145 set @gm_list$,"- "+@gm_name$[0]+"";
146 mes "^FF0000"+@gm_name$[0]+"^000000:";
147 mes "-----------------";
148 if(@gm_name$[1] != "") {
149 for( set @o,1; @o < getarraysize(@acc_id); set @o,@o + 1) {
150 mes "^FF0000"+@gm_name$[@o]+"^000000:";
151 mes "-----------------";
152 set @gm_list$,@gm_list$ + ":- "+@gm_name$[@o]+"";
153 }
154 }
155 mes "What do you want to do?";
156 next;
157 switch(select("- Add:- Edit:- Remove")) {
158
159 case 1:
160 set @gm_aid,0;
161 set @new_gm$,"";
162 set @gm_lvl,0;
163 mes .@n$;
164 mes "Now type the name of";
165 mes "the GM you want to add.";
166 next;
167 input @new_gm$;
168 mes .@n$;
169 for( set @g,0; @g < getarraysize(@gm_name$); set @g,@g + 1) {
170 if(@new_gm$ == @gm_name$[@g]) { mes "This GM is already in the list."; close; }
171 }
172 query_sql "SELECT `account_id` FROM `char` WHERE `name` = '"+@new_gm$+"'",@gm_aid;
173 if(!@gm_aid) { mes "This character doesn't exists, try again please."; close; }
174 query_sql "SELECT `level` FROM `login` WHERE `account_id` = '"+@gm_aid+"'",@gm_lvl;
175 if(!@gm_lvl) { mes "This isn't a GM, please try again."; close; }
176 query_sql "INSERT INTO `gm_log` ( `acc_id` , `gm_name` , `day` , `week` , `month` , `year` ) VALUES ( '"+@gm_aid+"' , '"+@new_gm$+"' , '1' , '0' , '0' , '0' )";
177 mes "The GM " + @new_gm$;
178 mes "has been added to the Log.";
179 close;
180
181 case 2:
182 mes .@n$;
183 mes "Which GM do you want to edit?";
184 switch(select(@gm_list$)) {
185
186 default:
187 set @l,@menu - 1;
188 break;
189 }
190 next;
191 mes .@n$;
192 mes "You have chosen";
193 mes @gm_name$[@l] + ",";
194 mes "what now?";
195 next;
196 if(select("- Reset Activity Timers:- Nothing") - 1) {
197 close;
198 } else {
199 mes .@n$;
200 mes "The times of the GM";
201 mes @gm_name$[@l] + " has";
202 mes "been reseted.";
203 close2;
204 query_sql "UPDATE `gm_log` SET `day` = '0' WHERE `acc_id` = '"+getcharid(3,@gm_name$[@l])+"'";
205 query_sql "UPDATE `gm_log` SET `week` = '0' WHERE `acc_id` = '"+getcharid(3,@gm_name$[@l])+"'";
206 query_sql "UPDATE `gm_log` SET `month` = '0' WHERE `acc_id` = '"+getcharid(3,@gm_name$[@l])+"'";
207 query_sql "UPDATE `gm_log` SET `year` = '0' WHERE `acc_id` = '"+getcharid(3,@gm_name$[@l])+"'";
208 set #gm_time,0;
209 end;
210 }
211
212 case 3:
213 mes .@n$;
214 mes "Which GM do you want to remove?";
215 switch(select(@gm_list$)) {
216
217 default:
218 set @d,@menu - 1;
219 break;
220 }
221 next;
222 mes "You have chosen " + @gm_name$[@d];
223 mes "Really want to delete this GM";
224 mes "from the Logs?";
225 if(select("- No, stop:- Yes, please") - 1) {
226 mes .@n$;
227 query_sql "DELETE FROM `gm_log` WHERE `gm_name` = '"+escape_sql(@gm_name$[@d])+"'";
228 mes "The GM "+@gm_name$[@d];
229 mes "has been deleted from the Logs.";
230 close;
231 } else {
232 close;
233 }
234 }
235
236 case 4:
237 next;
238 mes .@n$;
239 mes "Do you really want to";
240 mes "delete the MySQL Tables?";
241 menu "Yes, I wanna",-,"No, don't!!!",L_quit;
242
243 next;
244 query_sql "DROP TABLE `gm_log`";
245 set $gm_logger,0;
246 set $gm_table,0;
247 mes .@n$;
248 mes "The MySQL Tables got deleted";
249 mes "and the System automatically";
250 mes "deactivated.";
251 close;
252
253 L_quit:
254 close;
255 }
256
257 } else if(!$gm_table) {
258 mes "There is no Table for the";
259 mes "GM Log System in your";
260 mes "MySQL Database.";
261 menu "Please create one",-,"And now?",L_go;
262 next;
263 query_sql "CREATE TABLE IF NOT EXISTS `gm_log` ( `gm_name` CHAR( 255 ) , `acc_id` INT( 10 ) , `day` INT( 8 ) , `week` INT( 8 ) , `month` INT( 8 ) , `year` INT( 8 ))";
264 set $gm_table,1;
265 set $gm_logger,1;
266 mes .@n$;
267 mes "The Tables were created";
268 mes "and the System automatically";
269 mes "activated.";
270 close;
271
272 L_go:
273 close;
274 }
275
276} else if(getgmlevel() >= 1 && getgmlevel() < 80) {
277 mes "Wanna see your";
278 mes "Online Activity?";
279 if(select("- No, leave:- Yes, please") - 1) {
280 close;
281 } else {
282 query_sql "SELECT `day`,`week`,`month`,`year` FROM `gm_log` WHERE `acc_id` == '"+getcharid(3)+"'",@day,@week,@month,@year;
283 if(!(@day && @week && @month && @year)) {
284 next;
285 mes "I'm sorry, but";
286 mes "there isn't";
287 mes "any Log of you.";
288 close;
289 }
290 mes " ";
291 mes @day+" Day's";
292 mes @week+" Week's";
293 mes @month+" Month's";
294 mes @year+" Year's";
295 close;
296 }
297} else {
298 mes "I'm sorry, but";
299 mes "I can't help you.";
300 close;
301}
302}