Emistry

[RO] GM Secondary Password

Dec 25th, 2015
331
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.19 KB | None | 0 0
  1.  
  2. /*
  3. CREATE TABLE IF NOT EXISTS `security_gm_protection` (
  4.   `aid` INT(11) UNSIGNED NOT NULL DEFAULT '0',
  5.   `password` VARCHAR(50) NOT NULL DEFAULT '',
  6.   PRIMARY KEY  (`aid`)
  7. ) ENGINE=MyISAM;
  8. */
  9.  
  10.  
  11. prontera,155,181,5  script  GM Security 757,{
  12.     doevent "security_gm_main::OnTalk";
  13. }
  14.  
  15. -   script  security_gm_main    -1,{
  16.    
  17.     OnInit:
  18.         .md5 = 0;
  19.         .min_gm_level = 10;
  20.         end;
  21.        
  22.     OnTalk:
  23.         .@aid = getcharid(3);
  24.         .@password$ = callsub( L_GetPassword,.@aid );
  25.        
  26.         if ( getgmlevel() < .min_gm_level || !.min_gm_level ) {
  27.             mes "Not available.";
  28.         }
  29.         else {
  30.             mes "How can I help ?";
  31.             next;
  32.             switch ( select(
  33.                 ( .@password$ == "" ) ? "Setup New Password":"",
  34.                 ( .@password$ != "" ) ? "Change Password":"",
  35.                 "Cancel"
  36.             ) ) {
  37.                 case 2:
  38.                     mes "Enter Your current secondary Password";
  39.                     input .@pass1$;
  40.                     if ( .@pass1$ != .@password$ ) {
  41.                         mes "Password not match.";
  42.                         break;
  43.                     }
  44.                 case 1:
  45.                     mes "Enter your New secondary Password";
  46.                     input .@pass1$;
  47.                     mes "Please re-input your secondary password.";
  48.                     input .@pass2$;
  49.                     if ( .@pass1$ != .@pass2$ ) {
  50.                         mes "Password not match.";
  51.                     }
  52.                     else { 
  53.                         .@pass1$ = escape_sql( .@pass1$ );
  54.                         .@sql$ = (( .md5 ) ? "MD5( '"+.@pass1$+"' )":.@pass1$ );
  55.                         query_sql( "INSERT INTO `security_gm_protection` ( `aid`,`password` ) VALUES ( "+.@aid+",'"+escape_sql( .@pass1$ )+"' ) ON DUPLICATE KEY UPDATE `password` = '"+.@sql$+"'" );
  56.                         mes "Password updated.";
  57.                     }
  58.                 default: break:
  59.             }
  60.         }
  61.         close;
  62.        
  63.     OnPCLoginEvent:
  64.         if ( getgmlevel() >= .min_gm_level && .min_gm_level > 0 ) {
  65.             .@password$ = callsub( L_GetPassword,getcharid(3) );
  66.             if ( .@password$ != "" ) {
  67.                 Manner = -2147483647;
  68.                 mes "Please enter your secondary Password:";
  69.                 input .@pass$;
  70.                 .@is_correct = ( .@pass$ == .@password$ );
  71.                 mes "Verification"+( .@is_correct ? "":" NOT" )+" success.";
  72.                 Manner = 0;
  73.                 if ( !.@is_correct ) {
  74.                     atcommand "@kick "+strcharinfo(0);
  75.                 }
  76.                 close;
  77.             }
  78.         }
  79.         end;
  80.        
  81.     L_GetPassword:
  82.         query_sql( "SELECT `password` FROM `security_gm_protection` WHERE `aid` = "+getarg( 0,0 )+" LIMIT 1",.@password$ );
  83.         return .@password$;
  84.        
  85. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment