yuhsing

Untitled

Nov 9th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.63 KB | None | 0 0
  1.  
  2.  
  3. prontera,155,181,5 script Sample#freebie 757,{
  4. if( getgmlevel() >= .GMLevel )
  5. mes "Hello GM '"+strcharinfo(0)+"' Do you want to manage the Freebies Application?";
  6. else
  7. mes "How can i help you ?";
  8. next;
  9. switch( select( "Freebies Informations",
  10. "Apply for Freebies",
  11. ( getgmlevel() < .GMLevel )?"":"^0055FF[ GM ]^000000 Manage Freebies" )){
  12. Case 1:
  13. mes "We have a freebies unique system, you will receive a 1st Pack in limited time, and when you complete the process you will receive another freebies which make you more stronger!.";
  14. next;
  15. mes "You can ^FF0000only register once and apply one character per account^000000 the items are not tradable.";
  16. next;
  17. mes "^FF0000NOTE:^000000 If we found that your abusing this system all of your Account will get punished.";
  18. break;
  19. Case 2:
  20. query_sql( "SELECT `status` FROM `E-Freebies` WHERE `account_id` = '"+getcharid(3)+"'",.@Status );
  21. switch( .@Status ){
  22. Case 0:
  23. mes "Do you want to apply for freebies?, you need to register your name here!";
  24. input .@Name$;
  25. if( .@Name$ == strcharinfo(0) ){
  26. mes "Thanks you are now registered to our freebies system!";
  27. query_sql( "SELECT `last_ip` FROM `login` WHERE `account_id`='"+getcharid(3)+"'",.@IP$ );
  28. query_sql( "INSERT INTO `E-Freebies` VALUES ( '"+getcharid(3)+"','"+strcharinfo(0)+"','1','1','"+.@IP$+"' )" );
  29. next;
  30. mes "Here's your freebies, when you spent ^FF0000another 24 hours^000000 playing you will receive another freebies!";
  31. for( set .@i,0; .@i < getarraysize( .Freebies1 ) - 1; set .@i,.@i + 2 )
  32. getitem .Freebies1[.@i],.Freebies1[.@i+1];
  33. addtimer 60000,strnpcinfo(0)+"::OnMinuteCheck";
  34. next;
  35. mes "Remember 24 hours playing without ^FF0000Vending^000000 will receive another Pack!";
  36. }else{
  37. mes "You can't register any other person than yourself in this System.";
  38. }
  39. break;
  40. Case 1:
  41. query_sql( "SELECT `time` FROM `E-Freebies` WHERE `account_id` = '"+getcharid(3)+"'",.@OnlineTime );
  42. if( .@OnlineTime < 86400 ){
  43. mes "You've been online for ^0055FF"+( .@OnlineTime / 3600 )+"^000000 hours and you have about ^FF0000"+( ( 86400 - .@OnlineTime ) / 3600 )+"^000000 hours left! to get the special package.";
  44. }else{
  45. mes "It looks like you've that your Newbie Test verywell, i would like you to give a warm welcome!";
  46. if( select("Claim Freebies:Maybe Later....") == 1 ){
  47. announce "Lets welcome give a warm welcome to our new server '"+strcharinfo(0)+"' for being active in server",0;
  48. for( set .@i,0; .@i < getarraysize( .Freebies1 ) - 1; set .@i,.@i + 2 )
  49. getitem .Freebies2[.@i],.Freebies2[.@i+1];
  50. query_sql( "SELECT `last_ip` FROM `login` WHERE `account_id`='"+getcharid(3)+"'",.@IP$ );
  51. query_sql("UPDATE `E-Freebies` SET `status`='2',`last_ip`='"+.@IP$+"' WHERE `account_id`='"+getcharid(3)+"'");
  52. }
  53. }
  54. break;
  55. Case 2:
  56. mes "You have collected all the freebies.";
  57. break;
  58. Case 3:
  59. mes "Your Freebies Application has been denied.";
  60. default: break;
  61. }
  62. break;
  63. Case 3:
  64. query_sql( "SELECT `name`,`status` FROM `E-Freebies` WHERE `status`<> 2 ORDER BY `status` ASC LIMIT 100",.@Name$,.@Status );
  65. mes "These are the player who have apply for freebies package but not yet completed.";
  66. mes "Total of "+getarraysize( .@Name$ )+" Records found.";
  67. if( getarraysize( .@Name$ ) <= 0 ) close;
  68. for( set .@i,0; .@i < getarraysize( .@Name$ ); set .@i,.@i + 1 )
  69. set .@Menu$,.@Menu$ +( ( .@Status[.@i] == 1 )?"^00EE55[ Pending ]":( .@Status[.@i] == 3 )?"^FF0000[ Denied ]":"^0055FF[ Approved ]" )+"^000000 "+.@Name$[.@i]+"^000000"+":";
  70. next;
  71. set .@i,( select( .@Menu$ ) - 1 );
  72. mes "Player Name : ^0055FF"+.@Name$[.@i]+"^000000";
  73. mes "Status : "+( ( .@Status[.@i] == 1 )?"^00EE55[ PENDING ]":( .@Status[.@i] == 3 )?"^FF0000[ DENIED ]":"^0055FF[ APPROVED ]" )+"^000000";
  74. set .@Option,select( ( .@Status[.@i] != 2 )?"Approve Application":"",( .@Status[.@i] == 1 )?"Deny Application":"",( .@Status[.@i] == 2 )?"":"Delete Application");
  75. switch( .@Option ){
  76. Case 1: query_sql("UPDATE `E-Freebies` SET `status`='1',`time`='86400' WHERE `name`='"+.@Name$[.@i]+"'"); break;
  77. Case 2: query_sql("UPDATE `E-Freebies` SET `status`='3',`time`='0' WHERE `name`='"+.@Name$[.@i]+"'"); break;
  78. Case 3: query_sql("DELETE FROM `E-Freebies` WHERE `name`='"+.@Name$[.@i]+"'"); break;
  79. }
  80. mes "Application ^0055FF"+( ( .@Option == 1 )?"Approved":( ( .@Option == 2 )?"Denied":"Deleted" ))+"^000000";
  81. if( isloggedin( .@ID[.@i] ) ){
  82. message .@Name$[.@i],"Your Freebies Packages has been "+( ( .@Option == 1 )?"Approved":( ( .@Option == 2 )?"Denied":"Deleted" ) )+" by GM '"+strcharinfo(0)+"'";
  83. }
  84. break;
  85. }
  86. close;
  87.  
  88. OnInit:
  89. set .GMLevel,90;
  90. // Freebies Pack 1
  91. setarray .Freebies1[0],512,10,607,1,608,2;
  92. // Freebies Pack 2
  93. setarray .Freebies2[0],512,20,607,10,608,20;
  94. end;
  95.  
  96.  
  97. OnMinuteCheck:
  98. if( !checkchatting() && !checkvending() )
  99. set @Online,@Online + 60;
  100. if( @Online >= 86400 ){
  101. message strcharinfo(0),"You have online for 24 hours and you may get the freebies again.";
  102. }
  103. else
  104. addtimer 60000,strnpcinfo(0)+"::OnMinuteCheck";
  105. end;
  106.  
  107. OnPCLoginEvent:
  108. query_sql( "SELECT `status`,`time` FROM `E-Freebies` WHERE `account_id` = '"+getcharid(3)+"' AND `status`='1'",.@Status,@Online );
  109. if( @Online && @Online < 86400 ){
  110. addtimer 60000,strnpcinfo(0)+"::OnMinuteCheck";
  111. }
  112. end;
  113.  
  114. OnPCLogoutEvent:
  115. query_sql( "SELECT `time` FROM `E-Freebies` WHERE `account_id` = '"+getcharid(3)+"' AND `status`='1'",.@Online2 );
  116. if( @Online >= .@Online2 )
  117. query_sql( "UPDATE `E-Freebies` SET `time`='"+@Online+"' WHERE `account_id` = '"+getcharid(3)+"'" );
  118. end;
  119. }
Advertisement
Add Comment
Please, Sign In to add comment