Advertisement
plugandplaydev

Guild Storage with Password and Verification Question

Jul 25th, 2016
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.05 KB | None | 0 0
  1. //===============================================//
  2. // This script is made by Plug and Play //
  3. // Facebook http://facebook.com/plugandplayPH //
  4. // Script Title : Guild Storage NPC //
  5. // Version : 1.0 //
  6. // DO NOT REMOVE THE SCRIPT OWNER //
  7. //---------------- FEATURES ---------------------//
  8. // Bindcommand : @gstorage/@guildstorage //
  9. // .MemberUsed = Setting for Player and Leader //
  10. // Verification Question and Answer //
  11. // Have 3 Attempts for Guild Password //
  12. //===============================================//
  13.  
  14. prontera,100,65,4 script Guild Manager 4_M_HUGRANFA,{
  15. OnGuildStorage: // Do not remove this
  16. // NPC Name
  17. set .@gnpcname$,"[ ^CC00FF Guild Manager ^000000]";
  18.  
  19. // Who can use Guild Storage
  20. // 0 = Guild Leader Only
  21. // 1 = All The Members
  22. set .MemberUsed,1;
  23.  
  24. // Verification Question
  25. // You can ONLY set 4 Verification Question
  26. // Less than or Exceeding by 4 make the script Error
  27. setarray .VerificationQuestion$[0],"Ragnarok Pet Name","Coolest Ragnarok Skill","Hangout Place in Ragnarok","Cutest Ragnarok Headgear";
  28.  
  29. //---- SQL ----//
  30. set .check_gname,query_sql(" SELECT `Guild_ID` , `Password` , `Question` , `Answer` FROM `pnp_gstorage` WHERE `Guild_ID`= '"+getcharid(2)+"'",.@GuildID,.@GuildPassword$,.@GuildQuestion$,.@GuildAnswer$ );
  31. //------------//
  32. if( !getcharid(2) ) {
  33. mes .@gnpcname$;
  34. mes "Sorry, You dont have a Guild.";
  35. close;
  36. }
  37. mes .@gnpcname$;
  38. mes "I am the Manager of All the Registered Guilds.";
  39. mes "You can use Guild Storage with Password.";
  40. next;
  41. if( !.check_gname && getguildmasterid( getcharid(2) ) == getcharid(0)){
  42. goto Register_Guild;
  43. }
  44. if( .MemberUsed >= 1 ){
  45. if ( .check_gname && getguildmasterid( getcharid(2) ) != getcharid(0) ) goto Member_Guild_Storage;
  46. else if ( .check_gname && getguildmasterid( getcharid(2) ) == getcharid(0) ) goto Leader_Guild_Storage;
  47. else if ( !.check_gname ) mes .@gnpcname$; mes "Guild is not Registered."; close;
  48. }
  49. if ( .MemberUsed <= 0 ){
  50. if ( getguildmasterid( getcharid(2) ) == getcharid(0) ){
  51. goto Leader_Guild_Storage;
  52. }
  53. else if ( getguildmasterid( getcharid(2) ) != getcharid(0) ){
  54. mes .@gnpcname$;
  55. mes "Only the Guild Leader can access the ^00FF00Guild Storage^000000.";
  56. close;
  57. }
  58. }
  59.  
  60. Register_Guild:
  61. mes .@gnpcname$;
  62. mes "You guild is not yet register.";
  63. mes "You must follow and read the rules.";
  64. next;
  65. mes .@gnpcname$;
  66. mes "1. We are not responsible to any lose items.";
  67. mes "2. Do not disclosed your Guild Storage Info.";
  68. mes "3. You must filled up the following Info needed.";
  69. mes "3. Just Enjoy Using our Service.";
  70. next;
  71. mes .@gnpcname$;
  72. mes "Set your ^CC0000Guild Password^000000.";
  73. input @Guild_Password$;
  74. next;
  75. mes .@gnpcname$;
  76. mes "Re-type your Guild Password.";
  77. input @Retype_Guild_Password$;
  78. next;
  79. if( @Guild_Password$ != @Retype_Guild_Password$ ){
  80. mes .@gnpcname$;
  81. mes "^FF0000Error : ^000000 Password doesn't Match.";
  82. next;
  83. switch(select("Register Guild:Cancel Action")){
  84.  
  85. case 1:
  86. goto Register_Guild;
  87. break;
  88.  
  89. case 2:
  90. goto Exit_Option;
  91. break;
  92.  
  93. } // end of switch
  94. } // end of recognizing retype password
  95.  
  96. if( @Guild_Password$ == @Retype_Guild_Password$ ){
  97. mes .@gnpcname$;
  98. mes "Choose your Guild Question.";
  99. mes "You can use this in changing your Guild Storage Password.";
  100. next;
  101. menu .VerificationQuestion$[0],VQuestion_01,.VerificationQuestion$[1],VQuestion_02,.VerificationQuestion$[2],VQuestion_03,.VerificationQuestion$[3],VQuestion_04;
  102.  
  103. VQuestion_01:
  104. mes .@gnpcname$;
  105. mes .VerificationQuestion$[0];
  106. mes "Put your Answer.";
  107. input @Guild_Answer$;
  108. next;
  109. menu "Submit Guild Registration",sgr_q1,"Cancel Action",sgr_c1;
  110.  
  111. sgr_q1:
  112. mes .@gnpcname$;
  113. mes "^00FF00"+strcharinfo(2)+"^000000 has been registered.";
  114. query_sql( "INSERT INTO `pnp_gstorage` ( `Guild_ID` , `Password` , `Question` , `Answer` ) VALUES ( '"+getcharid(2)+"' , '"+@Guild_Password$+"' , '"+.VerificationQuestion$[0]+"' , '"+@Guild_Answer$+"' ) ");
  115. close;
  116. end; // end of submit_guild_registration
  117.  
  118. sgr_c1:
  119. goto Exit_Option;
  120. end; // end of sgr_cancel
  121.  
  122. VQuestion_02:
  123. mes .@gnpcname$;
  124. mes .VerificationQuestion$[1];
  125. mes "Put your Answer.";
  126. input @Guild_Answer$;
  127. next;
  128. menu "Submit Guild Registration",sgr_q2,"Cancel Action",sgr_c2;
  129.  
  130. sgr_q2:
  131. mes .@gnpcname$;
  132. mes "^00FF00"+strcharinfo(2)+"^000000 has been registered.";
  133. query_sql( "INSERT INTO `pnp_gstorage` ( `Guild_ID` , `Password` , `Question` , `Answer` ) VALUES ( '"+getcharid(2)+"' , '"+@Guild_Password$+"' , '"+.VerificationQuestion$[1]+"' , '"+@Guild_Answer$+"' ) ");
  134. close;
  135. end; // end of submit_guild_registration
  136.  
  137. sgr_c2:
  138. goto Exit_Option;
  139. end; // end of sgr_cancel
  140.  
  141. VQuestion_03:
  142. mes .@gnpcname$;
  143. mes .VerificationQuestion$[2];
  144. mes "Put your Answer.";
  145. input @Guild_Answer$;
  146. next;
  147. menu "Submit Guild Registration",sgr_q3,"Cancel Action",sgr_c3;
  148.  
  149. sgr_q3:
  150. mes .@gnpcname$;
  151. mes "^00FF00"+strcharinfo(2)+"^000000 has been registered.";
  152. query_sql( "INSERT INTO `pnp_gstorage` ( `Guild_ID` , `Password` , `Question` , `Answer` ) VALUES ( '"+getcharid(2)+"' , '"+@Guild_Password$+"' , '"+.VerificationQuestion$[2]+"' , '"+@Guild_Answer$+"' ) ");
  153. close;
  154. end; // end of submit_guild_registration
  155.  
  156. sgr_c3:
  157. goto Exit_Option;
  158. end; // end of sgr_cancel
  159.  
  160. VQuestion_04:
  161. mes .@gnpcname$;
  162. mes .VerificationQuestion$[0];
  163. mes "Put your Answer.";
  164. input @Guild_Answer$;
  165. next;
  166. menu "Submit Guild Registration",sgr_q4,"Cancel Action",sgr_c4;
  167.  
  168. sgr_q4:
  169. mes .@gnpcname$;
  170. mes "^00FF00"+strcharinfo(2)+"^000000 has been registered.";
  171. query_sql( "INSERT INTO `pnp_gstorage` ( `Guild_ID` , `Password` , `Question` , `Answer` ) VALUES ( '"+getcharid(2)+"' , '"+@Guild_Password$+"' , '"+.VerificationQuestion$[3]+"' , '"+@Guild_Answer$+"' ) ");
  172. close;
  173. end; // end of submit_guild_registration
  174.  
  175. sgr_c4:
  176. goto Exit_Option;
  177. end; // end of sgr_cancel
  178.  
  179. } // end of if retype password is match
  180.  
  181. end; // end of Register_Guild
  182.  
  183.  
  184. Member_Guild_Storage:
  185. mes .@gnpcname$;
  186. mes "Put your Guild Storage Password";
  187. mes "You only have 3 Attempts.";
  188. mes "Or else I will broadcast your name for hacking the guild storage.";
  189. input @First_Attempt_Password$;
  190. next;
  191. if( .@GuildPassword$ != @First_Attempt_Password$ ){
  192. mes .@gnpcname$;
  193. mes "^FF0000Error^000000 : Incorrect Password.";
  194. mes "This is your ^FF00CC2nd Attempt^000000";
  195. input @Second_Attempt_Password$;
  196. next;
  197.  
  198. if ( .@GuildPassword$ != @Second_Attempt_Password$ ){
  199. mes .@gnpcname$;
  200. mes "^FF0000Error^000000 : Incorrect Password.";
  201. mes "This is your ^FF00CCLast Attempt^000000";
  202. input @Third_Attempt_Password$;
  203. next;
  204.  
  205. if ( .@GuildPassword$ != @Third_Attempt_Password$ ){
  206. mes .@gnpcname$;
  207. mes "You trying to hack this guild.";
  208. mes "You are now in shame.";
  209. announce "[ Guild Manager ] : "+strcharinfo(0)+" is trying to hack the guild storage of "+strcharinfo(2)+" Guild.",0,0xCCCCFF;
  210. close;
  211. }
  212. else if ( .@GuildPassword$ == @Third_Attempt_Password$ ){
  213. mes .@gnpcname$;
  214. mes "Get your Guild Stuff now!";
  215. close2;
  216. guildopenstorage();
  217. end;
  218. }
  219. }
  220. else if ( .@GuildPassword$ == @Second_Attempt_Password$ ){
  221. mes .@gnpcname$;
  222. mes "Get your Guild Stuff now!";
  223. close2;
  224. guildopenstorage();
  225. end;
  226. }
  227.  
  228. }
  229. else if ( .@GuildPassword$ == @First_Attempt_Password$ ){
  230. mes .@gnpcname$;
  231. mes "Get your Guild Stuff now!";
  232. close2;
  233. guildopenstorage();
  234. end;
  235. }
  236.  
  237. end; // end of Member_Guild_Storage
  238.  
  239.  
  240. Leader_Guild_Storage:
  241. mes .@gnpcname$;
  242. mes "Good Day "+strcharinfo(0);
  243. mes "Guild : "+strcharinfo(2);
  244. mes "Choose an option.";
  245. next;
  246. switch(select("Open Guild Storage:Change Password:Cancel Action")){
  247.  
  248. case 1:
  249. mes .@gnpcname$;
  250. mes "Put your Guild Storage Password";
  251. mes "You only have 3 Attempts.";
  252. mes "Or else I will broadcast your name for hacking the guild storage.";
  253. input @First_Attempt_Password$;
  254. next;
  255. if( .@GuildPassword$ != @First_Attempt_Password$ ){
  256. mes .@gnpcname$;
  257. mes "^FF0000Error^000000 : Incorrect Password.";
  258. mes "This is your ^FF00CC2nd Attempt^000000";
  259. input @Second_Attempt_Password$;
  260. next;
  261.  
  262. if ( .@GuildPassword$ != @Second_Attempt_Password$ ){
  263. mes .@gnpcname$;
  264. mes "^FF0000Error^000000 : Incorrect Password.";
  265. mes "This is your ^FF00CCLast Attempt^000000";
  266. input @Third_Attempt_Password$;
  267. next;
  268.  
  269. if ( .@GuildPassword$ != @Third_Attempt_Password$ ){
  270. mes .@gnpcname$;
  271. mes "You trying to hack this guild.";
  272. mes "You are now in shame.";
  273. announce "[ Guild Manager ] : "+strcharinfo(0)+" is trying to hack the guild storage of "+strcharinfo(2)+" Guild.",0,0xCCCCFF;
  274. close;
  275. }
  276. else if ( .@GuildPassword$ == @Third_Attempt_Password$ ){
  277. mes .@gnpcname$;
  278. mes "Get your Guild Stuff now!";
  279. close2;
  280. guildopenstorage();
  281. end;
  282. }
  283. }
  284. else if ( .@GuildPassword$ == @Second_Attempt_Password$ ){
  285. mes .@gnpcname$;
  286. mes "Get your Guild Stuff now!";
  287. close2;
  288. guildopenstorage();
  289. end;
  290. }
  291.  
  292. }
  293. else if ( .@GuildPassword$ == @First_Attempt_Password$ ){
  294. mes .@gnpcname$;
  295. mes "Get your Guild Stuff now!";
  296. close2;
  297. guildopenstorage();
  298. end;
  299. }
  300. break;
  301.  
  302. case 2:
  303. mes .@gnpcname$;
  304. mes "Before you can change the ^00CC00Guild Password^000000, you must fill all the Info needed.";
  305. mes "This is for the security purposes.";
  306. next;
  307. mes .@gnpcname$;
  308. mes "Guild Question :";
  309. mes .@GuildQuestion$;
  310. input @Guild_Verification_Answer$;
  311. next;
  312.  
  313. if( @Guild_Verification_Answer$ == .@GuildAnswer$ ){
  314. mes .@gnpcname$;
  315. mes "Put your ^CC0000Old Password^000000";
  316. input @Old_Guild_Password$;
  317. next;
  318.  
  319. if( @Old_Guild_Password$ == .@GuildPassword$ ){
  320. mes .@gnpcname$;
  321. mes "Put your ^006633New Guild Password^000000";
  322. input @New_Guild_Password$;
  323. next;
  324.  
  325. if( .@GuildPassword$ == @New_Guild_Password$ ){
  326. mes .@gnpcname$;
  327. mes "^FF0000Error^000000 : New Password is your Old Password";
  328. next;
  329. goto Leader_Guild_Storage;
  330. }
  331. if( .@GuildPassword$ != @New_Guild_Password$){
  332. mes .@gnpcname$;
  333. mes "Re-Type your ^006633New Guild Password^000000";
  334. input @Retype_New_Guild_Password$;
  335. next;
  336.  
  337. if ( @New_Guild_Password$ == @Retype_New_Guild_Password$ ){
  338. mes .@gnpcname$;
  339. mes "You successfully change your ^CC0000Guild Password^000000";
  340. query_sql("UPDATE `pnp_gstorage` SET `Password`= '"+@New_Guild_Password$+"' WHERE `Guild_ID`='"+getcharid(2)+"'");
  341. close;
  342. }
  343. else if ( @New_Guild_Password$ != @Retype_New_Guild_Password$ ){
  344. mes .@gnpcname$;
  345. mes "^FF0000Error^000000 : New Password and Re-Type New Password doesn't match";
  346. next;
  347. goto Leader_Guild_Storage;
  348. }
  349. }
  350. }
  351. else if( @Old_Guild_Password$ != .@GuildPassword$ ){
  352. mes .@gnpcname$;
  353. mes "^FF0000Error^000000 : Incorrect Password";
  354. next;
  355. goto Leader_Guild_Storage;
  356. }
  357. }
  358.  
  359. else if( @Guild_Verification_Answer$ != .@GuildAnswer$ ){
  360. mes .@gnpcname$;
  361. mes "^FF0000Error^000000 : Incorrect Guild Verification Answer";
  362. next;
  363. goto Leader_Guild_Storage;
  364. }
  365.  
  366. close;
  367. break;
  368.  
  369. case 3:
  370. goto Exit_Option;
  371. break;
  372.  
  373.  
  374.  
  375. } // end of switch
  376.  
  377. end; // end of Leader_Guild_Storage
  378.  
  379. Exit_Option:
  380. mes .@gnpcname$;
  381. mes "Come back later.";
  382. close;
  383. end; // end of Exit_Option
  384.  
  385. OnInit:
  386. bindatcmd "gstorage",strnpcinfo(3)+"::OnGStorage";
  387. bindatcmd "guildstorage",strnpcinfo(3)+"::OnGStorage";
  388. end;
  389.  
  390. OnGStorage:
  391. goto OnGuildStorage;
  392. end;
  393. } // end of header
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement