Advertisement
Guest User

Untitled

a guest
Apr 4th, 2011
1,226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.81 KB | None | 0 0
  1. //===== eAthena Script =======================================
  2. //= Itemizer
  3. //===== By: ==================================================
  4. //= Latheesan (HeliosRO Server Admin) (C) 2009 HeliosRO.Com
  5. //===== Current Version: =====================================
  6. //= 1.5
  7. //===== Compatible With: =====================================
  8. //= Any SQL eAthena Version
  9. //===== Description: =========================================
  10. //= To prevent GM Corruption, you can disable all item related
  11. //= commands and use this NPC to distribute Items and/or KCP.
  12. //===== Additional Comments: =================================
  13. //= v1.0 - Initial Release (Report Bugs On eAthena Board)
  14. //= v1.1 - Fixed A Few Typo In Script
  15. //= v1.2 - Fixed GM Detection Bug and Cleaned Up The Code
  16. //= v1.3 - Added User Menu In GM Menu
  17. //= v1.4 - Added New @check_online and @notify_player Config
  18. //= v1.5 - Added Announce Feature and code optimized
  19. //============================================================
  20.  
  21. //===== SQL Table ============================================
  22. //= Execute This Query On Your Ragnarok Database Prior To Use.
  23. //=
  24. //CREATE TABLE IF NOT EXISTS `itemizer` (
  25. // `id` int(11) unsigned NOT NULL auto_increment,
  26. // `item_id` int(11) NOT NULL,
  27. // `item_amount` int(11) NOT NULL,
  28. // `item_name` varchar(255) NOT NULL,
  29. // `char_id` int(11) NOT NULL,
  30. // `char_name` varchar(255) NOT NULL,
  31. // `reason` varchar(255) NOT NULL,
  32. // `by_gm` varchar(255) NOT NULL,
  33. // `when` datetime NOT NULL,
  34. // `for` varchar(255) NOT NULL,
  35. // `collected` tinyint(1) NOT NULL,
  36. // PRIMARY KEY (`id`)
  37. //) ENGINE=MyISAM ;
  38.  
  39. //
  40. // Script Interface For Event Prize NPC
  41. //
  42. prt_vilg01,124,120,4 script Itemizer 906,{
  43.  
  44. // Script Config
  45. set @npc$,"^008000[ Itemizer ]^000000"; // NPC Name
  46.  
  47. // Advance Script Config
  48. set @dummy_kcp_id,123; // Dummy Item ID Used To Identify If Collection Item == KCP
  49. set @check_weight,1; // 1 == Yes | 0 == No (Check If Player Is Over Weight)
  50. set @min_gm_lvl,60; // Minimum GM Level Required To "Make Item"
  51. set @min_eventgm_lvl,60; // Minimum GM Level Required To "Give Item" and "Give KCP"
  52. set @min_item_amount,1; // Minimum Item Amount
  53. set @max_item_amount,1000; // Maximum Item Amount
  54. set @min_kcp_amount,1; // Minimum KCP Amount
  55. set @max_kcp_amount,10; // Maximum KCP Amount
  56. set @check_online,1; // Check If Target Player Is Online Before Giving Item
  57. set @notify_player,1; // 1 == Yes | 0 == No (Notify Player When GM Gives Them Item)
  58. set @allow_announce,1; // 1 == Yes | 0 == No (Let GM Choose If He/She Wants To Announce)
  59. setarray @announce_loc$, // Possible Announce Locations
  60. "bc_all",
  61. "bc_map",
  62. "bc_area";
  63.  
  64. // Main Script
  65. L_Main:
  66. mes @npc$;
  67. mes " ";
  68. if (getgmlevel() > @min_gm_lvl)
  69. {
  70. mes "Hello GM "+ strcharinfo(0) +".";
  71. mes " ";
  72. mes "What would you like today?";
  73. switch(select("Make Item","Give Item","Give KCP","Player Menu","Nothing"))
  74. {
  75. // Make Item
  76. case 1: goto L_EP_MakeItem; break;
  77.  
  78. // Give Item
  79. case 2: goto L_EP_GiveItem; break;
  80.  
  81. // Give KCP
  82. case 3: goto L_EP_GiveKCP; break;
  83.  
  84. // Player Menu
  85. case 4: goto L_EP_Collect; break;
  86.  
  87. // Nothing
  88. default: close; break;
  89. }
  90. }
  91. else
  92. {
  93. mes "Hello, what would you like today?";
  94. switch(select("Collect Event Prize","Collection Log","Nothing"))
  95. {
  96. // Collect Event Prize
  97. case 1: goto L_EP_Collect; break;
  98.  
  99. // Collection Log
  100. case 2: goto L_EP_CLog; break;
  101.  
  102. // Nothing
  103. default: close; break;
  104. }
  105. }
  106.  
  107. // Make Item [GM]
  108. L_EP_MakeItem:
  109. next;
  110. mes @npc$;
  111. mes " ";
  112. mes "What item would you like?";
  113. mes "Enter the ID.";
  114. input @ep_item_id;
  115. next;
  116. if (getitemname(@ep_item_id) == "" || getitemname(@ep_item_id) == "null")
  117. {
  118. mes @npc$;
  119. mes " ";
  120. mes "^CC0000Sorry, "+ @ep_item_id +" is an invalid item ID.^000000";
  121. close;
  122. }
  123. mes @npc$;
  124. mes " ";
  125. mes "Okay, how many "+ getitemname(@ep_item_id) +" do you want?";
  126. mes " ";
  127. mes "Min "+ @min_item_amount +" and Max "+ @max_item_amount +".";
  128. input @ep_item_count;
  129. next;
  130. if (@ep_item_count < @min_item_amount || @ep_item_count > @max_item_amount)
  131. {
  132. mes @npc$;
  133. mes " ";
  134. mes "^CC0000Sorry, "+ @ep_item_count +" is an invalid amount.";
  135. mes " ";
  136. mes "Min "+ @min_item_amount +" and Max "+ @max_item_amount +".^000000";
  137. close;
  138. }
  139. if (@check_weight && checkweight(@ep_item_id, @ep_item_count) == 0)
  140. {
  141. mes @npc$;
  142. mes " ";
  143. mes "^CC0000Sorry, you cannot hold "+ @ep_item_count +"x "+ getitemname(@ep_item_id) +".";
  144. mes " ";
  145. mes "Your inventory is full.^000000";
  146. close;
  147. }
  148. set @when$,callfunc("makeTimestamp");
  149. set @nb,query_sql("INSERT INTO `itemizer` VALUES(NULL,'"+ escape_sql(@ep_item_id) +"','"+ escape_sql(@ep_item_count) +"','"+ escape_sql(getitemname(@ep_item_id)) +"','"+ escape_sql(getcharid(0)) +"','"+ escape_sql(strcharinfo(0)) +"','N/A','[GM] "+ escape_sql(strcharinfo(0)) +"','"+ escape_sql(@when$) +"','gm','1')");
  150. getitem @ep_item_id,@ep_item_count;
  151. mes @npc$;
  152. mes " ";
  153. mes "All done ~";
  154. close;
  155.  
  156. // Give Item [GM]
  157. L_EP_GiveItem:
  158. next;
  159. mes @npc$;
  160. mes " ";
  161. if (getgmlevel() < @min_eventgm_lvl)
  162. {
  163. mes "^CC0000Access Denied!";
  164. mes " ";
  165. mes "You must be atleast level "+ @min_eventgm_lvl +" GM.^000000";
  166. close;
  167. }
  168. mes "Enter the ID of the Item you would like to give a player.";
  169. mes " ";
  170. mes "E.g. ^0000FFID 512^000000 == ^008000Apple^000000";
  171. input @ep_item_id;
  172. next;
  173. if (getitemname(@ep_item_id) == "" || getitemname(@ep_item_id) == "null")
  174. {
  175. mes @npc$;
  176. mes " ";
  177. mes "^CC0000Sorry, "+ @ep_item_id +" is an invalid item ID.^000000";
  178. close;
  179. }
  180. mes @npc$;
  181. mes " ";
  182. mes "Okay, how many "+ getitemname(@ep_item_id) +" do you want to give a player?";
  183. mes " ";
  184. mes "Min "+ @min_item_amount +" and Max "+ @max_item_amount +".";
  185. input @ep_item_count;
  186. next;
  187. if (@ep_item_count < @min_item_amount || @ep_item_count > @max_item_amount)
  188. {
  189. mes @npc$;
  190. mes " ";
  191. mes "^CC0000Sorry, "+ @ep_item_count +" is an invalid amount.";
  192. mes " ";
  193. mes "Min "+ @min_item_amount +" and Max "+ @max_item_amount +".^000000";
  194. close;
  195. }
  196. mes @npc$;
  197. mes " ";
  198. mes "Okay, who do you want to give "+ @ep_item_count +"x "+ getitemname(@ep_item_id) +"?";
  199. mes " ";
  200. mes "Enter player name"+ (@check_online ? " (must be online)." : " .");
  201. input @ep_char_name$;
  202. next;
  203. set @ep_char_id,getcharid(0,@ep_char_name$);
  204. if (@check_online && !isloggedin(getcharid(3,@ep_char_name$)))
  205. {
  206. mes @npc$;
  207. mes " ";
  208. mes "^CC0000Sorry, "+ @ep_char_name$ +" is invalid.";
  209. mes " ";
  210. mes "This player either doesn't exist or s/he is not online now.^000000";
  211. close;
  212. }
  213. mes @npc$;
  214. mes " ";
  215. mes "Now, enter the reason for giving "+ @ep_item_count +"x "+ getitemname(@ep_item_id) +" to "+ @ep_char_name$ +".";
  216. input @ep_reason$;
  217. next;
  218. if (@ep_reason$ == "")
  219. {
  220. mes @npc$;
  221. mes " ";
  222. mes "^CC0000Sorry, that is not a valid reason.^000000";
  223. close;
  224. }
  225. if (@allow_announce)
  226. {
  227. mes @npc$;
  228. mes " ";
  229. mes "Do you want to announce the following message?";
  230. mes " ";
  231. set @anounce_msg$,"[GM] "+ strcharinfo(0) +" Gave "+ @ep_item_count +"x "+ getitemname(@ep_item_id) +" to "+ @ep_char_name$ +". Reason - "+ @ep_reason$;
  232. mes @anounce_msg$;
  233. if (select("Yes:No") == 1) { set @do_announce,1; } else { set @do_announce,0; }
  234. next;
  235. if (@do_announce)
  236. {
  237. mes @npc$;
  238. mes " ";
  239. mes "Where would you like to announce this message?";
  240. mes " ";
  241. mes @anounce_msg$;
  242. set @options$,"";
  243. for (set @i,0; @i < getarraysize(@announce_loc$); set @i,@i+1)
  244. {
  245. if (@announce_loc$[@i] == "bc_all") {
  246. set @options$,@options$+"Server Wide";
  247. } else if (@announce_loc$[@i] == "bc_map") {
  248. set @options$,@options$+"Everyone In The Same Map";
  249. } else if (@announce_loc$[@i] == "bc_area") {
  250. set @options$,@options$+"Everyone Near You";
  251. }
  252. if (@i != (getarraysize(@announce_loc$) - 1)) { set @options$,@options$+":"; }
  253. }
  254. set @choice,select(@options$);
  255. set @a_loc$,@announce_loc$[@choice];
  256. next;
  257. mes @npc$;
  258. mes " ";
  259. mes "What color do you want to announce in?";
  260. if (select("Yello:Blue") == 1) { set @a_color$,"bc_yellow"; } else { set @a_color$,"bc_blue"; }
  261. next;
  262. }
  263. }
  264. mes @npc$;
  265. mes " ";
  266. mes "Is this correct?";
  267. mes " ";
  268. mes "Give ^0000FF"+ @ep_item_count +"x^000000 ^008000"+ getitemname(@ep_item_id) +"^000000 to ^CC0000"+ @ep_char_name$ +"^000000.";
  269. mes " ";
  270. mes "Reason : "+ @ep_reason$;
  271. if (select("Yes:No") == 1)
  272. {
  273. next;
  274. set @when$,callfunc("makeTimestamp");
  275. set @nb,query_sql("INSERT INTO `itemizer` VALUES(NULL,'"+ escape_sql(@ep_item_id) +"','"+ escape_sql(@ep_item_count) +"','"+ escape_sql(getitemname(@ep_item_id)) +"','"+ escape_sql(@ep_char_id) +"','"+ escape_sql(@ep_char_name$) +"','"+ escape_sql(@ep_reason$) +"','[GM] "+ escape_sql(strcharinfo(0)) +"','"+ escape_sql(@when$) +"','player','0')");
  276. mes @npc$;
  277. mes " ";
  278. mes "All Done~";
  279. close2;
  280. if (@notify_player) { message @ep_char_name$,"[GM] "+ strcharinfo(0) +" Has Given You "+ @ep_item_count +"x "+ getitemname(@ep_item_id) +"."; }
  281. if (@do_announce)
  282. {
  283. if (@a_color$ == "bc_yellow")
  284. {
  285. if (@a_loc$ == "bc_all") {
  286. announce @anounce_msg$,bc_yellow|bc_all;
  287. } else if (@a_loc$ == "bc_map") {
  288. announce @anounce_msg$,bc_yellow|bc_map;
  289. } else {
  290. announce @anounce_msg$,bc_yellow|bc_area;
  291. }
  292. }
  293. else
  294. {
  295. if (@a_loc$ == "bc_all") {
  296. announce @anounce_msg$,bc_blue|bc_all;
  297. } else if (@a_loc$ == "bc_map") {
  298. announce @anounce_msg$,bc_blue|bc_map;
  299. } else {
  300. announce @anounce_msg$,bc_blue|bc_area;
  301. }
  302. }
  303. }
  304. end;
  305. }
  306. close;
  307.  
  308. // Give KCP [GM]
  309. L_EP_GiveKCP:
  310. next;
  311. mes @npc$;
  312. mes " ";
  313. if (getgmlevel() < @min_eventgm_lvl)
  314. {
  315. mes "^CC0000Access Denied!";
  316. mes " ";
  317. mes "You must be atleast level "+ @min_eventgm_lvl +" GM.^000000";
  318. close;
  319. }
  320. mes "Okay, how many KCP would you like to give?";
  321. mes " ";
  322. mes "Min "+ @min_kcp_amount +" and Max "+ @max_kcp_amount +".";
  323. input @ep_kcp_count;
  324. next;
  325. if (@ep_kcp_count < @min_kcp_amount || @ep_kcp_count > @max_kcp_amount)
  326. {
  327. mes @npc$;
  328. mes " ";
  329. mes "^CC0000Sorry, "+ @ep_kcp_count +" is an invalid amount.";
  330. mes " ";
  331. mes "Min "+ @min_kcp_amount +" and Max "+ @max_kcp_amount +".^000000";
  332. close;
  333. }
  334. mes @npc$;
  335. mes " ";
  336. mes "Okay, who do you want to give "+ @ep_kcp_count +" KCP?";
  337. mes " ";
  338. mes "Enter player name"+ (@check_online ? " (must be online)." : " .");
  339. input @ep_char_name$;
  340. next;
  341. set @ep_char_id,getcharid(0,@ep_char_name$);
  342. if (@check_online && !isloggedin(getcharid(3,@ep_char_name$)))
  343. {
  344. mes @npc$;
  345. mes " ";
  346. mes "^CC0000Sorry, "+ @ep_char_name$ +" is invalid.";
  347. mes " ";
  348. mes "This player either doesn't exist or s/he is not online now.^000000";
  349. close;
  350. }
  351. mes @npc$;
  352. mes " ";
  353. mes "Now, enter the reason for giving "+ @ep_kcp_count +" KCP to "+ @ep_char_name$ +".";
  354. input @ep_reason$;
  355. next;
  356. if (@ep_reason$ == "")
  357. {
  358. mes @npc$;
  359. mes " ";
  360. mes "^CC0000Sorry, that is not a valid reason.^000000";
  361. close;
  362. }
  363. if (@allow_announce)
  364. {
  365. mes @npc$;
  366. mes " ";
  367. mes "Do you want to announce the following message?";
  368. mes " ";
  369. set @anounce_msg$,"[GM] "+ strcharinfo(0) +" Gave "+ @ep_kcp_count +"x Kafra Credit Point (KCP) to "+ @ep_char_name$ +". Reason - "+ @ep_reason$;
  370. mes @anounce_msg$;
  371. if (select("Yes:No") == 1) { set @do_announce,1; } else { set @do_announce,0; }
  372. next;
  373. if (@do_announce)
  374. {
  375. mes @npc$;
  376. mes " ";
  377. mes "Where would you like to announce this message?";
  378. mes " ";
  379. mes @anounce_msg$;
  380. set @options$,"";
  381. for (set @i,0; @i < getarraysize(@announce_loc$); set @i,@i+1)
  382. {
  383. if (@announce_loc$[@i] == "bc_all") {
  384. set @options$,@options$+"Server Wide";
  385. } else if (@announce_loc$[@i] == "bc_map") {
  386. set @options$,@options$+"Everyone In The Same Map";
  387. } else if (@announce_loc$[@i] == "bc_area") {
  388. set @options$,@options$+"Everyone Near You";
  389. }
  390. if (@i != (getarraysize(@announce_loc$) - 1)) { set @options$,@options$+":"; }
  391. }
  392. set @choice,select(@options$);
  393. set @a_loc$,@announce_loc$[@choice];
  394. next;
  395. mes @npc$;
  396. mes " ";
  397. mes "What color do you want to announce in?";
  398. if (select("Yello:Blue") == 1) { set @a_color$,"bc_yellow"; } else { set @a_color$,"bc_blue"; }
  399. next;
  400. }
  401. }
  402. mes @npc$;
  403. mes " ";
  404. mes "Is this correct?";
  405. mes " ";
  406. mes "Give ^0000FF"+ @ep_kcp_count +"^000000 ^008000KCP^000000 to ^CC0000"+ @ep_char_name$ +"^000000.";
  407. mes " ";
  408. mes "Reason : "+ @ep_reason$;
  409. if (select("Yes:No") == 1)
  410. {
  411. next;
  412. set @when,callfunc("makeTimestamp");
  413. set @nb,query_sql("INSERT INTO `itemizer` VALUES(NULL,'"+ @dummy_kcp_id +"','"+ @ep_kcp_count +"','Kafra Credit Point (KCP)','"+ @ep_char_id +"','"+ @ep_char_name$ +"','"+ @ep_reason$ +"','[GM] "+ strcharinfo(0) +"','"+ @when +"','player','0')");
  414. mes @npc$;
  415. mes " ";
  416. mes "All Done~";
  417. close2;
  418. if (@notify_player) { message @ep_char_name$,"[GM] "+ strcharinfo(0) +" Has Given You "+ @ep_kcp_count +" Kafra Credit Point (KCP)."; }
  419. if (@do_announce)
  420. {
  421. if (@a_color$ == "bc_yellow")
  422. {
  423. if (@a_loc$ == "bc_all") {
  424. announce @anounce_msg$,bc_yellow|bc_all;
  425. } else if (@a_loc$ == "bc_map") {
  426. announce @anounce_msg$,bc_yellow|bc_map;
  427. } else {
  428. announce @anounce_msg$,bc_yellow|bc_area;
  429. }
  430. }
  431. else
  432. {
  433. if (@a_loc$ == "bc_all") {
  434. announce @anounce_msg$,bc_blue|bc_all;
  435. } else if (@a_loc$ == "bc_map") {
  436. announce @anounce_msg$,bc_blue|bc_map;
  437. } else {
  438. announce @anounce_msg$,bc_blue|bc_area;
  439. }
  440. }
  441. }
  442. end;
  443. }
  444. close;
  445.  
  446. // Collect Event Prize (Part 1) [Player]
  447. L_EP_Collect:
  448. next;
  449. mes @npc$;
  450. mes " ";
  451. mes "Would you like to check if any item is waiting to be collected?";
  452. if (select("Yes Please:No Thanks") == 1)
  453. {
  454. next;
  455. if (getarraysize(@db_id))
  456. {
  457. deletearray @db_id,127;
  458. deletearray @item_id,127;
  459. deletearray @item_name$,127;
  460. deletearray @item_amount,127;
  461. deletearray @reason$,127;
  462. deletearray @by_gm$,127;
  463. }
  464. set @result,query_sql("SELECT `id`,`item_id`,`item_name`,`item_amount`,`reason`,`by_gm` FROM `itemizer` WHERE (`char_id` = '"+ getcharid(0) +"' AND `for` = 'player' AND `collected` = 0) LIMIT 127",
  465. @db_id,
  466. @item_id,
  467. @item_name$,
  468. @item_amount,
  469. @reason$,
  470. @by_gm$);
  471. if (!@result)
  472. {
  473. mes @npc$;
  474. mes " ";
  475. mes "^CC0000No items are waiting to be collected by you.^000000";
  476. close;
  477. }
  478. else
  479. {
  480. goto L_EP_C_Final;
  481. }
  482. }
  483. close;
  484.  
  485. // Collect Event Prize (Part 2) [Player]
  486. L_EP_C_Final:
  487. set @options$,"";
  488. for (set @i,0; @i < @result; set @i,@i+1)
  489. {
  490. set @options$,@options$+@item_amount[@i] +"x "+@item_name$[@i]+":";
  491. }
  492. mes @npc$;
  493. mes " ";
  494. mes "Here is a list of item(s) waiting to be collected by you.";
  495. mes " ";
  496. mes "Pick the item you want to collect now.";
  497. set @choice,select(@options$) - 1;
  498. next;
  499. mes @npc$;
  500. mes " ";
  501. if (@item_id[@choice] != @dummy_kcp_id) { mes "ID - "+ @item_id[@choice]; }
  502. mes "Name - "+ @item_name$[@choice];
  503. mes "Amount - "+ @item_amount[@choice] +"x";
  504. mes "By - "+ @by_gm$[@choice];
  505. mes " ";
  506. mes "Reason - "+ @reason$[@choice];
  507. if (select("Collect Now:Collect Later") == 1)
  508. {
  509. next;
  510. if (@item_id[@choice] != @dummy_kcp_id)
  511. {
  512. if (@check_weight && checkweight(@item_id[@choice], @item_amount[@choice]) == 0)
  513. {
  514. mes @npc$;
  515. mes " ";
  516. mes "^CC0000Sorry, you cannot hold "+ @item_amount[@choice] +"x "+ @item_name$[@choice] +".";
  517. mes " ";
  518. mes "Your inventory is full.^000000";
  519. close;
  520. }
  521. }
  522. set @nb,query_sql("UPDATE `itemizer` SET `collected` = 1 WHERE (`id` = '"+ @db_id[@choice] +"') LIMIT 1");
  523. if (@item_id[@choice] != @dummy_kcp_id)
  524. {
  525. getitem @item_id[@choice],@item_amount[@choice];
  526. }
  527. else
  528. {
  529. set #CASHPOINTS,(#CASHPOINTS + @item_amount[@choice]);
  530. }
  531. set @result,(@result - 1);
  532. deletearray @db_id[@choice],1;
  533. deletearray @item_id[@choice],1;
  534. deletearray @item_name$[@choice],1;
  535. deletearray @item_amount[@choice],1;
  536. deletearray @reason$[@choice],1;
  537. deletearray @by_gm$[@choice],1;
  538. goto L_EP_C_Final;
  539. }
  540. else
  541. {
  542. next;
  543. goto L_EP_C_Final;
  544. }
  545.  
  546. // Collection Log [Player]
  547. L_EP_CLog:
  548. next;
  549. mes @npc$;
  550. mes " ";
  551. if (getarraysize(@item_name$))
  552. {
  553. deletearray @item_name$,127;
  554. deletearray @item_amount,127;
  555. deletearray @reason$,127;
  556. deletearray @by_gm$,127;
  557. deletearray @when$,127;
  558. }
  559. if (!@offset){ set @offset,0; }
  560. if (!@rows_per_page) { set @rows_per_page,10; }
  561. set @result,query_sql("SELECT `item_name`,`item_amount`,`reason`,`by_gm`,`when` FROM `itemizer` WHERE (`char_id` = '"+ getcharid(0) +"' AND `for` = 'player' AND `collected` = 1) ORDER BY `when` DESC LIMIT "+ @offset +","+ @rows_per_page,
  562. @item_name$,
  563. @item_amount,
  564. @reason$,
  565. @by_gm$,
  566. @when$);
  567. if(!@result)
  568. {
  569. if (@offset == 10) {
  570. mes "^CC0000You have not collected any items from me yet.^000000";
  571. } else {
  572. mes "^CC0000Sorry, there is no more data.^000000";
  573. }
  574. close2;
  575. if (@offset) { set @offset,0; }
  576. end;
  577. }
  578. else
  579. {
  580. for (set @i,0; @i < @result; set @i,@i+1)
  581. {
  582. mes "^0000FF"+ @item_amount[@i] +"x^000000 ^008000"+ @item_name$[@i] +"^000000";
  583. mes "Reason - "+ @reason$[@i];
  584. mes "By - "+ @by_gm$[@i];
  585. mes "When - "+ @when$[@i];
  586. if (@i != (@result - 1)) { mes " "; }
  587. }
  588. set @offset,(@offset + @rows_per_page);
  589. if (select("Next "+ @rows_per_page +" Logs:Cancel") == 2)
  590. {
  591. close2;
  592. if (@offset) { set @offset,0; }
  593. end;
  594. }
  595. goto L_EP_CLog;
  596. }
  597.  
  598. }
  599.  
  600. //
  601. // Func To Make MySQL Friendly Timestamp
  602. //
  603. function script makeTimestamp {
  604.  
  605. // Get Current Date & Time Variables
  606. set @curYear,gettime(7);
  607. set @curMonth,gettime(6);
  608. set @curDay,gettime(5);
  609. set @curHour,gettime(3);
  610. set @curMinute,gettime(2);
  611. set @curSecond,gettime(1);
  612.  
  613. // Start A New Timestamp Variable
  614. set @timestamp$,"";
  615.  
  616. // MySQL Timestamp Friendly :: Year
  617. set @timestamp$,@timestamp$+@curYear+"-";
  618.  
  619. // MySQL Timestamp Friendly :: Month
  620. if (@curMonth <= 9) {
  621. set @timestamp$,@timestamp$+"0"+@curMonth+"-";
  622. } else {
  623. set @timestamp$,@timestamp$+@curMonth+"-";
  624. }
  625.  
  626. // MySQL Timestamp Friendly :: Day
  627. if (@curDay <= 9) {
  628. set @timestamp$,@timestamp$+"0"+@curDay+" ";
  629. } else {
  630. set @timestamp$,@timestamp$+@curDay+" ";
  631. }
  632.  
  633. // MySQL Timestamp Friendly :: Hour
  634. if (@curHour <= 9) {
  635. set @timestamp$,@timestamp$+"0"+@curHour+":";
  636. } else {
  637. set @timestamp$,@timestamp$+@curHour+":";
  638. }
  639.  
  640. // MySQL Timestamp Friendly :: Minute
  641. if (@curMinute <= 9) {
  642. set @timestamp$,@timestamp$+"0"+@curMinute+":";
  643. } else {
  644. set @timestamp$,@timestamp$+@curMinute+":";
  645. }
  646.  
  647. // MySQL Timestamp Friendly :: Second
  648. if (@curSecond <= 9) {
  649. set @timestamp$,@timestamp$+"0"+@curSecond;
  650. } else {
  651. set @timestamp$,@timestamp$+@curSecond;
  652. }
  653.  
  654. // Return MySQL Friendly Timestamp
  655. return @timestamp$;
  656.  
  657. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement